{"problem":{"name":"Long Common Subsequence","description":{"content":"You are given $3$ binary strings $S_1, S_2, S_3$, each containing exactly $N$ `0`'s and $N$ `1`'s. Find a binary string of length $2N+1$, which is a subsequence of all of the strings $S_1 + S_1, S_2 +","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc052_a"},"statements":[{"statement_type":"Markdown","content":"You are given $3$ binary strings $S_1, S_2, S_3$, each containing exactly $N$ `0`'s and $N$ `1`'s.\nFind a binary string of length $2N+1$, which is a subsequence of all of the strings $S_1 + S_1, S_2 + S_2, S_3 + S_3$ ($s+t$ denotes the concatenation of strings $s$ and $t$ in order). It's guaranteed that under the constraints above such a string always exists.\nHere a string $B$ is a subsequence of a string $A$ if $B$ can be obtained by removing zero or more characters from $A$ and concatenating the remaining characters without changing the order.\nYou will be given $T$ test cases. Solve each of them.\n\n## Constraints\n\n*   $1 \\le T \\le 10^5$\n*   $1\\le N \\le 10^5$\n*   $S_i$ is a binary string of length $2N$ consisting of $N$ `0`'s and $N$ `1`'s.\n*   The sum of $N$ over all test cases doesn't exceed $10^5$.\n\n## Input\n\nInput is given from Standard Input in the following format. The first line of input is as follows:\n\n$T$\n\nThen, $T$ test cases follow, each of which is in the following format:\n\n$N$\n$S_1$\n$S_2$\n$S_3$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc052_a","tags":[],"sample_group":[["2\n1\n01\n01\n10\n2\n0101\n0011\n1100","010\n11011\n\nIn the first case, `010` is a subsequence of `0101`, `0101`, and `1010`.\nIn the second case, `11011` is a subsequence of `01010101`, `00110011`, and `11001100`."]],"created_at":"2026-03-03 11:01:14"}}