I don’t know why I am getting wrong answer…

#include using namespace std; int main() { int a[7], a1[7], h = 0; int t, n; cin >> t; for(int i = 0; i < t; i++) { for(int m = 0; m < 7; m++) { a[m] = 0; a1[m] = 0; } cin >> n; int b[n]; for(int j = 0; j < n; j++) cin >> b[j]; if(b[0] == 1) { a[0]++; for(int j = 0; j < n-1; j++) { if(b[j+1] == b[j]+1 || b[j+1] == b[j]) a[b[j+1]-1]++; else { if(b[j] != 7) { h = 1; break; } int z = 0; for(int k = 0; k < 7; k++) { if(a[k] == 0) { z = 1; break; } } if(z == 1) { h = 1; break; } z = 0; if(b[j+1] == 6) { a1[5]++; for(int k = j+1; k < n-1; k++) { if(b[k+1] == b[k]-1 || b[k+1] == b[k]) { a1[b[k+1]-1]++; } else if(b[k+1] > b[k]) { z = 1; break; } } } else { h = 1; break; } if(z == 1) { h = 1; break; } z = 0; for(int k = 0; k < 6; k++) { if(a[k] != a1[k]) { z = 1; break; } } //if(a[6] % 2 == 0) //z = 1; if(z == 1) h = 1; break; } }} else h = 1; if(h == 0) cout << "yes\n"; else cout << "no\n"; h = 0; } return 0; }