#include using namespace std; // #include // using namespace atcoder; // #include // using bint = boost::multiprecision::cpp_int; random_device seed_gen; mt19937_64 rnd(seed_gen()); template bool chmax(T& A, T B) { if (A < B) { A = B; return true; } return false; } template bool chmin(T& A, T B) { if (A > B) { A = B; return true; } return false; } #define rep(i, m, n) for (int i = (m); i < (n); i++) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() using ll = long long; using pint = pair; template using min_heap = priority_queue, greater>; #define PI 3.14159265358979323846264338327950288419716939937510 void bns(ll x, int p = 60) { for (int i = p - 1; i >= 0; i--) { cerr << (x >> i & 1LL); } cerr << endl; } int n, t; vector> a; vector di = {-1, 1, 0, 0}; vector dj = {0, 0, -1, 1}; string chars = "UDLR"; string ops = ""; void input() { cin >> n >> t; a.assign(n, vector(n)); rep (i, 0, n) rep (j, 0, n) cin >> a[i][j]; } void init_ans() { int i = 0, j = 0; int s = 0; rep (ti, 0, t) { if (ops.size() > t - 4) break; vector d = {0, 1, 2, 3}; shuffle(all(d), rnd); rep (k, 0, 4) { int ni = i + di[d[k]], nj = j + dj[d[k]]; if (ni >= 0 && ni < n && nj >= 0 && nj < n) { ops += chars[d[k]]; i = ni, j = nj; uniform_int_distribution dist_f(0, 1); if (dist_f(rnd)) { ops += "C"; s ^= a[i][j]; } if ((a[i][j] ^ s) > a[i][j]) { ops += "W"; a[i][j] ^= s; } if (dist_f(rnd)) { ops += "C"; s ^= a[i][j]; } break; } } } } void output() { rep (ti, 0, ops.size()) cout << ops[ti] << endl; } void solve() { input(); init_ans(); output(); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(10); solve(); return 0; }