#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void rd(T &x) {     x = 0;     char c = getchar();     int f = 1;     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) x = x * 10 -  0  + c, c = getchar();     x *= f;   }   int curtest;   void FAIL() {     printf( NO );     exit(0);   }   long long Abs(long long x) { return x > 0 ? x : -x; }   long double eps = 1e-20;   int dcmp(long double x) { return x > -eps ? (x > eps) : -1; }   const int N = 2e6 + 10;   vector<int> pos;   struct node {     long long t, x, y;   } v[N];   long long val[N], ti[N];   int vis[N];   int m, n;   long double lb, rb;   vector<char> S;   void modify(int p, long long x, long long delt) {     if (Abs((delt * m + p) % 2) ^ Abs(x % 2)) FAIL();     if (delt == 0) return;     long long l = -p - x, r = p - x;     long double dt = -delt;     if (dt > 0)       lb = max(lb, l / dt), rb = min(rb, r / dt);     else       lb = max(lb, r / dt), rb = min(rb, l / dt);   }   void sol(vector<int> &ans) {     lb = -m, rb = m;     for (int i = 0; i + 1 < pos.size(); ++i) {       if (i + 2 == pos.size())         modify(m - pos[i], -val[pos[i]], -ti[pos[i]] - 1);       else         modify(pos[i + 1] - pos[i], val[pos[i + 1]] - val[pos[i]],                ti[pos[i + 1]] - ti[pos[i]]);       if (ti[pos[i]] == 0) {         lb = max(lb, (long double)val[pos[i]] - (m - pos[i]));         rb = min(rb, (long double)val[pos[i]] + (m - pos[i]));       }     }     long long dx = floor(rb);     if (Abs(dx % 2) ^ (m % 2)) dx--;     if (dcmp(dx - lb) < 0) FAIL();     for (int i = 0; i + 1 < pos.size(); ++i) {       int l = pos[i], r = pos[i + 1], len = r - l;       long long x = (r == m ? dx : val[r]) - val[l] - (ti[r] - ti[l]) * dx;       int d = x > 0 ? 1 : -1;       x = Abs(x);       len -= x;       while (x) x--, ans.push_back(d);       if (len < 0 || (len & 1)) FAIL();       while (len) ans.push_back(1), ans.push_back(-1), len -= 2;     }   }   long long dx, dy;   void solve(int l, int r, long long x, long long y, long long t) {     x -= t * dx, y -= t * dy;     char xx = x > 0 ?  R  :  L ;     char yy = y > 0 ?  U  :  D ;     x = Abs(x), y = Abs(y);     while (x--) S.push_back(xx), r--;     while (y--) S.push_back(yy), r--;     if (((r - l) & 1) || r - l < 0) FAIL();     while (r - l) S.push_back( U ), S.push_back( D ), r -= 2;   }   vector<int> ax, ay;   int main() {     rd(n), rd(m);     int flg = 0;     vis[0] = 1, v[0].x = v[0].y = v[0].t = 0;     for (int i = 1; i <= n; ++i) {       node A;       rd(A.t), rd(A.x), rd(A.y);       int p = A.t % m;       A.t /= m;       if (vis[p]) {         if (A.t == v[p].t) {           if (A.x != v[p].x || A.y != v[p].y) FAIL();           continue;         }         long long dt = A.t - v[p].t;         if (flg) {           if (v[p].x + dt * dx == A.x && v[p].y + dt * dy == A.y)             continue;           else             FAIL();         }         dx = A.x - v[p].x, dy = A.y - v[p].y;         if (dx % dt || dy % dt) FAIL();         dx /= dt, dy /= dt;         flg = 1;       } else         v[p] = A, vis[p] = 1;     }     if (flg) {       int p1 = 0, p2;       while (true) {         p2 = p1 + 1;         while (!vis[p2] && p2 < m) p2++;         if (p2 >= m) break;         solve(p1, p2, v[p2].x - v[p1].x, v[p2].y - v[p1].y, v[p2].t - v[p1].t);         p1 = p2;       }       solve(p1, m, dx - v[p1].x, dy - v[p1].y, -v[p1].t);       for (int i = 0; i < S.size(); ++i) putchar(S[i]);     } else {       for (int i = 0; i < m; ++i)         if (vis[i]) ti[i] = v[i].t, pos.push_back(i);       pos.push_back(m), ti[m] = 0;       for (int i = 0; i < m; ++i)         if (vis[i]) val[i] = v[i].x + v[i].y;       sol(ax);       for (int i = 0; i < m; ++i)         if (vis[i]) val[i] = v[i].x - v[i].y;       sol(ay);       for (int i = 0; i < m; ++i) {         if (ax[i] == ay[i])           putchar(ax[i] > 0 ?  R  :  L );         else           putchar(ax[i] > 0 ?  U  :  D );       }     }     return 0;   }