#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll convert(string s)
{
ll l = s.size();
reverse(s.begin(), s.end());
ll i = 0, sum = 0, b = 1;
while(i<l)
{
ll a = s[i] - '0';
sum = sum + (a*b);
b = b*2;
i++;
}
return sum;
}
ll gcd(ll x, ll y)
{
if(y == 0)
return x;
else
return gcd(y, x%y);
}
int main()
{
ll n, i;
string s1, s2;
while(cin >> n)
{
for(i=1;i<=n;i++)
{
cin >> s1 >> s2;
ll a = convert(s1);
ll b = convert(s2);
if(a<b)
swap(a, b);
ll r = gcd(a, b);
if(r > 1)
cout << "Pair #" << i << ": " << "All you need is love!" << endl;
else
cout << "Pair #" << i << ": " << "Love is not all you need!" << endl;
}
}
return 0;
}
Comments
Post a Comment