#include <iostream>
using namespace std;
int main()
{
    int T;
    cin >> T;
    int N, M;
    for (int i = 0; i < T; i++)
    {
        cin >> N >> M;
        if (M != N)
        {
            cout << -1 << endl;
        }
    }
    return 0;
}