{"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThis problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mode. Please be sure to use the stream flushing operation after each query\u0027s output in order not to leave part of your output in some buffer. For example, in C++ you\u0027ve got to use the \u003cspan class\u003d\"tex-font-style-tt\"\u003efflush(stdout)\u003c/span\u003e function, in Java — call \u003cspan class\u003d\"tex-font-style-tt\"\u003eSystem.out.flush()\u003c/span\u003e, and in Pascal — \u003cspan class\u003d\"tex-font-style-tt\"\u003eflush(output)\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eBulls and Cows (also known as Cows and Bulls or Pigs and Bulls or Bulls and Cleots) is an old code-breaking paper and pencil game for two players, predating the similar commercially marketed board game Mastermind.\u003c/p\u003e\u003cp\u003eOn a sheet of paper, the first player thinks a secret string. This string consists only of digits and has the length \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e. The digits in the string \u003cspan class\u003d\"tex-font-style-bf\"\u003emust\u003c/span\u003e be all different, no two or more equal digits are allowed.\u003c/p\u003e\u003cp\u003eThen the second player tries to guess his opponent\u0027s string. For every guess the first player gives the number of matches. If the matching digits are on their right positions, they are \"bulls\", if on different positions, they are \"cows\". Thus a response is a pair of numbers — the number of \"bulls\" and the number of \"cows\". A try can contain equal digits.\u003c/p\u003e\u003cp\u003eMore formally, let\u0027s the secret string is \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e and the second player are trying to guess it with a string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e. The number of \"bulls\" is a number of such positions \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003ei\u003c/i\u003e ≤ 4\u003c/span\u003e) where \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e[\u003ci\u003ei\u003c/i\u003e] \u003d \u003ci\u003ex\u003c/i\u003e[\u003ci\u003ei\u003c/i\u003e]\u003c/span\u003e. The number of \"cows\" is a number of such digits \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ec\u003c/i\u003e\u003c/span\u003e that \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e contains \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ec\u003c/i\u003e\u003c/span\u003e in the position \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e (i.e. \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e[\u003ci\u003ei\u003c/i\u003e] \u003d \u003ci\u003ec\u003c/i\u003e\u003c/span\u003e), \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e contains \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ec\u003c/i\u003e\u003c/span\u003e, but \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e[\u003ci\u003ei\u003c/i\u003e] ≠ \u003ci\u003ec\u003c/i\u003e\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eFor example, the secret string is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0427\u003c/span\u003e\", the opponent\u0027s try is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0724\u003c/span\u003e\", then the answer is \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e bulls and \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e cows (the bulls are \"0\" and \"2\", the cows are \"4\" and \"7\"). If the secret string is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0123\u003c/span\u003e\", the opponent\u0027s try is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0330\u003c/span\u003e\", then the answer is \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e bull and \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e cow.\u003c/p\u003e\u003cp\u003eIn this problem you are to guess the string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e that the system has chosen. You only know that the chosen string consists of \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e distinct digits.\u003c/p\u003e\u003cp\u003eYou can make queries to the testing system, each query is the output of a single \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e-digit string. The answer to the query is the number of bulls and number of cows. If the system\u0027s response equals \"4 0\", that means the interaction with your problem is over and the program must terminate. That is possible for two reasons — the program either guessed the number \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e or made an invalid action (for example, printed letters instead of digits).\u003c/p\u003e\u003cp\u003eYour program is allowed to do at most \u003cspan class\u003d\"tex-span\"\u003e50\u003c/span\u003e queries.\u003c/p\u003e\u003cp\u003eYou can hack solutions of other participants providing a 4-digit string containing distinct digits — the secret string.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eTo read answers to the queries, the program must use the standard input.\u003c/p\u003e\u003cp\u003eThe program will receive pairs of non-negative integers in the input, one pair per line. The first number in a pair is a number of bulls and the second one is a number of cows of the string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e and the string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e printed by your program. If the system response equals \"4 0\", then your solution should terminate.\u003c/p\u003e\u003cp\u003eThe testing system will let your program read the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th pair of integers from the input only after your program displays the corresponding system query in the output: prints value \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e in a single line and executes operation \u003cspan class\u003d\"tex-font-style-tt\"\u003eflush\u003c/span\u003e.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe program must use the standard output to print queries.\u003c/p\u003e\u003cp\u003eYour program must output requests — \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e-digit strings \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e, \u003ci\u003ex\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e, ...\u003c/span\u003e, one per line. After the output of each line the program must execute \u003cspan class\u003d\"tex-font-style-tt\"\u003eflush\u003c/span\u003e operation. The program should read the answer to the query from the standard input.\u003c/p\u003e\u003cp\u003eYour program is allowed to do at most \u003cspan class\u003d\"tex-span\"\u003e50\u003c/span\u003e queries.\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\u003e0 1\n2 0\n1 1\n0 4\n2 1\n4 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8000\n0179\n3159\n3210\n0112\n0123\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\u003eThe secret string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e in the example is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0123\u003c/span\u003e\".\u003c/p\u003e"}}]}