{"trustable":false,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\n Given a positive integer N, you should output the most right digit of N^N.\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.\u003cbr\u003e Each test case contains a single positive integer N(1\u0026lt;\u003dN\u0026lt;\u003d1,000,000,000).\u003cbr\u003e \u0026nbsp;\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e For each test case, you should output the rightmost digit of N^N.\u003cbr\u003e \u0026nbsp;\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n2\r\n3\r\n4\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n7\r\n6\r\n\r\n\r\n \r\n \u003ci\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003c/pre\u003e \n\u003cdiv\u003e \n \u003cpre\u003e\r\n\t\u003c/pre\u003e \n \u003cdiv\u003e \n \u003cpre\u003e\r\n\t\t\u003c/pre\u003e \n \u003c/div\u003e In the first case, 3 * 3 * 3 \u003d 27, so the rightmost digit is 7. In the second case, 4 * 4 * 4 * 4 \u003d 256, so the rightmost digit is 6.\n\u003c/div\u003e"}}]}