#include <fstream>
#include <iostream>
using namespace std;
void harom(int A, int B){
cout << "11 " << min(10, B) << "\n";
B = B - min(10, B);
cout << "11 " << min(10, B) << "\n";
B = B - min(10, B);
cout << "11 " << min(10, B) << "\n";
B = B - min(10, B);
}
int main() {
int T;
cin >> T;
while (T--) {
int A, B;
cin >> A >> B;
if(A == 33 and B <= 30) harom(A, B); ///3 jatszma
else if(A >= 33 and A <= 43 and B >= 11 and B <= 41){
cout << min(A - 33, 10) << " 11\n";
A = 33; B = B - 11;
harom(A, B);
}
else if(A >= 33 and A <= 53 and B >= 22 and B >= 52){
cout << min(A - 33, 10) << " 11\n";
A = A - min(A - 33, 10); B = B - 11;
cout << min(A - 33, 10) << " 11\n";
A = 33; B = B - 11;
harom(A, B);
}
else cout << "-1 -1\n";
}
return 0;
}