func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, xa, ya;   int i, j, viz[501][501], light[501][501], d[501][501];   string ans;   void paint(int x, int y) {     viz[x][y] = 1;     if (light[x][y] == 0) light[x][y] = 1, ans +=  1 ;     int up, down, right, left;     up = down = right = left = 0;     for (j = 1; j < y; j++)       if (light[x][j]) left = 1;     for (j = y + 1; j <= n; j++)       if (light[x][j]) right = 1;     for (i = 1; i < x; i++)       if (light[i][y]) up = 1;     for (i = x + 1; i <= n; i++)       if (light[i][y]) down = 1;     if (up && !viz[x - 1][y]) ans +=  U , paint(x - 1, y), ans +=  D ;     if (down && !viz[x + 1][y]) ans +=  D , paint(x + 1, y), ans +=  U ;     if (left && !viz[x][y - 1]) ans +=  L , paint(x, y - 1), ans +=  R ;     if (right && !viz[x][y + 1]) ans +=  R , paint(x, y + 1), ans +=  L ;   };   void bfs() {     queue<pair<int, int> > q;     q.push(make_pair(xa, ya));     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++) viz[i][j] = 0, d[i][j] = -1;     d[xa][ya] = 0;     while (!q.empty()) {       pair<int, int> k = q.front();       q.pop();       if (light[k.first + 1][k.second] && d[k.first + 1][k.second] == -1) {         d[k.first + 1][k.second] = d[k.first][k.second] + 1;         q.push(make_pair(k.first + 1, k.second));       };       if (light[k.first - 1][k.second] && d[k.first - 1][k.second] == -1) {         d[k.first - 1][k.second] = d[k.first][k.second] + 1;         q.push(make_pair(k.first - 1, k.second));       };       if (light[k.first][k.second + 1] && d[k.first][k.second + 1] == -1) {         d[k.first][k.second + 1] = d[k.first][k.second] + 1;         q.push(make_pair(k.first, k.second + 1));       };       if (light[k.first][k.second - 1] && d[k.first][k.second - 1] == -1) {         d[k.first][k.second - 1] = d[k.first][k.second] + 1;         q.push(make_pair(k.first, k.second - 1));       };     };   };   void repaint(int x, int y) {     viz[x][y] = 1;     if (light[x - 1][y] && !viz[x - 1][y] && d[x - 1][y] > d[x][y])       ans +=  U , repaint(x - 1, y), ans +=  D ;     if (light[x + 1][y] && !viz[x + 1][y] && d[x + 1][y] > d[x][y])       ans +=  D , repaint(x + 1, y), ans +=  U ;     if (light[x][y - 1] && !viz[x][y - 1] && d[x][y - 1] > d[x][y])       ans +=  L , repaint(x, y - 1), ans +=  R ;     if (light[x][y + 1] && !viz[x][y + 1] && d[x][y + 1] > d[x][y])       ans +=  R , repaint(x, y + 1), ans +=  L ;     if (light[x][y] == 1) light[x][y] = 0, ans +=  2 ;   };   int main() {     cin >> n >> xa >> ya;     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++) cin >> light[i][j];     paint(xa, ya);     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++)         if (viz[i][j] == 0 && light[i][j] == 1) {           cout <<  NO ;           return 0;         };     cout <<  YES  << endl;     bfs();     repaint(xa, ya);     cout << ans;     return 0;   }   