#include #include using namespace std; int main() { ifstream in; ofstream out; in.open("matches.in"); out.open("matches.out"); int n,temp; in >> n; int **mas; mas = new int*[n]; for(int i = 0;i < n;i++) mas[i] = new int[12]; for(int i = 0;i < n;i++) { for(int j = 0;j < 12;j++) { in >> mas[i][j]; } } int* res = new int[n]; for(int i = 0;i < n;i++) res[i] = 0; int count = 1; for(int i = 0;i < n;i++) { for(int j = 0;j < 12-1;j++) { if(mas[i][j] == mas[i][j+1]) count++; if(count == 4) { res[i]++; count = 1; } } count = 1; } for(int i = 0;i < n;i++) { if(res[i] == 3) out<<"yes\n"; else out<<"no\n"; } return 0; }