#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for(int o = 0; o < t; o++) {
int a, b;
cin >> a >> b;
if(a < 33 || b > 52) {
cout << "-1 -1" << endl;
continue;
}
vector<pair<int, int>> eredmeny;
int szam = 0;
while(b > 30 || a > 33) {
int ertek1 = min(10, a - 33);
int ertek2 = 11;
eredmeny.push_back(pair<int, int>(ertek1, ertek2));
a -= ertek1;
b -= ertek2;
szam++;
}
if(szam > 2) {
cout << "-1 -1" << endl;
continue;
}
for(int i = 0; i < 3; i++) {
int ertek2 = min(10, b);
int ertek1 = 11;
eredmeny.push_back(pair<int, int>(ertek1, ertek2));
a -= ertek1;
b -= ertek2;
}
for(pair<int, int> i : eredmeny) {
cout << i.first << " " << i.second << endl;
}
}
return 0;
}