{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFor her birthday Alice received an interesting gift from her friends – The Light Square. The Light Square game is played on an $$$N \\times N$$$ lightbulbs square board with a magical lightbulb bar of size $$$N \\times 1$$$ that has magical properties. At the start of the game some lights on the square board and magical bar are turned on. The goal of the game is to transform the starting light square board pattern into some other pattern using the magical bar without rotating the square board. The magical bar works as follows: \u003c/p\u003e\u003cp\u003eIt can be placed on any row or column \u003c/p\u003e\u003cp\u003eThe orientation of the magical lightbulb must be left to right or top to bottom for it to keep its magical properties \u003c/p\u003e\u003cp\u003eThe entire bar needs to be fully placed on a board \u003c/p\u003e\u003cp\u003eThe lights of the magical bar never change \u003c/p\u003e\u003cp\u003eIf the light on the magical bar is the same as the light of the square it is placed on it will switch the light on the square board off, otherwise it will switch the light on \u003c/p\u003e\u003cp\u003eThe magical bar can be used an infinite number of times \u003c/p\u003e\u003cp\u003eAlice has a hard time transforming her square board into the pattern Bob gave her. Can you help her transform the board or let her know it is impossible? If there are multiple solutions print any. \u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one positive integer number $$$N\\ (1 \\leq N \\leq 2000)$$$ representing the size of the square board. \u003c/p\u003e\u003cp\u003eThe next $$$N$$$ lines are strings of length $$$N$$$ consisting of 1\u0027s and 0\u0027s representing the initial state of the square board starting from the top row. If the character in a string is 1 it means the light is turned on, otherwise it is off. \u003c/p\u003e\u003cp\u003eThe next $$$N$$$ lines are strings of length $$$N$$$ consisting of 1\u0027s and 0\u0027s representing the desired state of the square board starting from the top row that was given to Alice by Bob. \u003c/p\u003e\u003cp\u003eThe last line is one string of length $$$N$$$ consisting of 1\u0027s and 0\u0027s representing the pattern of the magical bar in a left to right order. \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eTransform the instructions for Alice in order to transform the square board into the pattern Bob gave her. The first line of the output contains an integer number $$$M\\ (0 \\leq M \\leq 10^5$$$) representing the number of times Alice will need to apply the magical bar. \u003c/p\u003e\u003cp\u003eThe next $$$M$$$ lines are of the form \"col $$$X$$$\" or \"row $$$X$$$\", where $$$X$$$ is $$$0$$$-based index of the matrix, meaning the magical bar should be applied to either row $$$X$$$ or column $$$X$$$. If there is no solution, print only -1. In case of multiple solutions print any correct one. \u003c/p\u003e"}},{"title":"Examples","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\u003e2\n11\n11\n00\n01\n11\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e2\n10\n00\n00\n00\n10\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\nrow 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e3\n110\n011\n100\n100\n011\n100\n100\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\nrow 0\ncol 0\ncol 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eExample 1: It is impossible to transform square board from one format to another\u003c/p\u003e\u003cp\u003eExample 2: Magic bar can be applied on first row or column.\u003c/p\u003e"}}]}