{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eConsider two binary sequences \u003ci\u003eA\u003c/i\u003e and \u003ci\u003eB\u003c/i\u003e of length \u003ci\u003en\u003c/i\u003e each.\r\nLet us call these sequences \u003ci\u003ecompatible\u003c/i\u003e if \u003ci\u003eA\u003c/i\u003e XOR \u003ci\u003eB\u003c/i\u003e \u003d \u003ci\u003eA + B\u003c/i\u003e\r\nwhere XOR is the element-wise exclusive OR operation.\r\n\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eGiven an integer \u003ci\u003en\u003c/i\u003e and a pair of binary sequences \u003ci\u003ep\u003c/i\u003e and \u003ci\u003eq\u003c/i\u003e,\r\nfind the pair of compatible binary sequences \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e which comes\r\nfirst after the pair (\u003ci\u003ep\u003c/i\u003e, \u003ci\u003eq\u003c/i\u003e). Pair (\u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e) is said to be\r\nlexicographically less that (\u003ci\u003ec\u003c/i\u003e, \u003ci\u003ed\u003c/i\u003e) if \u003ci\u003ea\u003c/i\u003e is lexicographically less\r\nthan \u003ci\u003ec\u003c/i\u003e, or \u003ci\u003ea\u003c/i\u003e and \u003ci\u003ec\u003c/i\u003e are equal and \u003ci\u003eb\u003c/i\u003e is lexicographically less than \u003ci\u003ed\u003c/i\u003e.\r\nIf there is no pair of compatible binary sequences lexicographically greater\r\nthan (\u003ci\u003ep\u003c/i\u003e, \u003ci\u003eq\u003c/i\u003e), output the lexicographically first compatible pair.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThere is a single integer \u003ci\u003en\u003c/i\u003e (1\u0026nbsp;≤\u0026nbsp;\u003ci\u003en\u003c/i\u003e\u0026nbsp;≤\u0026nbsp;100000) on the first line of\r\nthe input. The sequence \u003ci\u003ep\u003c/i\u003e is given on the second line, and the sequence\r\n\u003ci\u003eq\u003c/i\u003e is on the third one. There are no spaces or other delimiters inside the\r\nsequences; however, there could be trailing whitespace on these two lines.\r\n\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput the sequences \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e on the first two lines of the output,\r\ncorrespondingly. Use the same format as the input.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n0\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr\u003e\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n01\r\n10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n00\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}