func_code_string: #include <bits/stdc++.h>   using namespace std;   int ar[2111111], br[2111111], cr[2111111], dr[2111111];   int main() {     cin.sync_with_stdio(false);     int n, i, j, x, y, pos, m;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> ar[i];       if (ar[i] == 0) pos = i;     }     for (i = n + 1; i < n + n; i++) ar[i] = ar[i - n];     for (j = 1, i = pos + 1; i <= pos + n - 1; i++, j++) cr[j] = ar[i];     m = j - 1;     for (i = m + 1; i <= m + m; i++) cr[i] = cr[i - m];     for (i = 1; i <= n; i++) {       cin >> br[i];       if (br[i] == 0) pos = i;     }     for (i = n + 1; i < n + n; i++) br[i] = br[i - n];     for (j = 1, i = pos + 1; i <= pos + n - 1; i++, j++) dr[j] = br[i];     for (i = 1; i <= m + m; i++)       if (cr[i] == dr[1]) {         pos = i;         break;       }     bool cond = true;     for (j = 1, i = pos; i <= pos + m - 1 && cond; i++, j++)       if (cr[i] != dr[j]) cond = false;     if (cond)       puts( YES );     else       puts( NO );     return 0;   }   