#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, a[101], b[101];
cin >> n;
for(int i = 1; i <= n; ++i)
cin >> a[i] >> b[i];
for(int i = 1; i <= n; ++i) {
int p = (int)log2(b[i]);
if(a[i] <= 1 << p)
cout << "Exista: 2 ^ " << p << " = " << (1 << p) << "\n";
else
cout << "Nu exista \n";
}
}