#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
LL nei[2000][32];
class SmilesTheFriendshipUnicorn { public:
string hasFriendshipChain(int N, vector <int> A, vector <int> B)
{
return solve(N, A, B) ? "Yay!" : ":(";
}
bool solve(int N, const vector<int>& A, const vector<int>& B)
{
vector<vector<int>> G(N);
for(int i=0; i<A.size(); ++i) {
G[A[i]].push_back(B[i]);
G[B[i]].push_back(A[i]);
}
memset(&nei, 0, sizeof(nei));
for(int i=0; i<A.size(); ++i) {
for(int u: G[A[i]])
nei[i][u>>6] |= 1LL<<(u&0x3f);
for(int u: G[B[i]])
nei[i][u>>6] |= 1LL<<(u&0x3f);
nei[i][A[i]>>6] &= ~(1LL<<(A[i]&0x3f));
nei[i][B[i]>>6] &= ~(1LL<<(B[i]&0x3f));
}
for(int i=0; i<A.size(); ++i)
for(int k=i+1; k<A.size(); ++k)
if(A[i]!=A[k] && A[i]!=B[k] && B[i]!=A[k] && B[i]!=B[k])
for(int v=0; v<32; ++v)
if(nei[i][v] & nei[k][v])
return true;
return false;
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
bool ok = (Expected == Received);
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, SmilesTheFriendshipUnicorn().hasFriendshipChain(N, A, B));}
int main(){
CASE(0)
int N = 5;
int A_[] = {0, 1, 2, 3};
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {1, 2, 3, 4};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = "Yay!";
END
CASE(1)
int N = 5;
int A_[] = {0, 1, 2, 3, 1};
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {1, 2, 3, 0, 4};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = "Yay!";
END
CASE(2)
int N = 6;
int A_[] = {0, 0, 0, 0, 0};
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {1, 2, 3, 4, 5};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = ":(";
END
CASE(3)
int N = 8;
int A_[] = {1, 3, 4, 3, 4, 3, 0, 2};
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {7, 7, 7, 4, 6, 5, 4, 7};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = "Yay!";
END
CASE(4)
int N = 7;
int A_[] = {0, 1, 1, 5, 4, 5};
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {5, 2, 3, 6, 1, 1};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = ":(";
END
CASE(5)
int N = 42;
int A_[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41}
;
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 0};
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = "Yay!";
END
/*
CASE(6)
int N = ;
int A_[] = ;
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = ;
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = ;
END
CASE(7)
int N = ;
int A_[] = ;
vector <int> A(A_, A_+sizeof(A_)/sizeof(*A_));
int B_[] = ;
vector <int> B(B_, B_+sizeof(B_)/sizeof(*B_));
string _ = ;
END
*/
}
// END CUT HERE