#include <iostream>
#include <vector>
using namespace std;

int main(){
	
	int t;
	cin >> t;
	
	vector<int> n(t);
	vector<int> m(t);
	
	for(int p = 0; p < t; p++){
		cin >> n[p];
		cin >> m[p];
	}
	
	bool found = false;
	
	for(int p = 0; p < t; p++){
		
		if(n[p] != m[p]){
			cout << "-1" << endl;
		}
		
	}
	
	
	
	
	return 0;
}