func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int A[n][m], B[n][m], C[n][m];     vector<int> a, b;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> A[i][j];         a.push_back(A[i][j]);       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> B[i][j];         b.push_back(B[i][j]);       }     }     sort(a.begin(), a.end());     sort(b.begin(), b.end());     for (int i = 0; i < a.size(); i++) {       if (a[i] != b[i]) {         cout <<  NO  << endl;         return 0;       }     }     if (n >= m) {       for (int i = 0; i < n; i++) {         long long x = 0;         for (int j = 0; j < min(i + 1, m); j++) {           x ^= (long long)(A[i - j][j] ^ B[i - j][j]);         }         if (x) {           cout <<  NO  << endl;           return 0;         }       }       for (int i = 0; i < m - 1; i++) {         long long x = 0;         for (int j = 1; j + i < m; j++) {           x ^= (long long)(A[n - j][j + i] ^ B[n - j][j + i]);         }         if (x) {           cout <<  NO  << endl;           return 0;         }       }     } else {       for (int i = 0; i < m; i++) {         long long x = 0;         for (int j = 0; j < min(i + 1, n); j++) {           x ^= (long long)(A[j][i - j] ^ B[j][i - j]);         }         if (x) {           cout <<  NO  << endl;           return 0;         }       }       for (int i = 0; i < n - 1; i++) {         long long x = 0;         for (int j = 1; j + i < n; j++) {           x ^= (long long)(A[j + i][m - j] ^ B[j + i][m - j]);         }         if (x) {           cout <<  NO  << endl;           return 0;         }       }     }     cout <<  YES  << endl;   }   