#include<iostream>
using namespace std;constint N =105;int n, maxx, a[N], b[N], g[N];intf(int pos){int cnt =0;for(int i =1; i <= n; i ++){if(pos == a[i]) pos = b[i];elseif(pos == b[i]) pos = a[i];if(pos == g[i]) cnt ++;}return cnt;}intmain(){
cin >> n;for(int i =1; i <= n; i ++) cin >> a[i]>> b[i]>> g[i];for(int i =1; i <=3; i ++){//假设开始的位置是 i
maxx =max(maxx,f(i));}
cout << maxx;return0;}
T2 Sleepy Cow Sorting
#include<iostream>
using namespace std;int n, a[105];intmain(){
cin >> n;for(int i =1; i <= n; i ++) cin >> a[i];int ans =0;for(int i = n-1; i >=1; i --){if(a[i]> a[i+1]){
ans = i;break;}}
cout << ans;return0;}
T3 Guess the Animal
#include<iostream>
using namespace std;constint N =105;int n, k, cnt[N];
string a[N][N], s;intf(int x,int y){int res =0;for(int i =1; i <= cnt[x]; i ++){for(int j =1; j <= cnt[y]; j ++){if(a[x][i]== a[y][j]) res ++;}}return res;}intmain(){
cin >> n;for(int i =1; i <= n; i ++){
cin >> s >> cnt[i];for(int j =1; j <= cnt[i]; j ++){
cin >> a[i][j];}}int maxx =0;for(int i =1; i <= n; i ++){for(int j = i +1; j <= n; j ++){
maxx =max(maxx,f(i, j));}}
cout << maxx +1;return0;}