func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[505][505];   int b[505][505];   priority_queue<int> aq[1005];   priority_queue<int> bq[1005];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         scanf( %d , &a[i][j]);         aq[i + j].push(a[i][j]);       }     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         scanf( %d , &b[i][j]);         bq[i + j].push(b[i][j]);       }     for (int i = 0; i <= n + m; i++) {       while (!aq[i].empty() && !bq[i].empty()) {         int nowa = aq[i].top();         int nowb = bq[i].top();         if (nowa != nowb) {           printf( NO n );           return 0;         }         aq[i].pop();         bq[i].pop();       }     }     printf( YES n );     return 0;   }   