{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"Problem:","value":{"format":"PLAIN","content":"After a hard break-up Biswajit decided to move on. He tried calling his ex. He completely remembers her phone number except the last digit. So he asked a common friend, that friend just like any other was of not much help. However he gave Biswajit two integers ‘a’ and ‘b’ and told that the last digit of her number is the same as the last digit of ‘a’ multiplied with itself ‘b’ times. So Biswajit just needs to find that and he is asking your help. \na (0 \u003c\u003d a \u003c\u003d 20) and the index b (0 \u003c\u003d b \u003c\u003d 2,147,483,000), a and b both are not 0.\n"}},{"title":"Input:","value":{"format":"PLAIN","content":"The first line of input contains an integer t, the number of test cases (t \u003c\u003d 30). t test cases follow. For each test case will appear a and b separated by space."}},{"title":"Output:","value":{"format":"PLAIN","content":"For each test case output an integer per line representing the result.\n"}},{"title":"Example:","value":{"format":"PLAIN","content":"Input:\n2\n3 10\n6 2\n\nOutput:\n9\n6"}}]}