#include<bits/stdc++.h>
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        ll cnt =0 ;
        while(n % 2 == 0){
            n /= 2;
            cnt++;
        }
        if(cnt == 1){
            cout << "Same\n";
        }
        else if(cnt == 0){
            cout << "Odd\n";
        }
        else{
            cout << "Even\n";   
        }
    }
    return 0;
}
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
//#define MOD 998244353
#define EPS 0.000000001
using namespace std;




ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

//中国剰余定理(vec_val: 合同式の右辺集合 vec_m:合同式のmodの集合)
//https://qiita.com/drken/items/ae02240cd1f8edfc86fd
pair<ll,ll> ChineseRem(const vector<ll>&vec_val,const vector<ll>&vec_m){

	if(vec_val.empty()||vec_m.empty())return make_pair(0,1);

	ll VAL = vec_val[0];
	ll M = vec_m[0];

	ll x,y,val,m;

	for (int i = 1; i < (int)vec_val.size(); i++) {

		val = vec_val[i], m = vec_m[i];

		if (M < m){
			swap(M, m);
			swap(VAL,val);
		}

		//Mx + my = gcd(M,m)(→d)
		ll d = extgcd(M,m,x,y); //d: Mとmのgcd

		/*
		 * 解の存在条件
		 * VAL≡val(mod d[=gcd(M,m)])より、
		 * val-VAL≡0 (mod d)
		 *
		 *
		 * */
		if ((val-VAL)%d != 0){ //解の存在条件を満たさないので不適

			return make_pair(0, -1);
		}

		ll md = m/d; //d = gcd(M,m)なので、mはdで割れる
		ll tmp = ((val- VAL)/d) % md * x % md;

		VAL += M*tmp;
		M *= md; //法→lcm(m1,m2,m3...)[前の法Mと今回の法mをかけてからgcd(M,m)で割るのと同じ→lcm演算と同じ]
	}

	VAL %= M;
	if (VAL < 0){
		VAL += M;
	}
	return make_pair(VAL, M);
}

void func(){

	ll X,Y,P,Q;
	scanf("%lld %lld %lld %lld",&X,&Y,&P,&Q);

	ll ans = HUGE_NUM;

	for(ll a = X; a < X+Y; a++){
		for(ll b = P; b < P+Q; b++){

			pair<ll,ll> tmp_p = ChineseRem({a,b},{2*(X+Y),(P+Q)});
			if(tmp_p.second == -1)continue;

			ans = min(ans,tmp_p.first);

		}
	}

	if(ans == HUGE_NUM){

		printf("infinity\n");
	}else{

		printf("%lld\n",ans);
	}
}

int main(){

	int num_case;
	scanf("%d",&num_case);

	for(int i = 0; i < num_case; i++){

		func();
	}

	return 0;
}
