#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ int N; cin >> N; bool yes = true; while(N--){ int a,b,c,d,e; cin >> a >> b >> c >> d >> e; if(a == c && b == d && d == e && a != b) continue; yes = false; } cout << (yes?"Yes\n":"No\n"); } }