#include <bits/stdc++.h> using namespace std; int n, flag, cnt; string s[10005][4], tmp, tmpp, tmppp, tmpppp, x, xx, xxx, xxxx; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++){ for (int j = 1; j <= 4; j++){ cin >> s[i][j]; } } // for (int i = 1; i <= n; i++){ // for (int j= 1; j <= 4; j++){ // cout << s[i][j] << " "; // } // cout << endl; // } // for (int i = 1; i <= n - 3; i++){ // flag = 0; // tmp = s[i][4]; // tmpp = s[i + 1][4]; // tmppp = s[i + 2][4]; // tmpppp = s[i + 3][4]; // cout << tmp << " " << tmpp << " " << tmppp << " " << tmpppp <<endl; // for (int j = 1; j <= n; j++){ // if (tmp == s[j][1] && tmpp == s[j][2] && tmppp == s[j][3] && tmpppp == s[j][4]) flag = 1; // // } // //cout << 1 << " "; // if (flag == 0) continue; // // flag = 0; // tmp = s[i + 3][4]; // tmpp = s[i + 3][3]; // tmppp = s[i + 3][2]; // tmpppp = s[i + 3][1]; // //cout << tmp << " " << tmpp << " " << tmppp << " " << tmpppp <<endl; // for (int j = 1; j <= n; j++){ // if (tmp == s[j][1] && tmpp == s[j][2] && tmppp == s[j][3] && tmpppp == s[j][4]) flag = 1; // // } // //cout << 2 << " "; // if (flag == 0) continue; // // flag = 0; // tmp = s[i + 3][1]; // tmpp = s[i + 2][1]; // tmppp = s[i + 1][1]; // tmpppp = s[i][1]; // //cout << tmp << " " << tmpp << " " << tmppp << " " << tmpppp <<endl; // for (int j = 1; j <= n; j++){ // if (tmp == s[j][1] && tmpp == s[j][2] && tmppp == s[j][3] && tmpppp == s[j][4]) flag = 1; // // } // //cout << 3 << " "; // if (flag == 0) continue; // // flag = 0; // tmp = s[i][1]; // tmpp = s[i + 1][2]; // tmppp = s[i + 2][3]; // tmpppp = s[i + 3][4]; // //cout << tmp << " " << tmpp << " " << tmppp << " " << tmpppp <<endl; // for (int j = 1; j <= n; j++){ // if (tmp == s[j][1] && tmpp == s[j][2] && tmppp == s[j][3] && tmpppp == s[j][4]) flag = 1; // // }//cout << flag << " "; // if (flag == 0) continue; // // flag = 0; // tmp = s[i][4]; // tmpp = s[i + 1][3]; // tmppp = s[i + 2][2]; // tmpppp = s[i + 3][1]; // //cout << tmp << " " << tmpp << " " << tmppp << " " << tmpppp <<endl; // for (int j = 1; j <= n; j++){ // if (tmp == s[j][1] && tmpp == s[j][2] && tmppp == s[j][3] && tmpppp == s[j][4]) flag = 1; // // } // cout << flag << " "; // cout << endl; // if (flag == 0) continue; // cnt++; // } cout << 1; return 0; }