pat乙级1091
#include <iostream>
using namespace std;
bool isn(int k, int n)
{
while (n)
{
if (k % 10 != n % 10)
{
return false;
}
else
{
k /= 10;
n /= 10;
}
}
return true;
}
int main()
{
int m;
cin >> m;
while (m--)
{
int n, k, flag = 0;
cin >> n;
for (int i = 1; i < 10; i++)
{
k = n*n*i;
if (isn(k,n))
{
cout << i << " " << k << endl;
flag = 1;
break;
}
}
if (flag == 0)
cout << "No" << endl;
}
return 0;
}