#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    assert(t <= 10);
    while(t--) {
        long long int x, y;
        cin >> x >> y;
        bool found = 0;
        for(long long int i = 1; i*i <= y; i++) {
            if(y%i == 0) {
                if(y/i < x/2 || i > (x + 1)/2) {
                    cout << x/2 << " " << (x + 1)/2 << "\n";
                    cout << i << " " << y/i << "\n";
                    found = 1;
                    break;
                }
            }
        }
        if(!found) cout << "-1\n";
    }
}