Help! A robot escaped our lab and we need help finding it. The lab is at the point (0, 0) of the coordinate plane, at time 0 the robot was there. The robot's movements are defined by a program — a string of length l, consisting of characters U, L, D, R. Each second the robot executes the next command in his program: if the current coordinates of the robot are (x, y), then commands U, L, D, R move it to cells (x, y + 1), (x - 1, y), (x, y - 1), (x + 1, y) respectively. The execution of the program started at time 0. The program is looped, i.e. each l seconds of executing the program start again from the first character. Unfortunately, we don't know what program was loaded into the robot when he left the lab.Our radars managed to find out the position of the robot at n moments of time: we know that at the moment of time ti the robot is at the point (xi, yi). Given this data, either help to determine what program could be loaded into the robot, or determine that no possible program meets the data and the robot must have broken down.

The first line of the input contains two space-separated integers n and l (1 ≤ n ≤ 2·105, 1 ≤ l ≤ 2·106). Next n lines contain three space-separated integers — ti, xi, yi (1 ≤ ti ≤ 1018,  - 1018 ≤ xi, yi ≤ 1018). The radar data is given chronologically, i.e. ti < ti + 1 for all i from 1 to n - 1.

Print any of the possible programs that meet the data. If no program meets the data, print a single word 'NO' (without the quotes).

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
inline long long readl()
{
	long long ret=0;
	int f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
const int N=2000005;
int n,l[N],r[N],len;
long long t,x,y,nx,ny;
struct node
{
	long long ty,tz,x;
	node(){} node(long long A,long long B,long long C){ty=A;tz=B;x=C;}
}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
long long ceil(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
    if(x==0)
		return 0;
    if(y>0)
		return (x-1)/y+1;
    else
		return x/y;
}
long long floor(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
	if(x==0)
		return 0;
    if(y>0)
		return x/y;
    else
		return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
    sort(a+1,a+n+1);
    long long L=0,R=len;
    a[n+1]=node(len,-1,0);//设置边界!!!
    for(register int i=0;i<=n;i++)//要统计入最后一个限制S[len]=0-S*(-1)
    {
        long long d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
        if(p>0)
        {
            L=max(L,ceil(-q,p));
            R=min(R,floor(d-q,p));
        }
		else if(p<0)
		{
            L=max(L,ceil(d-q,p));
            R=min(R,floor(-q,p));
        }
        if(L>R||p==0&&(q<0||q>d))
		{
			puts("NO");
			exit(0);
		}
    }
    long long s=L,si=0;
    for(register int i=0,j=1;i<=n;i++)
    {
        si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
        while(si--)
			ans[j++]=1;
        j=a[i+1].ty+1;//a[i+1]而不是a[i]
    }
}
int main()
{
    n=read();
	len=read();
    for(register int i=1;i<=n;i++)
    {
		t=readl();
		x=readl();
		y=readl();
        nx=x+y+t;
		ny=x-y+t;
        if(nx&1)
		{
			puts("NO");
			return 0;
		}
        nx/=2;
		ny/=2;
        a[i]=node(t%len,t/len,nx);
        b[i]=node(t%len,t/len,ny);
    }
    solve(a,l);
    solve(b,r);
    for(register int i=1;i<=len;i++)
		printf("%c","LDUR"[l[i]<<1|r[i]]);
    return 0;
}

#include<bits/stdc++.h>
#define re register
using namespace std;
int n,l;
struct lim{long long t,x,y;}c[200100];
inline bool cmp(const lim&A,const lim&B){return A.t%l<B.t%l;}
long long xpy1,xpy2,xmy1,xmy2;
void nw(re long long px,re long long py,re long long pt)
{
	if(px==0){if(pt<0)puts("NO"),exit(0);return;}
	if(px<0)//>=
	{
		px=-px,py=-py,pt=-pt;pt=ceil((long double)pt/px);py/=px;px/=px;
		if(py<0)xmy1=max(xmy1,pt);
		else xpy1=max(xpy1,pt);
	}
	else//<=
	{
		pt=floor((long double)pt/px);py/=px;px/=px;
		if(py<0)xmy2=min(xmy2,pt);
		else xpy2=min(xpy2,pt);
	}
}
void rnw(re int a,re int b)
{
	re long long tt=c[b].t%l-c[a].t%l,ta=c[a].t/l,tb=c[b].t/l;
	nw(-(ta-tb),-(ta-tb),tt-(c[a].x-c[b].x)-(c[a].y-c[b].y));
	nw(+(ta-tb),-(ta-tb),tt+(c[a].x-c[b].x)-(c[a].y-c[b].y));
	nw(-(ta-tb),+(ta-tb),tt-(c[a].x-c[b].x)+(c[a].y-c[b].y));
	nw(+(ta-tb),+(ta-tb),tt+(c[a].x-c[b].x)+(c[a].y-c[b].y));
}
char ss[2000100];
int main()
{
	scanf("%d%d",&n,&l);
	re long long xx,yy,xc,yc,xk=0,yk=0,tt=0;
	for(re int i=1;i<=n;i++)
	{
		scanf("%lld%lld%lld",&c[i].t,&c[i].x,&c[i].y);
		if(c[i].t%2!=abs(c[i].x+c[i].y)%2){puts("NO");return 0;}
	}n++;
	xpy1=-l;xpy2=l;xmy1=-l;xmy2=l;
	sort(c+1,c+n+1,cmp);
	for(re int i=1;i<n;i++)rnw(i,i+1);
	nw((1+c[n].t/l),(1+c[n].t/l),(l-c[n].t%l)+c[n].x+c[n].y);
	nw((1+c[n].t/l),-(1+c[n].t/l),(l-c[n].t%l)+c[n].x-c[n].y);
	nw(-(1+c[n].t/l),(1+c[n].t/l),(l-c[n].t%l)-c[n].x+c[n].y);
	nw(-(1+c[n].t/l),-(1+c[n].t/l),(l-c[n].t%l)-c[n].x-c[n].y);
	if(abs(xpy1)%2!=l%2)xpy1++;if(abs(xmy1)%2!=l%2)xmy1++;if(xpy1>xpy2||xmy1>xmy2){puts("NO");;return 0;}
	xx=(xpy1+xmy1)/2;
	yy=xpy1-xx;
	for(re int i=1;i<=n;i++)
	{
		xc=c[i].x-c[i].t/l*xx;
		yc=c[i].y-c[i].t/l*yy;
		while(tt<c[i].t%l)
		{
			if(xk<xc)ss[++tt]='R',xk++;
			else if(xk>xc)ss[++tt]='L',xk--;
			else if(yk<yc)ss[++tt]='U',yk++;
			else ss[++tt]='D',yk--;
		}
	}
	xc=xx;
	yc=yy;
	while(tt<l)
	{
		if(xk<xc)ss[++tt]='R',xk++;
		else if(xk>xc)ss[++tt]='L',xk--;
		else if(yk<yc)ss[++tt]='U',yk++;
		else ss[++tt]='D',yk--;
	}
	puts(ss+1);
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

typedef long long s64;

const s64 INF = 4000000000000000000ll;

const int MaxN = 200001;
const int MaxL = 2000000;

// getint
inline s64 getint()
{
    char c;
    while (c = getchar(), ('0' > c || c > '9') && c != '-');

    if (c != '-')
    {
        s64 res = c - '0';
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return res;
    }
    else
    {
        s64 res = 0;
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return -res;
    }
}

template <class T>
inline void tension(T &a, const T &b)
{
	if (b < a)
		a = b;
}

int n, l;
s64 pt[MaxN], px[MaxN], py[MaxN];

char res[MaxL + 1];
pair<int, int> b[MaxN];

inline s64 orzmod(s64 a, s64 b)
{
	return (a % b + b) % b;
}

inline s64 orzfloor(s64 a, s64 b)
{
	if (a < 0)
		return -((-a + b - 1) / b);
	return a / b;
}

inline bool check(s64 x, s64 y)
{
	int res_n = 0;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second, u = b[(i + 1) % n].second;
		if (abs((px[u] - (double)(pt[u] / l) * x) - (px[v] - (double)(pt[v] / l) * x)) > 1.5e18)
			return false;
		if (abs((py[u] - (double)(pt[u] / l) * y) - (py[v] - (double)(pt[v] / l) * y)) > 1.5e18)
			return false;
		s64 dx = (px[u] - (pt[u] / l) * x) - (px[v] - (pt[v] / l) * x);
		s64 dy = (py[u] - (pt[u] / l) * y) - (py[v] - (pt[v] / l) * y);
		s64 dt = i + 1 < n ? b[i + 1].first - b[i].first : l - b[i].first;

		if (i + 1 == n)
			dx += x, dy += y;

		if (abs(dx) + abs(dy) > dt)
			return false;
		if ((abs(dx) + abs(dy)) % 2 != dt % 2)
			return false;
		while (dx > 0)
			res[res_n++] = 'R', dx--, dt--;
		while (dx < 0)
			res[res_n++] = 'L', dx++, dt--;
		while (dy > 0)
			res[res_n++] = 'U', dy--, dt--;
		while (dy < 0)
			res[res_n++] = 'D', dy++, dt--;
		while (dt > 0)
			res[res_n++] = 'L', dt--, res[res_n++] = 'R', dt--;
	}
	return true;
}

inline bool handle()
{
	for (int i = 0; i < n; i++)
		if (orzmod(px[i] + py[i], 2) != pt[i] % 2)
			return false;

	for (int i = 0; i < n; i++)
		b[i] = make_pair(pt[i] % l, i);
	sort(b, b + n);

	for (int i = 0; i + 1 < n; i++)
		if (b[i].first == b[i + 1].first)
		{
			int v = b[i].second;
			int u = b[i + 1].second;
			return check((px[v] - px[u]) / ((pt[v] - pt[u]) / l), (py[v] - py[u]) / ((pt[v] - pt[u]) / l));
		}

	s64 sxy = INF, mxy = INF;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second;
		int u = b[(i + 1) % n].second;

		s64 dx = px[u] - px[v];
		s64 dy = py[u] - py[v];
		s64 dk = pt[u] / l - pt[v] / l;
		s64 dt = i + 1 < n ? b[i + 1].first - b[i].first : l - b[i].first;

		if (i + 1 == n)
			dk--;

		if (dk < 0)
		{
			tension(sxy, orzfloor(dt - dx - dy, -dk));
			tension(mxy, orzfloor(dt - dx + dy, -dk));
		}
		else if (dk > 0)
		{
			tension(sxy, orzfloor(dt + dx + dy, dk));
			tension(mxy, orzfloor(dt + dx - dy, dk));
		}
		else
		{
			if (abs(dx) + abs(dy) > dt)
				return false;
		}
	}
	while (abs(sxy) % 2 != l % 2)
		sxy--;
	while (abs(mxy) % 2 != l % 2)
		mxy--;

	s64 vx = (sxy + mxy) / 2, vy = (sxy - mxy) / 2;
	return check(vx, vy);
}

int main()
{
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		pt[i] = getint(), px[i] = getint(), py[i] = getint();
	pt[n] = 0, pt[n] = 0, py[n] = 0;
	n++;

	if (handle())
		puts(res);
	else
		puts("NO");

	return 0;
}

#include<cstdio>
#include<algorithm>
#define L 2000100
#define N 200100
using namespace std;
int l;
struct shot{
	long long x;
	long long y;
	long long t;
	bool operator<(shot rhs)const{return t%l<rhs.t%l;}
}a[N];
inline long long downdiv(long long n,long long d){
	if(n<0&&n%d) return n/d-1;
	else return n/d;
}
inline long long updiv(long long n,long long d){
	if(n%d==0||n<0) return n/d;
	else return n/d+1;
}
char s[L];
int main(){
	int n,i,j,k,d,st,et;
	long long xpy[2],xmy[2];
	long long mx,my,tx,ty,r;
	bool wrong=false;
	scanf("%d%d",&n,&l);
	xpy[1]=xmy[1]=l;
	xpy[0]=xmy[0]=-l;
	for(i=1;i<=n;i++){
		scanf("%I64d%I64d%I64d",&a[i].t,&a[i].x,&a[i].y);
		if((a[i].t+a[i].x+a[i].y)&1) wrong=true;
	}
	sort(a+1,a+n+1);
	for(i=1;i<=n;i++){
		d=a[i].t%l-a[i-1].t%l;
		r=a[i].t/l-a[i-1].t/l;
		mx=a[i].x-a[i-1].x;
		my=a[i].y-a[i-1].y;
		if(r==0){
			if(abs(mx)+abs(my)>d) wrong=true;
		}
		else if(r>0){
			xpy[0]=max(xpy[0],updiv(mx+my-d,r));
			xpy[1]=min(xpy[1],downdiv(mx+my+d,r));
			xmy[0]=max(xmy[0],updiv(mx-my-d,r));
			xmy[1]=min(xmy[1],downdiv(mx-my+d,r));
		}
		else{
			xpy[0]=max(xpy[0],updiv(-mx-my-d,-r));
			xpy[1]=min(xpy[1],downdiv(-mx-my+d,-r));
			xmy[0]=max(xmy[0],updiv(-mx+my-d,-r));
			xmy[1]=min(xmy[1],downdiv(-mx+my+d,-r));
		}
	}
	d=l-a[n].t%l;
	r=a[n].t/l+1;
	mx=a[n].x;
	my=a[n].y;
	if(r==0){
		if(abs(mx)+abs(my)>d) wrong=true;
	}
	else if(r>0){
		xpy[0]=max(xpy[0],updiv(mx+my-d,r));
		xpy[1]=min(xpy[1],downdiv(mx+my+d,r));
		xmy[0]=max(xmy[0],updiv(mx-my-d,r));
		xmy[1]=min(xmy[1],downdiv(mx-my+d,r));
	}
	else{
		xpy[0]=max(xpy[0],updiv(-mx-my-d,-r));
		xpy[1]=min(xpy[1],downdiv(-mx-my+d,-r));
		xmy[0]=max(xmy[0],updiv(-mx+my-d,-r));
		xmy[1]=min(xmy[1],downdiv(-mx+my+d,-r));
	}
	if((xpy[0]+l)&1){
		if(xpy[0]<xpy[1]) xpy[0]++;
		else wrong=true;
	}
	if((xmy[0]+l)&1){
		if(xmy[0]<xmy[1]) xmy[0]++;
		else wrong=true;
	}
	if(wrong||xpy[0]>xpy[1]||xmy[0]>xmy[1]){
		puts("NO");
	}
	else{
		tx=(xmy[0]+xpy[0])/2;
		ty=(xpy[0]-xmy[0])/2;
		for(i=1;i<=n;i++){
			st=a[i-1].t%l;
			et=a[i].t%l;
			mx=(a[i].x-a[i].t/l*tx)-(a[i-1].x-a[i-1].t/l*tx);
			my=(a[i].y-a[i].t/l*ty)-(a[i-1].y-a[i-1].t/l*ty);
			for(j=st;j<et;j++){
				if(mx>0) putchar('R'),mx--;
				else if(mx<0) putchar('L'),mx++;
				else if(my>0) putchar('U'),my--;
				else if(my<0) putchar('D'),my++;
				else{
					putchar('L');
					putchar('R');
					j++;
				}
			}
		}
		st=a[n].t%l;
		et=l;
		mx=tx-(a[n].x-a[n].t/l*tx);
		my=ty-(a[n].y-a[n].t/l*ty);
		for(i=st;i<et;i++){
			if(mx>0) putchar('R'),mx--;
			else if(mx<0) putchar('L'),mx++;
			else if(my>0) putchar('U'),my--;
			else if(my<0) putchar('D'),my++;
			else{
				putchar('L');
				putchar('R');
				i++;
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>

#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const int POL = 2000006, MAX = 2 * POL;

P Presjek(P a, P b)
{
  return P(max(a.X, b.X), min(a.Y, b.Y));
}

P nej[MAX];
int l, n;
ll t[MAX], x[MAX], y[MAX];
P p[MAX];
int nemoze[MAX];

ll NaGore(ll a, ll b)
{
  int st = (a < 0) ^ (b < 0);

  if (!a)
    return 0;
  if (!st)
    return (abs(a) - 1) / abs(b) + 1;
  return -(abs(a) / abs(b));
}

ll NaDolje(ll a, ll b)
{
  int st = (a < 0) ^ (b < 0);

  if (!a)
    return 0;
  if (!st)
    return abs(a) / abs(b);
  return -((abs(a) - 1) / abs(b) + 1);
}

void Ispis(int px)
{
  int ind = px + POL;
  int py, vr=0;

  if (((nej[ind].X + px) & 1) == (l & 1))
    py = nej[ind].X;
  else
    py = nej[ind].X + 1;

  for (int i=0; i<n-1; i++) {
    int deltaT, a, b;
    ll trebx, treby;
    if (i < n-2) {
      deltaT = p[i+1].X - p[i].X;
      a = (int) p[i].Y;
      b = (int) p[i+1].Y;
      trebx = x[b] - x[a] - NaDolje(t[b] - t[a], l) * px;
      treby = y[b] - y[a] - NaDolje(t[b] - t[a], l) * py;
      vr += deltaT;
    }
    else {
      a = (int) p[n-2].Y;
      trebx = NaGore(t[a], l) * px - x[a];
      treby = NaGore(t[a], l) * py - y[a];
      deltaT = l - vr;
    }

    for (int j=0; j<deltaT; j++) {
      if (trebx > 0) {
        printf("R");
        trebx--;
      }
      else if (trebx < 0) {
        printf("L");
        trebx++;
      }
      else if (treby > 0) {
        printf("U");
        treby--;
      }
      else {
        printf("D");
        treby++;
      }
    }
  }

  printf("\n");
}

int main()
{
  scanf("%d%d", &n, &l); n+=2;

  t[0] = x[0] = y[0] = 0;
  p[0] = P(0, 0);
  t[1] = x[1] = y[1] = 0;
  p[1] = P(l, 1);

  for (int i=2; i<n; i++) {
    scanf("%I64d%I64d%I64d", &t[i], &x[i], &y[i]);
//    cin >> t[i] >> x[i] >> y[i];
    p[i] = P(t[i] % l, i);
    if ((t[i] & 1) != ((x[i] + y[i]) & 1)) {
      printf("NO\n");
      return 0;
    }
  }

  if (l == 1) {
    int pr[4] = {1, 0, -1, 0};
    int ps[4] = {0, 1, 0, -1};
    char c[5] = "RULD";

    int da=0;
    for (int i=0; i<4; i++) {
      int ne = 0;
      for (int j=2; j<n; j++)
        if (!(t[j] * pr[i] == x[j] && t[j] * ps[i] == y[j]))
          ne = 1;
      if (!ne) {
        printf("%c\n", c[i]);
        da = 1;
        break;
      }
    }

    if (!da)
      printf("NO\n");

    return 0;
  }

  sort(p, p+n);

  for (int i=0; i<MAX; i++)
    nej[i] = P(-l, l);

  for (int i=0; i<n-1; i++) {
    int a = (int) p[i].Y;
    int b = (int) p[i+1].Y;
    ll deltaT = p[i+1].X - p[i].X;
    ll k = NaDolje(t[b] - t[a], l);

    if (!k) {
      if (abs(x[b] - x[a]) + abs(y[b] - y[a]) > deltaT) {
        printf("NO\n");
        return 0;
      }
      continue;
    }

    int st = 1;
    if (k < 0)
      st = -1;

    ll poc = max((ll) -POL+2, NaGore(x[b] - x[a] - st * deltaT, k));
    ll kraj = min((ll) POL-2 , NaDolje(x[b] - x[a] + st * deltaT, k));

    if (poc > kraj) {
      printf("NO\n");
      return 0;
    }

    nemoze[0]++;
    nemoze[poc+POL]--;
    nemoze[kraj+POL+1]++;

    for (int i=poc; i<=kraj; i++) {
      ll deltaX = (x[b] - x[a] - k * i);
      ll deltaY = deltaT - abs(deltaX);
      P novi = P(NaGore(y[b] - y[a] - st * deltaY, k), NaDolje(y[b] - y[a] + st * deltaY, k));
      nej[i+POL] = Presjek(nej[i+POL], novi);
    }
  }

  for (int i=1; i<MAX; i++)
    nemoze[i] += nemoze[i-1];

  int da = 0;

  for (int i=-l; i<=l; i++) {
    int ind = i + POL;

    if (nej[ind].X <= nej[ind].Y && !nemoze[ind] &&
        (nej[ind].Y - nej[ind].X || ((nej[ind].X + i) & 1) == (l & 1))) {
      da = 1;
      Ispis(i);
      break;
    }
  }

  if (!da)
    printf("NO\n");

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
inline long long readl()
{
	long long ret=0;
	int f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
const int N=2000005;
int n,l[N],r[N],len;
long long t,x,y,nx,ny;
struct node
{
	long long ty,tz,x;
	node(){} node(long long A,long long B,long long C){ty=A;tz=B;x=C;}
}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
long long ceil(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
    if(x==0)
		return 0;
    if(y>0)
		return (x-1)/y+1;
    else
		return x/y;
}
long long floor(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
	if(x==0)
		return 0;
    if(y>0)
		return x/y;
    else
		return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
    sort(a+1,a+n+1);
    long long L=0,R=len;
    a[n+1]=node(len,-1,0);//设置边界!!!
    for(register int i=0;i<=n;i++)//要统计入最后一个限制S[len]=0-S*(-1)
    {
        long long d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
        if(p>0)
        {
            L=max(L,ceil(-q,p));
            R=min(R,floor(d-q,p));
        }
		else if(p<0)
		{
            L=max(L,ceil(d-q,p));
            R=min(R,floor(-q,p));
        }
        if(L>R||p==0&&(q<0||q>d))
		{
			puts("NO");
			exit(0);
		}
    }
    long long s=L,si=0;
    for(register int i=0,j=1;i<=n;i++)
    {
        si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
        while(si--)
			ans[j++]=1;
        j=a[i+1].ty+1;//a[i+1]而不是a[i]
    }
}
int main()
{
    n=read();
	len=read();
    for(register int i=1;i<=n;i++)
    {
		t=readl();
		x=readl();
		y=readl();
        nx=x+y+t;
		ny=x-y+t;
        if(nx&1)
		{
			puts("NO");
			return 0;
		}
        nx/=2;
		ny/=2;
        a[i]=node(t%len,t/len,nx);
        b[i]=node(t%len,t/len,ny);
    }
    solve(a,l);
    solve(b,r);
    for(register int i=1;i<=len;i++)
		printf("%c","LDUR"[l[i]<<1|r[i]]);//此题的方向与常识相异！
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i<=i##end;++i)
#define DREP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i>=i##end;--i)
template<typename T>bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
template<typename T>T read(){
	T x=0,f=1;
	char c=getchar();
	while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
	while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
#define read() read<int>()
template<typename T>void write(T x,char c){
	static char t[25];
	static int tlen;
	t[tlen=1]=c;
	if(x<0)putchar('-'),x=-x;
	do t[++tlen]=(x%10)^48;
	while(x/=10);
	while(tlen)putchar(t[tlen--]);
}
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef double lf;
const int maxn=2e6+5;
struct data{
	ll p,k,x;
	bool operator < (const data &A){
		return p<A.p;
	}
};
vector<data>a[2];
int n,m;
ll l,h,ans[2][maxn];
ll ceilll(ll x,ll y);
ll floorll(ll x,ll y);
ll ceilll(ll x,ll y){
	if(x<0)return -floorll(-x,y);
	else return (x-1)/y+1;
}
ll floorll(ll x,ll y){
	if(x<0)return -ceilll(-x,y);
	else return x/y;
}
bool solve(ll *ans,vector<data>a){
	l=0,h=m;
	a.pb((data){0,0,0});
	a.pb((data){m,-1,0});
	sort(a.begin(),a.end());
	REP(i,1,a.size()-1){
		data u=a[i-1],v=a[i];
		if(u.k==v.k){
			if((u.x>v.x)||(v.x>u.x+v.p-u.p))return 0;
		}else if(u.k>v.k){
			chkmax(l,ceilll(u.x-v.x,u.k-v.k));
			chkmin(h,floorll(u.x-v.x+v.p-u.p,u.k-v.k));
		}else{
			chkmin(h,floorll(v.x-u.x,v.k-u.k));
			chkmax(l,ceilll(v.x-u.x+u.p-v.p,v.k-u.k));
		}
	}
	if(l>h)return 0;
	static bool vis[maxn];
	memset(vis,0,sizeof(vis));
	ans[m]=l;
	REP(i,0,a.size()-1)vis[a[i].p]=1,ans[a[i].p]=a[i].x-a[i].k*ans[m];
	int lst=0;
	REP(i,1,m)
		if(vis[i]){
			DREP(j,i-1,lst+1)ans[j]=max(ans[lst],ans[j+1]-1);
			lst=i;
		}
	return 1;
}
int main(){
#ifndef ONLINE_JUDGE
	freopen("c.in","r",stdin);
	freopen("c.out","w",stdout);
#endif
	ll t,x,y;
	n=read(),m=read();
	REP(i,1,n){
		t=read<ll>(),x=read<ll>(),y=read<ll>();
		if((abs(x+y)&1)^(t&1))return puts("NO"),0;
		a[0].pb((data){t%m,t/m,(x+y+t)/2});
		a[1].pb((data){t%m,t/m,(x-y+t)/2});
	}
	if(!solve(ans[0],a[0]))return puts("NO"),0;
	if(!solve(ans[1],a[1]))return puts("NO"),0;
	REP(i,1,m){
		if(ans[0][i]-ans[0][i-1]){
			if(ans[1][i]-ans[1][i-1])putchar('R');
			else putchar('U');
		}else{
			if(ans[1][i]-ans[1][i-1])putchar('D');
			else putchar('L');
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2000005;
ll t,x,y,nx,ny;
int n,l[N],r[N],len;
struct node{ll ty,tz,x;node(){} node(ll A,ll B,ll C){ty=A;tz=B;x=C;}}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
ll ceil(ll x,ll y)
{
    if (x<0) x=-x,y=-y;
    if (x==0) return 0;
    if (y>0) return (x-1)/y+1;
    else return x/y;
}
ll floor(ll x,ll y)
{
   if (x<0) x=-x,y=-y;
   if (x==0) return 0;
    if (y>0) return x/y;
    else return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
    sort(a+1,a+n+1);
    ll L=0,R=len;
    a[n+1]=node(len,-1,0);//设置边界!!!
    for (int i=0;i<=n;i++)//要统计入最后一个限制S[len]=0-S*(-1)
    {
        ll d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
        if (p>0)
        {
            L=max(L,ceil(-q,p));
            R=min(R,floor(d-q,p));
        }else if (p<0) {
            L=max(L,ceil(d-q,p));
            R=min(R,floor(-q,p));
        }
        if (L>R||p==0&&(q<0||q>d)) {puts("NO");exit(0);}
    }
    ll s=L,si=0;
    for (int i=0,j=1;i<=n;i++)
    {
        si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
        while (si--) ans[j++]=1;
        j=a[i+1].ty+1;//a[i+1]而不是a[i]
    }
}
int main()
{
    scanf("%d%d",&n,&len);
    for (int i=1;i<=n;i++)
    {
        scanf("%lld%lld%lld",&t,&x,&y);
        nx=x+y+t;ny=x-y+t;
        if (nx&1) return puts("NO"),0;
        nx/=2;ny/=2;
        a[i]=node(t%len,t/len,nx);
        b[i]=node(t%len,t/len,ny);
    }
    solve(a,l);
    solve(b,r);
    for (int i=1;i<=len;i++)
      printf("%c","LDUR"[l[i]<<1|r[i]]);//此题的方向与常识相异！
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long s64;
const s64 INF = 4000000000000000000ll;
const int MaxN = 200001;
const int MaxL = 2000000;
inline s64 getint()
{
    char c;
    while (c = getchar(), ('0' > c || c > '9') && c != '-');
    if (c != '-')
    {
        s64 res = c - '0';
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return res;
    }
    else
    {
        s64 res = 0;
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return -res;
    }
}
template <class T>
inline void tension(T &a, const T &b)
{
	if (b < a)
		a = b;
}
int n, l;
s64 pt[MaxN], px[MaxN], py[MaxN];
char res[MaxL + 1];
pair<int, int> b[MaxN];
inline s64 orzmod(s64 a, s64 b)
{
	return (a % b + b) % b;
}
inline s64 orzfloor(s64 a, s64 b)
{
	if (a < 0)
		return -((-a + b - 1) / b);
	return a / b;
}
inline bool check(s64 x, s64 y)
{
	int res_n = 0;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second, u = b[(i + 1) % n].second;
		if (abs((px[u] - (double)(pt[u] / l) * x) - (px[v] - (double)(pt[v] / l) * x)) > 1.5e18)
			return false;
		if (abs((py[u] - (double)(pt[u] / l) * y) - (py[v] - (double)(pt[v] / l) * y)) > 1.5e18)
			return false;
		s64 dx = (px[u] - (pt[u] / l) * x) - (px[v] - (pt[v] / l) * x);
		s64 dy = (py[u] - (pt[u] / l) * y) - (py[v] - (pt[v] / l) * y);
		s64 dt = i + 1 < n ? b[i + 1].first - b[i].first : l - b[i].first;
		if (i + 1 == n)
			dx += x, dy += y;
		if (abs(dx) + abs(dy) > dt)
			return false;
		if ((abs(dx) + abs(dy)) % 2 != dt % 2)
			return false;
		while (dx > 0)
			res[res_n++] = 'R', dx--, dt--;
		while (dx < 0)
			res[res_n++] = 'L', dx++, dt--;
		while (dy > 0)
			res[res_n++] = 'U', dy--, dt--;
		while (dy < 0)
			res[res_n++] = 'D', dy++, dt--;
		while (dt > 0)
			res[res_n++] = 'L', dt--, res[res_n++] = 'R', dt--;
	}
	return true;
}
inline bool handle()
{
	for (int i = 0; i < n; i++)
		if (orzmod(px[i] + py[i], 2) != pt[i] % 2)
			return false;
	for (int i = 0; i < n; i++)
		b[i] = make_pair(pt[i] % l, i);
	sort(b, b + n);
	for (int i = 0; i + 1 < n; i++)
		if (b[i].first == b[i + 1].first)
		{
			int v = b[i].second;
			int u = b[i + 1].second;
			return check((px[v] - px[u]) / ((pt[v] - pt[u]) / l), (py[v] - py[u]) / ((pt[v] - pt[u]) / l));
		}
	s64 sxy = INF, mxy = INF;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second;
		int u = b[(i + 1) % n].second;
		s64 dx = px[u] - px[v];
		s64 dy = py[u] - py[v];
		s64 dk = pt[u] / l - pt[v] / l;
		s64 dt = i + 1 < n ? b[i + 1].first - b[i].first : l - b[i].first;
		if (i + 1 == n)
			dk--;
		if (dk < 0)
		{
			tension(sxy, orzfloor(dt - dx - dy, -dk));
			tension(mxy, orzfloor(dt - dx + dy, -dk));
		}
		else if (dk > 0)
		{
			tension(sxy, orzfloor(dt + dx + dy, dk));
			tension(mxy, orzfloor(dt + dx - dy, dk));
		}
		else
		{
			if (abs(dx) + abs(dy) > dt)
				return false;
		}
	}
	while (abs(sxy) % 2 != l % 2)
		sxy--;
	while (abs(mxy) % 2 != l % 2)
		mxy--;
	s64 vx = (sxy + mxy) / 2, vy = (sxy - mxy) / 2;
	return check(vx, vy);
}
int main()
{
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		pt[i] = getint(), px[i] = getint(), py[i] = getint();
	pt[n] = 0, pt[n] = 0, py[n] = 0;
	n++;
	if (handle())
		puts(res);
	else
		puts("NO");
	return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node {
	int x, y, a, b;
}d[200007];
int n, l, inf = 4e18, lx = -inf, rx = inf, ly = -inf, ry = inf;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int cmp(node a, node b)
{
	return a.b < b.b;
}
signed main()
{
	n = read();
	l = read();
	for (int i = 1; i <= n; i++)
	{
		int t = read(), x = read(), y = read();
		if ((t ^ x ^ y) & 1) { cout << "NO" << endl; return 0; }
		d[i].a = t / l;
		d[i].b = t % l;
		d[i].x = (x + y + t) / 2;
		d[i].y = (y - x + t) / 2;
	}
	sort(d + 1, d + n + 1, cmp);
	d[++n] = node{ 0,0,-1,l };
	for (int i = 1; i <= n; i++)
	{
		int aa = d[i].a - d[i - 1].a, bb = d[i].b - d[i - 1].b;
		if (!aa)
		{
			if (d[i].x - d[i - 1].x - bb > 0 || d[i].x - d[i - 1].x < 0) { cout << "NO" << endl; return 0; }
			if (d[i].y - d[i - 1].y - bb > 0 || d[i].y - d[i - 1].y < 0) { cout << "NO" << endl; return 0; }
		}
		else if (aa > 0)
		{
			lx = max(lx, (int)ceil(1.0L * (d[i].x - d[i - 1].x - bb) / aa));
			rx = min(rx, (int)floor(1.0L * (d[i].x - d[i - 1].x) / aa));
			ly = max(ly, (int)ceil(1.0L * (d[i].y - d[i - 1].y - bb) / aa));
			ry = min(ry, (int)floor(1.0L * (d[i].y - d[i - 1].y) / aa));
		}
		else
		{
			aa = -aa;
			lx = max(lx, (int)ceil(1.0L * (d[i - 1].x - d[i].x) / aa));
			rx = min(rx, (int)floor(1.0L * (d[i - 1].x - d[i].x + bb) / aa));
			ly = max(ly, (int)ceil(1.0L * (d[i - 1].y - d[i].y) / aa));
			ry = min(ry, (int)floor(1.0L * (d[i - 1].y - d[i].y + bb) / aa));
		}
	}
	if (lx > rx || ly > ry) { cout << "NO" << endl; return 0; }
	for (int i = 1; i <= n; i++)
	{
		int xx = (d[i].x - lx * d[i].a) - (d[i - 1].x - lx * d[i - 1].a);
		int yy = (d[i].y - ly * d[i].a) - (d[i - 1].y - ly * d[i - 1].a);
		int bb = d[i].b - d[i - 1].b, x = 0, y = 0;
		while (bb--)
			if (x < xx)
			{
				x++;
				if (y < yy)putchar('U'), y++;
				else putchar('R');
			}
			else if (y < yy)putchar('L'), y++;
			else putchar('D');
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#include<assert.h>
#define LL long long
#define LD long double
using namespace std;
const int NN=2000000 +117;
const int MM=2000000 +117;
LL read(){
	LL fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}

int m,n,l;
LL a[NN][3]={};
LL t[NN]={};
LL s[NN]={};
int res[NN]={};
int res2[NN]={};
char trans[2][2]={};
struct node{
	LL id,c,k;
}p[NN]={};
bool cmp(node a,node b){
	return a.id<b.id;
}
LL cl(LL a,LL b){
	return (a+b-1)/b;
}
LL fr(LL a,LL b){
	return a/b;
}
bool solve(LL t[],LL s[],int res[]){
	for(int i=1;i<=n;++i){
		if((s[i]+t[i])&1)return false;
		s[i]=(s[i]+t[i])>>1;
		p[i].id=t[i]%l;
		p[i].k=t[i]/l;
		p[i].c=s[i];
	}
	int cnt=n;
	++cnt;
	p[cnt].id=0;
	p[cnt].k=0;
	p[cnt].c=0;
	p[++cnt].id=l;
	p[cnt].k=-1;
	p[cnt].c=0;
	sort(p+1,p+1+cnt,cmp);
	LL low=0,up=l;
	for(int i=1;i<cnt;++i){
		LL cha=p[i+1].id-p[i].id;
		LL cc=p[i+1].c-p[i].c;
		LL kk=p[i+1].k-p[i].k;
		if(kk==0){
			if(cc<=cha&&0<=cc)continue;
			else return false;
		}
		if(kk>0){
			if(cc-cha>0){
				low=max(low,cl(cc-cha,kk));
			}
			if(cc>=0){
				up=min(up,fr(cc,kk));
			}
			else return false;
		}
		else{
			if(cc-cha<=0){
				up=min(up,fr(cha-cc,-kk));
			}
			else return false;
			if(cc<0){
				low=max(low,cl(-cc,-kk));
			}
		}
	}
	if(low>up)return false;
	LL T=low;
	//cerr<<T<<endl;
	for(int i=2;i<=cnt;++i){
		if(p[i].id!=p[i-1].id){
			LL pre=p[i-1].c-p[i-1].k*T;
			LL now=p[i].c-p[i].k*T;
			LL c=now-pre;
			for(int j=p[i-1].id+1;j<=p[i].id;++j){
				if(c)--c,res[j]=1;
				else res[j]=0;
			}
			//if(c!=0)printf("%I64d %d %d\n",c,i,cnt);
			assert(c==0);
		}
	}
	return true;
}
int main(){
	//open();
	n=read();
	l=read();
	trans[1][1]='R';
	trans[0][0]='L';
	trans[0][1]='D';
	trans[1][0]='U';
	for(int i=1;i<=n;++i){
		a[i][0]=read();
		a[i][1]=read();
		a[i][2]=read();
	}
	for(int i=1;i<=n;++i){
		t[i]=a[i][0];
		s[i]=a[i][1]+a[i][2];
	}
	if(!solve(t,s,res)){
		printf("NO\n");
		return 0;
	}
	for(int i=1;i<=n;++i){
		t[i]=a[i][0];
		s[i]=a[i][1]-a[i][2];
	}
	if(!solve(t,s,res2)){
		printf("NO\n");
		return 0;
	}
	for(int i=1;i<=l;++i){
		putchar(trans[res[i]][res2[i]]);
	}
	putchar('\n');
	close();
	return 0;
}

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long
void read (int &x) {
    char ch = getchar(); int f = 0; x = 0;
    while (!isdigit(ch)) { if (ch == '-') f = 1; ch = getchar(); }
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); if (f) x = -x;
} const int N = 2e5 + 10, M = 2e6 + 10;
int n, l, vala, valb;
struct qwq {
    int k, y, sum;
    bool operator < (const qwq &x) const { return y < x.y; }
} a[N], b[N]; int pa[N], pb[N], sa[M], sb[M];
int ka, kb, la = -1e15, ra = 1e15, lb = -1e15, rb = 1e15;
#define fail return puts ("NO"), 0
#define Max(a, b) (a >= b ? a : b)
#define Min(a, b) (a >= b ? b : a)
int mx (int a, int b) {
    return a / b + (a % b && a > 0);
}
int mn (int a, int b) {
    return a / b - (a % b && a < 0);
}
signed main() {
    read (n), read (l);
    for (int i = 1, t, x, y; i <= n; ++i) {
        read (t), read (x), read (y);
        a[i] = {t / l, t % l, x - y};
        b[i] = {t / l, t % l, x + y};
    } //a[0] = b[0] = {0, 0, 0};
    ka = kb = (l & 1);
    sort (a + 1, a + n + 1), sort (b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i) {
        int va = a[i].y - a[i - 1].y, vb = a[i].sum - a[i - 1].sum, kk = (a[i - 1].k - a[i].k);
        if (kk) {
            if (kk < 0) {
                la = Max (la, mx (vb - va, -kk));
                ra = Min (ra, mn (vb + va, -kk));
            } else {
                la = Max (la, mx (-vb - va, kk));
                ra = Min (ra, mn (va - vb, kk));
            }
        }
        if ((kk & 1)) {
            if ((va + vb) & 1) { if (ka == 0) fail; }
            else { if (ka == 1) fail; }
        } else if ((va + vb) & 1) fail;
    }
    for (int i = 1; i <= n; ++i) {
        int va = b[i].y - b[i - 1].y, vb = b[i].sum - b[i - 1].sum, kk = (b[i - 1].k - b[i].k);
        if (kk) {
            if (kk < 0) {
                lb = Max (lb, mx (vb - va, -kk));
                rb = Min (rb, mn (vb + va, -kk));
            } else {
                lb = Max (lb, mx (-vb - va, kk));
                rb = Min (rb, mn (va - vb, kk));
            }
        }
        if ((kk & 1)) {
            if ((va + vb) & 1) { if (kb == 0) fail; }
            else { if (kb == 1) fail; }
        } else if ((va + vb) & 1) fail;
    }
    int kk = -a[n].k - 1;
    if (kk) {
        if (kk < 0) {
            la = Max (la, mx (- l + a[n].y + a[n].sum, -kk));
            ra = Min (ra, mn (- a[n].y + l + a[n].sum, -kk));
        } else {
            la = Max (la, mx (a[n].y - l - a[n].sum, kk));
            ra = Min (ra, mn (l - a[n].y - a[n].sum, kk));
        }
        if ((kk & 1)) {
            if ((l - a[n].y - a[n].sum) & 1) { if (ka == 0) fail; }
            else { if (ka == 1) fail; }
        } else if ((l - a[n].y - a[n].sum) & 1) fail;
    } kk = -b[n].k - 1;
    if (kk) {
        if (kk < 0) {
            lb = Max (lb, mx (- l + b[n].y + b[n].sum, -kk));
            rb = Min (rb, mn (- b[n].y + l + b[n].sum, -kk));
        } else {
            lb = Max (lb, mx (b[n].y - l - b[n].sum, kk));
            rb = Min (rb, mn (l - b[n].y - b[n].sum, kk));
        }
        if ((kk & 1)) {
            if ((l - b[n].y - a[n].sum) & 1) { if (kb == 0) fail; }
            else { if (kb == 1) fail; }
        } else if ((l - b[n].y - a[n].sum) & 1) fail;
    }
    if (la > ra) fail;
    else {
        if (la == ra && (la & 1) != ka) fail;
        else vala = ((la & 1) == ka) ? la : la + 1;
    } if (lb > rb) fail;
    else {
        if (lb == rb && (lb & 1) != kb) fail;
        else valb = ((lb & 1) == kb) ? lb : lb + 1;
    }
    a[++n] = {0, l, vala}, b[n] = {0, l, valb};
    for (int i = 1; i <= n; ++i) {
        pa[i] = a[i].sum - a[i].k * vala;
        int _ = pa[i] - pa[i - 1], j = a[i - 1].y + 1;
        int k = (_ > 0) ? 1 : -1; if (_ < 0) _ = -_;
        for (; j <= a[i].y && _; ++j, --_) sa[j] = k;
        for (; j <= a[i].y; j += 2)
            sa[j] = 1, sa[j + 1] = -1;
    }/////
    for (int i = 1; i <= n; ++i) {
        pb[i] = b[i].sum - b[i].k * valb;
        int _ = pb[i] - pb[i - 1], j = b[i - 1].y + 1;
        int k = (_ > 0) ? 1 : -1; if (_ < 0) _ = -_;
        for (; j <= b[i].y && _; ++j, --_) sb[j] = k;
        for (; j <= b[i].y; j += 2)
            sb[j] = 1, sb[j + 1] = -1;
    }
    for (int i = 1; i <= l; ++i) {
        if (sa[i] == 1 && sb[i] == 1) putchar ('R');
        if (sa[i] == 1 && sb[i] == -1) putchar ('D');
        if (sa[i] == -1 && sb[i] == 1) putchar ('U');
        if (sa[i] == -1 && sb[i] == -1) putchar ('L');
    }
    return puts (""), 0;
}

#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;

struct tup {
	ll i, j, x;
};

ll N, L;
vector<ll> x, y, t;

void fail(char s) {
	//prllf("%c\n", s);
	puts("NO");
	exit(0);
}
ll floordiv(ll a,ll b){ return (a-(a%b+b)%b)/b; }
ll ceildiv(ll a,ll b){ return (a+(b-a%b)%b)/b; }

vector<ll> solve(vector<ll> x, vector<ll> t) {
	vector<tup> a;
	a.push_back({0, 0, 0});
	a.push_back({-1, L, 0});

	for(ll i = 0; i < N; ++i) {
		if((x[i]+t[i])%2 != 0)
			fail('0');
		a.push_back({t[i]/L, t[i]%L, (x[i]+t[i])/2});
	}

	sort(a.begin(), a.end(), [](tup t1, tup t2) {
		return t1.j < t2.j;
	});

	ll lo = 0, hi = L;
	for(ll i = 0; i <= N; ++i) {
		ll dx = a[i+1].x-a[i].x,
			dj = a[i+1].j-a[i].j,
			di = a[i+1].i-a[i].i;
		//prllf("0 <= %d - pn*%d <= %d\n", dx, di, dj);
		if(di > 0) {
			lo = max(lo, ceildiv(dx-dj, di));
			hi = min(hi, floordiv(dx,di));
		} else if (di < 0) {
			lo = max(lo, ceildiv(dx, di));
			hi = min(hi, floordiv(dx-dj,di));
		} else if(dx < 0 || dx > dj)
			fail('A');
		//prllf("%d %d\n", lo, hi);
	}
	if(lo > hi)
		fail('B');

	//prllf("lo = %d\n", lo);

	//for(tup t: a) prllf("%d %d %d\n", t.i, t.j, t.x);puts("");

	vector<ll> p(L+1);
	for(ll i = 0; i <= N; ++i) {
		//prllf("%d-%d = %d\n", a[i].j+1, a[i+1].j, (a[i+1].x-a[i].x)-lo*(a[i+1].i-a[i].i));
		for(ll j = a[i].j+1; j <= a[i].j+(a[i+1].x-a[i].x)-lo*(a[i+1].i-a[i].i); ++j)
			p[j] = 1;
	}
	//for(ll i = 0; i <= L; ++i)prllf("%d ", p[i]);puts("");
	return p;
}

int main() {
	//freopen("A.txt", "r", stdin);

	scanf("%I64d%I64d", &N, &L);
	for(ll i = 0, a, b, c; i < N; ++i) {
		scanf("%I64d%I64d%I64d", &a, &b, &c);
		x.push_back(b+c);
		y.push_back(b-c);
		t.push_back(a);
	}

	vector<ll> rx = solve(x, t), ry = solve(y, t);
	for(ll i = 1; i < L+1; ++i)
		printf("%c", "LDUR"[2*rx[i]+ry[i]]);
}

#include <bits/stdc++.h>
using namespace std;

const int N = 220000;

int id[N];
map<int, int> H;
map<int, pair<long long, long long> > ans;
char str[N * 10];
long long t[N], x[N], y[N];

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	int N, L; cin >> N >> L;
	for (int i = 1; i <= N; i++) {
		cin >> t[i] >> x[i] >> y[i];
		if ((t[i] + x[i] + y[i]) % 2 != 0) return puts("NO"), 0;
	}
	bool flg = 0;
	long long X = 0, Y = 0;
	H[0] = 0;
	for (int i = 1; i <= N; i++) {
		int r = t[i] % L;
		if (H.count(r)) {
			int j = H[r];
			long long k = (t[i] - t[j]) / L;
			if ((x[i] - x[j]) % k != 0 || (y[i] - y[j]) % k != 0) return puts("NO"), 0;
			if (!flg) {
				X = (x[i] - x[j]) / k;
				Y = (y[i] - y[j]) / k;
				if (abs(X) + abs(Y) > L) return puts("NO"), 0;
			} else {
				if (X != (x[i] - x[j]) / k) return puts("NO"), 0;
				if (Y != (y[i] - y[j]) / k) return puts("NO"), 0;
			}
			flg = 1;
		} else {
			H[r] = i;
		}
	}
	auto gen = [&](int from, int to, int dx, int dy) {
		for (int i = 0; i < abs(dx); i++) str[from + i] = (dx < 0 ? 'L' : 'R');
		for (int i = 0; i < abs(dy); i++) str[from + abs(dx) + i] = (dy < 0 ? 'D' : 'U');
		for (int i = abs(dx) + abs(dy); i < to - from; i++) str[i + from] = ((i & 1) ? 'L' : 'R');
	};
	if (!flg) {
		for (int i = 1; i <= N; i++) id[i] = i;
		sort(id + 1, id + N + 1, [&](int i, int j) {
			return t[i] % L < t[j] % L;
		});
		id[N + 1] = 0;
		long long Smin = -L, Smax = L;
		long long Dmin = -L, Dmax = L;
		for (int i = 1; i <= N + 1; i++) {
			int u = id[i - 1], v = id[i];
			long long D = t[u] / L - t[v] / L;
			int T = abs(t[v] % L - t[u] % L);
			if (i == N + 1) T = L - t[u] % L, D++;
			if (D < 0) swap(u, v), D = -D;
			long long smin = x[u] - x[v] + y[u] - y[v] - T;
			long long dmin = x[u] - x[v] - y[u] + y[v] - T;
			long long smax = x[u] - x[v] + y[u] - y[v] + T;
			long long dmax = x[u] - x[v] - y[u] + y[v] + T;
			if (D == 0) {
				if (smax < 0 || smin > 0 || dmax < 0 || dmin > 0) return puts("NO"), 0;
				continue;
			}
			smin = (smin + ((D - smin) % D + D) % D) / D;
			smax = (smax - (smax % D + D) % D) / D;
			dmin = (dmin + ((D - dmin) % D + D) % D) / D;
			dmax = (dmax - (dmax % D + D) % D) / D;
			Smin = max(Smin, smin);
			Smax = min(Smax, smax);
			Dmin = max(Dmin, dmin);
			Dmax = min(Dmax, dmax);
		}
		if (Dmin + L & 1) Dmin++;
		if (Dmax + L & 1) Dmax--;
		if (Smin + L & 1) Smin++;
		if (Smax + L & 1) Smax--;
		if (Dmin > Dmax || Smin > Smax) return puts("NO"), 0;
		X = (Dmin + Smin) / 2;
		Y = (Smin - Dmin) / 2;
	}
	ans[0] = {0, 0};
	ans[L] = {X, Y};
	for (int i = 1; i <= N; i++) ans[t[i] % L] = make_pair(x[i] - t[i] / L * X, y[i] - t[i] / L * Y);
	int last = -1;
	auto seen = make_pair(0, 0);
	for (auto t : ans) {
		if (last == -1) {
			last = t.first;
			seen = t.second;
			continue;
		}
		if (abs(t.second.first - seen.first) + abs(t.second.second - seen.second) > t.first - last) return puts("NO"), 0;
		gen(last, t.first, t.second.first - seen.first, t.second.second - seen.second);
		last = t.first;
		seen = t.second;
	}
	puts(str);
	return 0;
}

// Legends Never Die.

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

namespace fastIO
{
	const UI BUFFER_SIZE = (UI) 1 << 15;
	char buffer[BUFFER_SIZE], *cur, *ed;

	inline char getc() { return *(cur == ed ? ed = buffer + fread(buffer, 1, BUFFER_SIZE, stdin), cur = buffer : cur)++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

template<typename T> inline T sqr(const T &val) { return val * val; }
template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }

// END tpl.

const int MAXN = (int) 2e5, MAXL = (int) 2e6;

int n, l;

struct node
{
	LL k, p, x;

	inline bool operator < (const node &rhs) const { return this->p < rhs.p; }

	node() { }
	node(LL _k, LL _p, LL _x): k(_k), p(_p), x(_x) { }
};

node a[MAXN + 5], b[MAXN + 5];

inline void input()
{
	n = read<int>(), l = read<int>();
}

inline LL lower(LL p, LL q)
{
	if(p < 0 && q < 0) p = -p, q = -q;
	if(p < 0 || q < 0)
	{
		p = abs(p), q = abs(q);
		return -(p + q - 1) / q;
	}
	else return p / q;
}

inline LL upper(LL p, LL q)
{
	if(p < 0 && q < 0) p = -p, q = -q;
	if(p < 0 || q < 0) return p / q;
	else return (p + q - 1) / q;
}

inline int calc_seq(node *A, int *v)
{
	sort(A + 1, A + n + 1), A[n + 1] = node(-1, l, 0);

	LL L = 0, R = l;
	for(int i = 0; i <= n; ++i)
	{
		LL dk = A[i].k - A[i + 1].k, dx = A[i + 1].x - A[i].x, dp = A[i + 1].p - A[i].p;
		if(dk == 0 && (dx < 0 || dx > dp)) return 0;
		if(dk > 0)
		{
			chkmax(L, upper(-dx, dk));
			chkmin(R, lower(dp - dx, dk));
		}
		else if(dk < 0)
		{
			chkmax(L, upper(dp - dx, dk));
			chkmin(R, lower(-dx, dk));
		}
		if(L > R) return 0;
	}

	LL SI = L;
	for(int i = 0, j = 1; i <= n; ++i)
	{
		for(LL res = (A[i + 1].x - A[i + 1].k * SI) - (A[i].x - A[i].k * SI); res--; ++j) v[j] = 1;
		j = A[i + 1].p + 1;
	}
	return 1;
}

inline void solve()
{
	for(int i = 1; i <= n; ++i)
	{
		LL t = read<LL>(), x0 = read<LL>(), y0 = read<LL>();
		if(t % 2 != ((x0 + y0) % 2 + 2) % 2) { puts("NO"); return; }

		LL x = (x0 + y0 + t) / 2, y = (x0 - y0 + t) / 2;
		a[i] = node(t / l, t % l, x);
		b[i] = node(t / l, t % l, y);
	}

	static int X[MAXL + 5], Y[MAXL + 5];

	if(!calc_seq(a, X)) { puts("NO"); return; }
	if(!calc_seq(b, Y)) { puts("NO"); return; }

	for(int i = 1; i <= l; ++i) putchar("LDUR"[X[i] << 1 | Y[i]]);
	puts("");
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("G.in", "r", stdin);
	freopen("G.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#define ll long long
#define N 2000006
#define NO puts("NO"), exit(0);
#define oo 999999999999999999

using namespace std;

int n, l;

struct Node{
	int w;
	ll k, x, y;

	void rd(){
		ll t, X, Y;
		scanf("%lld%lld%lld", &t, &X, &Y);
		if((X ^ Y ^ t) & 1) NO;
		x = (X + Y + t) / 2; y = (Y - X + t) / 2;
		k = t / l; w = t % l;
		return ;
	}

	bool operator < (Node x)const{
		return w < x.w;
	}
}p[N];

char res[N], s[N];

void make(ll, ll);

int main(){
	scanf("%d%d", &n, &l);
	ll lx = -oo, rx = oo, ly = -oo, ry = oo;
	for(int i = 1; i <= n; ++i) p[i].rd();
	p[++n] = (Node){0, 0, 0, 0}; p[++n] = (Node){l, -1, 0, 0};
	sort(p + 1, p + 1 + n); res[1] = 'Z';
	for(int i = 2; i <= n; ++i){
		ll k = p[i].k - p[i - 1].k;
		int w = p[i].w - p[i - 1].w;
		ll X = p[i].x - p[i - 1].x, Y = p[i].y - p[i - 1].y;
		if(!k){
			if(X - w > 0 || X < 0 || Y - w > 0 || Y < 0) NO;
			continue;
		}
		if(k > 0){
			lx = max(lx, (ll)ceil(1.0 * (X - w) / k));
			rx = min(rx, (ll)floor(1.0 * X / k));
			ly = max(ly, (ll)ceil(1.0 * (Y - w) / k));
			ry = min(ry, (ll)floor(1.0 * Y / k));
		} else{
			k = -k; X = -X; Y = -Y;
			lx = max(lx, (ll)ceil(1.0 * X / k));
			rx = min(rx, (ll)floor(1.0 * (w + X) / k));
			ly = max(ly, (ll)ceil(1.0 * Y / k));
			ry = min(ry, (ll)floor(1.0 * (w + Y) / k));
		}
	}
	if(lx > rx || ly > ry) NO;
	make(lx, ly); make(lx, ry); make(rx, ly); make(rx, ry);
	for(int i = 1; i <= l; ++i) putchar(res[i]);
	return 0;
}

void make(ll x, ll y){
	int top = 0;
	for(int i = 2; i <= n; ++i){
		int w = p[i].w - p[i - 1].w;
		if(!w) continue;
		ll k = p[i].k - p[i - 1].k;
		ll dx = p[i].x - p[i - 1].x - k * x;
		ll dy = p[i].y - p[i - 1].y - k * y;
		if(dx < 0 || dy < 0) NO;
		for(int j = 1; j <= w; ++j){
			if(j + dx <= w && j + dy <= w) s[++top] = 'D';
			if(j + dx <= w && j + dy > w) s[++top] = 'L';
			if(j + dx > w && j + dy <= w) s[++top] = 'R';
			if(j + dx > w && j + dy > w) s[++top] = 'U';
		}
	}
	int pos = 1;
	while(pos <= l && res[pos] == s[pos]) ++pos;
	if(res[pos] > s[pos]) memcpy(res, s, sizeof res);
	return ;
}

#include <cstdio>
#include <algorithm>

typedef long long LL;
const int MN = 200005, ML = 2000005;

int N, L;
LL t[MN], x[MN], y[MN];
int p[MN], a[ML], b[ML];

inline LL divf(LL c, LL d) { return (c - ((c % d + d) % d)) / d; }
inline LL divc(LL c, LL d) { return (c + ((d - c % d) % d)) / d; }

inline bool check(LL *s, int *v) {
	LL lb = 0, rb = L;
	for (int id = 1; id <= N; ++id) {
		int i, j, dis;
		LL ci, cj;
		if (id == N) {
			i = p[id], j = N + 1, s[N + 1] = 0;
			ci = t[i] / L, cj = -1;
			dis = L - t[i] % L;
		} else {
			i = p[id], j = p[id + 1];
			ci = t[i] / L, cj = t[j] / L;
			dis = t[j] % L - t[i] % L;
		}
		if (ci == cj) if (s[i] > s[j] || s[j] > s[i] + dis) return 0;
		if (ci > cj) {
			lb = std::max(lb, divc(s[i] - s[j], ci - cj));
			rb = std::min(rb, divf(s[i] - s[j] + dis, ci - cj));
		}
		if (ci < cj) {
			rb = std::min(rb, divf(s[j] - s[i], cj - ci));
			lb = std::max(lb, divc(s[j] - s[i] - dis, cj - ci));
		}
	}
	if (lb > rb) return 0;
	for (int id = 1; id <= N; ++id) {
		int posj, posi, dif;
		if (id == N) {
			int i = p[id];
			posi = t[i] % L, posj = L;
			dif = lb - (s[i] - (t[i] / L) * lb);
		} else {
			int i = p[id], j = p[id + 1];
			posi = t[i] % L, posj = t[j] % L;
			LL xi = s[i] - (t[i] / L) * lb;
			LL xj = s[j] - (t[j] / L) * lb;
			dif = xj - xi;
		}
		for (int k = posj; k > posi; --k) v[k] = dif ? --dif, 1 : 0;
	}
	return 1;
}

int main() {
	scanf("%d%d", &N, &L), ++N;
	p[1] = 1;
	for (int i = 2; i <= N; ++i) {
		LL X, Y;
		scanf("%lld%lld%lld", &t[i], &X, &Y);
		if ((X ^ Y ^ t[i]) & 1) return puts("NO"), 0;
		x[i] = (X + Y + t[i]) / 2, y[i] = (X - Y + t[i]) / 2;
		p[i] = i;
	}
	std::sort(p + 1, p + N + 1, [](int i, int j) {
		return t[i] % L < t[j] % L;
	});
	if (!check(x, a) || !check(y, b)) return puts("NO"), 0;
	for (int i = 1; i <= L; ++i) putchar("LUDR"[b[i] * 2 + a[i]]);
	puts("");
	return 0;
}

#include<bits/stdc++.h>

#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-funroll-loops")
#pragma GCC target("sse4")

#define mms(a,n) memset(a,0,sizeof((a)[0])*(n))
#define mmp(a,b,n) memcpy(a,b,sizeof((b)[0])*(n))
#define lowbit(x) ((x)&-(x))
#define pb push_back
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fo(i,l,r) for(register int i=l,_lim_=r;i<=_lim_;i++)
#define fd(i,r,l) for(register int i=r,_lim_=l;i>=_lim_;i--)
#define fos(i,l,r,d) for(register int i=l,_lim_=r;i<=r;i+=d)
#define fol(i,l,r) for(register ll i=l,_lim_=r;i<=_lim_;i++)
#define fdl(i,r,l) for(register ll i=r,_lim_=l;i>=_lim_;i--)
#define fosl(i,l,r,d) for(register ll i=l,_lim_=r;i<=r;i+=d)
#define Clear(a) memset(a,0,sizeof(a))
#define Copy(a,b) memcpy(a,b,sizeof(b))
#define ALL(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define sqr(x) ((x)*(x))
#define GCD __gcd

using namespace std;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair<int,int> pi;
typedef pair<ll*,ll*> pst;
typedef pair<pst,int> psti;
typedef vector<int> VI;
typedef vector<VI> VII;

namespace io{
	const int L=(1<<21)+1;
	char ibuf[L],*iS,*iT,obuf[L],*oS=obuf,*oT=obuf+L-1,c,st[55];int f,tp;
	#ifdef whzzt
		#define gc() getchar()
	#else
		#define gc() (iS==iT?(iT=(iS=ibuf)+fread(ibuf,1,L,stdin),(iS==iT?EOF:*iS++)):*iS++)
	#endif
	inline void flush(){fwrite(obuf,1,oS-obuf,stdout);oS=obuf;}
	inline void putc(char x){*oS++=x;if(oS==oT)flush();}
	template<class I>
	inline void gi(I&x){
		for(f=1,c=gc();c<'0'||c>'9';c=gc())if(c=='-')f=-1;
		for(x=0;c<='9'&&c>='0';c=gc())x=x*10+(c&15);x*=f;
	}
	template<class I>
	inline void print(I x){
		if(!x)putc('0');if(x<0)putc('-'),x=-x;
		while(x)st[++tp]=x%10+'0',x/=10;
		while(tp)putc(st[tp--]);
	}
	inline void gs(char*s,int&l){
		for(c=gc();c<'a'||c>'z';c=gc());
		for(l=0;c<='z'&&c>='a';c=gc())s[l++]=c;
	}
	inline void ps(const char*s){
		fo(i,0,strlen(s)-1)putc(s[i]);
	}
};
using io::putc;
using io::gi;
using io::gs;
using io::ps;
using io::print;

const int N = 200005, L = 2000005;

int n, m, sum[L], opt[L], ri[L], l, r;
struct node {
	ll t, x, y;
	node () {t = x = y = 0;}
	void read () {
		ll a, b;
		gi (t); gi (a); gi (b);
		if (((a + b) ^ t) & 1) puts ("NO"), exit (0);
		x = (a + b + t) / 2; y = (a - b + t) / 2;
		if (x < 0 || y < 0) puts ("NO"), exit (0);
	}
	bool operator < (const node &a) const { return t % m < a.t % m; }
} p[N];

void Assert (bool f) { if (!f) puts ("NO"), exit (0); }
void check (ll b1, ll k1, ll b2, ll k2, int &l, int &r) {
	// b1 - i * k1 <= b2 - i * k2
	if (k1 == k2) {
		Assert (b1 <= b2);
		return ;
	}
	ll v;
	if (k1 < k2) {
		// i <= (b2 - b1) / (k2 - k1)
		v = (b2 - b1) / (k2 - k1);
		if (r > v) {
			Assert (l <= v);
			r = v;
		}
	} else {
		// i >= (b1 - b2) / (k1 - k2)
		v = (b1 - b2 + k1 - k2 - 1) / (k1 - k2);
		if (l < v) {
			Assert (r >= v);
			l = v;
		}
	}
}
void check (ll b1, ll k1, ll b2, ll k2, ll s, int &l, int &r) {
	// b1 - i * k1 <= b2 - i * k2
	check (b1, k1, b2, k2, l, r);
	// b1 - i * k1 + s >= b2 - i * k2
	check (b2, k2, b1 + s, k1, l, r);
}

void solve () {
	l = 0; r = m;
	check (p[1].x, p[1].t / m, p[1].t % m, 0, l, r);
	check (0, 0, p[1].x, p[1].t / m, l, r);
	check (p[n].x, p[n].t / m, 0, -1, l, r);
	check (-(m - p[n].t % m), -1, p[n].x, p[n].t / m, l, r);
	fo (i, 1, n - 1) check (p[i].x, p[i].t / m, p[i + 1].x, p[i + 1].t / m, p[i + 1].t % m - p[i].t % m, l, r);
	memset (sum, -1, (m + 1) << 2);
	fo (i, 1, n) sum[p[i].t % m] = p[i].x - p[i].t / m * l;
	sum[m] = ri[m] = l;
	fd (i, m - 1, 1) if (~sum[i]) ri[i] = sum[i]; else ri[i] = ri[i + 1];
	sum[0] = 0;
	fo (i, 1, m) sum[i] = sum[i - 1] + (sum[i - 1] < ri[i]);
	fd (i, m, 1) sum[i] -= sum[i - 1];
}

char str[5][5] = { "LD", "UR" };

int main () {
	gi (n); gi (m);
	fo (i, 1, n) p[i].read();
	sort (p + 1, p + n + 1);
	solve ();
	fo (i, 1, m) opt[i] = sum[i];
	fo (i, 1, n) swap (p[i].x, p[i].y);
	solve ();
	fo (i, 1, m) putc (str[opt[i]][sum[i]]);
	io :: flush();
	return 0;
}

#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
auto rd=read<int>;

typedef long long s64;
struct Tri {
	s64 p, t, x, y;
	bool operator<(const Tri &o) const {return t<o.t;}
};
const int N=2e5+2, L=2e6+1;
const s64 INF=4e18;
Tri a[N];
char ans[L];
void gg() {
	puts("NO");
	exit(0);
}
s64 dceil(s64 a, s64 b) {
	if(a<0) return a/b; else return (a+b-1)/b;
}
s64 dfloor(s64 a, s64 b) {
	if(a>0) return a/b; else return (a-b+1)/b;
}
int main() {
	int n=rd(), l=rd();
	auto rdll=read<s64>;
	s64 smin=-INF, smax=INF, dmin=-INF, dmax=INF, s, d, x, y;
	for(int i=1; i<=n; ++i) {
		s64 t=rdll(), x=rdll(), y=rdll();
		a[i]={t/l, t%l, x, y};
		if((t^x^y)&1) gg();
	}
	std::sort(a+1, a+n+1);
	for(int i=0, j=n; i<=n; j=i++) {
		s64 p=a[i].p-a[j].p, t=a[i].t-a[j].t, x=a[i].x-a[j].x, y=a[i].y-a[j].y;
		if(i==0) --p, t+=l;
		if(p==0) {
			if(llabs(x)+llabs(y)>t) gg();
			continue;
		}
		if(p<0) p=-p, x=-x, y=-y;
		cmax(smin, dceil(x+y-t, p));
		cmin(smax, dfloor(x+y+t, p));
		cmax(dmin, dceil(x-y-t, p));
		cmin(dmax, dfloor(x-y+t, p));
	}
	if(smin>smax||dmin>dmax) gg();
	s=smin, d=dmin;
	if((s^l)&1) if(smin!=smax) ++s; else gg();
	if((d^l)&1) if(dmin!=dmax) ++d; else gg();
	x=(s+d)/2, y=(s-d)/2;
	for(int i=0; i<=n; ++i) a[i].x-=x*a[i].p, a[i].y-=y*a[i].p;
	a[n+1]={0, l, x, y};
	for(int i=1, j=0; i<=n+1; ++i) {
		for(s64 k=a[i-1].x; k<a[i].x; ++k) ans[j++]='R';
		for(s64 k=a[i-1].x; k>a[i].x; --k) ans[j++]='L';
		for(s64 k=a[i-1].y; k<a[i].y; ++k) ans[j++]='U';
		for(s64 k=a[i-1].y; k>a[i].y; --k) ans[j++]='D';
		while(j<a[i].t) ans[j++]='L', ans[j++]='R';
	}
	ans[l]=0;
	puts(ans);
	return 0;
}

#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }

const int MAXLEN=2000000;
const int MAXPOS=200000;
const int MAXN=MAXPOS+2;

typedef struct P { ll x,y,p,q; } P;
bool operator<(const P &a,const P &b) { return a.q<b.q; }

int npos,len;
ll x[MAXPOS],y[MAXPOS],t[MAXPOS];

int n;
P p[MAXN];
void createp(ll ct,ll cx,ll cy) { ll cp=ct/len,cq=ct%len; p[n].x=cx,p[n].y=cy,p[n].p=cp,p[n].q=cq; ++n; }

ll bound[4];

ll divdown(ll a,ll b) {
	if(b<0) a=-a,b=-b;
	return a>=0?a/b:(a-b+1)/b;
}
void createcond(int type,ll mult,ll lim) {
	ll cbound=divdown(lim,mult);
	if(cbound<bound[type]) {
		bound[type]=cbound;
		//if(type==0) printf("(%cdx%cdy)%lld<=%lld\n",type/2==0?'+':'-',type%2==0?'+':'-',mult,lim);
	}
}

char ret[MAXLEN+1];

void run() {
	scanf("%d%d",&npos,&len); REP(i,npos) scanf("%I64d%I64d%I64d",&t[i],&x[i],&y[i]);// REP(i,npos) cin>>t[i]>>x[i]>>y[i];

	n=0; createp(0,0,0); createp(0,0,0); p[n-1].p=-1,p[n-1].q=len; REP(i,npos) createp(t[i],x[i],y[i]); sort(p,p+n);
	//printf("at %lld*len+%lld: (%lld,%lld)\n",p[0].p,p[0].q,p[0].x,p[0].y);

	REP(i,4) bound[i]=LLONG_MAX;
	REP(i,n-1) {
		ll dx=p[i+1].x-p[i].x,dy=p[i+1].y-p[i].y,dp=p[i+1].p-p[i].p,dq=p[i+1].q-p[i].q;
		// 0=dx+dy<=b/a, 1=dx-dy<=b/a, 2=-dx+dy<=b/a, 3=-dx-dy<=b/a
		//printf("at %lld*len+%lld: (%lld,%lld)\n",p[i+1].p,p[i+1].q,p[i+1].x,p[i+1].y);
		if(dp==0) continue;
		createcond(dp>0?3:0,abs(dp),dq-dx-dy);
		createcond(dp>0?1:2,abs(dp),dq+dx-dy);
		createcond(dp>0?2:1,abs(dp),dq-dx+dy);
		createcond(dp>0?0:3,abs(dp),dq+dx+dy);
	}
	//REP(type,4) printf("%cdx%cdy<=%lld\n",type/2==0?'+':'-',type%2==0?'+':'-',bound[type]);
	//printf("%lld<=dx+dy<=%lld\n%lld<=dx-dy<=%lld\n",-bound[3],bound[0],-bound[2],bound[1]);

	for(ll ds=-bound[3];ds<=bound[0]&&ds<=-bound[3]+3;++ds) for(ll dt=-bound[2];dt<=bound[1]&&dt<=-bound[2]+3;++dt) {
		if((ds+dt)%2!=0) continue;
		ll DX=(ds+dt)/2,DY=(ds-dt)/2; bool ok=true; int at=0;
		//printf("testing %lld,%lld\n",DX,DY);
		REP(i,n-1) {
			ll dx=p[i+1].x-p[i].x,dy=p[i+1].y-p[i].y,dp=p[i+1].p-p[i].p,dq=p[i+1].q-p[i].q;
			ll cx=dx-dp*DX,cy=dy-dp*DY;
			ll acx=abs(cx),acy=abs(cy);
			if(acx+acy>dq) { ok=false; break; }
			if((acx+acy)%2!=dq%2) { ok=false; break; }
			REP(j,acx) ret[at++]=cx<0?'L':'R';
			REP(j,acy) ret[at++]=cy<0?'D':'U';
			REP(j,dq-acx-acy) ret[at++]=j%2==0?'L':'R';
		}
		if(!ok) continue;
		ret[at++]='\0';
		//printf("ok %d\n",at);
		printf("%s\n",ret); return;
	}
	printf("NO\n");
}

int main() {
	run();
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) FAIL();
	if(delt==0) return;
	ll l=-p-x,r=p-x; db 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]]);
	}
	ll 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;
		ll 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.PB(d);
		if(len<0||(len&1)) FAIL();
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('D'),r-=2;
}

vector<int> ax,ay;
int main() {
//	freopen("a.in","r",stdin);
	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;
			}
			ll 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.PB(i);
		pos.PB(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;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb emplace_back
#define mp make_pair
#define pair pair<int, int>
#define fi first
#define se second

template <class t>
inline void read(t & res)
{
	char ch; bool fl = 0; res = 0;
	while (ch = getchar(), ch != '-' && !isdigit(ch));
	ch == '-' ? fl = 1 : res = ch ^ 48;
	while (ch = getchar(), isdigit(ch))
	res = res * 10 + (ch ^ 48);
	fl ? res = ~res + 1 : 0;
}

const int e = 2e5 + 5, o = 2e6 + 5;

struct point
{
	ll x, y, a, b;
}p[e];
ll lx, rx, ly, ry;
int n, L, c[o], d[o];

inline void relax(ll &x, ll a, ll b)
{
	ll c = a / b;
	if (a % b == 0) x = max(x, c);
	else x = max(x, c + (c > 0));
}

inline void tense(ll &x, ll a, ll b)
{
	ll c = a / b;
	if (a % b == 0) x = min(x, c);
	else x = min(x, c + (c < 0));
}

inline bool cmp(const point &a, const point &b)
{
	return a.a < b.a;
}

inline void nie()
{
	puts("NO");
	exit(0);
}

int main()
{
/*	for (int i = 0; i <= 999; i++)
	if ((i * 10010 + 1) % 2000000 <= 2001) cout << "i = "
	<< i << " mod = " << (i * 10010 + 1) % 2000000 << endl; */
	read(n); read(L);
	lx = ly = 0; rx = ry = L;
	int i, j;
	ll t, x, y;
	for (i = 1; i <= n; i++)
	{
		read(t); read(x); read(y);
		p[i].x = x + y; p[i].y = x - y;
		p[i].a = t % L; p[i].b = t / L;
		if (p[i].x + p[i].a + p[i].b * L & 1) nie();
		if (p[i].x + p[i].y & 1) nie();
	}
	sort(p + 1, p + n + 1, cmp);
	for (i = 1; i <= n; i++)
	{
		ll la = 0, lb = 0, ra = 2 * (p[i].a - p[i - 1].a), rb = ra,
		   dx = p[i].x + p[i].a - p[i - 1].x - p[i - 1].a + (p[i].b - p[i - 1].b) * L,
		   dy = p[i].y + p[i].a - p[i - 1].y - p[i - 1].a + (p[i].b - p[i - 1].b) * L,
		   k = 2 * (p[i - 1].b - p[i].b);
		la -= dx; ra -= dx; lb -= dy; rb -= dy;
		if (!k)
		{
			if (max(la, ra) < 0 || min(la, ra) > 0) nie();
			if (max(lb, rb) < 0 || min(lb, rb) > 0) nie();
			continue;
		}
		if (k < 0) swap(la, ra), swap(lb, rb);
		relax(lx, la, k); tense(rx, ra, k);
		relax(ly, lb, k); tense(ry, rb, k);

		if (i == n)
		{
			la = lb = 0; ra = rb = 2 * (L - p[i].a);
			k = 2 * p[i].b + 2;
			dx = p[i].x + p[i].a + p[i].b * L;
			dy = p[i].y + p[i].a + p[i].b * L;
			la += dx; ra += dx; lb += dy; rb += dy;
			relax(lx, la, k); tense(rx, ra, k);
			relax(ly, lb, k); tense(ry, rb, k);
		}
	}
	if (lx > rx || ly > ry) nie();
	c[L] = lx; d[L] = ly;

	n++; p[n].a = L;
	int nx = 0, ny = 0;
	for (i = 1; i <= n; i++)
	{
		int a0 = p[i - 1].a, a1 = p[i].a;
		if (a0 == a1) continue;
		if (i != n)
		{
			c[a1] = p[i].x + p[i].a + p[i].b * L - 2 * p[i].b * c[L] >> 1;
			d[a1] = p[i].y + p[i].a + p[i].b * L - 2 * p[i].b * d[L] >> 1;
		}
		int c1 = c[a1] - c[a0], d1 = d[a1] - d[a0],
			c0 = a1 - a0 - c1, d0 = a1 - a0 - d1;
		bool fx, fy;
		for (j = a0 + 1; j <= a1; j++)
		{
			fx = (j - a0 <= c0);
			fy = (j - a0 <= d0);
			if (fx && fy) putchar('L');
			else if (!fx && !fy) putchar('R');
			else if (fx) putchar('D');
			else putchar('U');
		}
	}
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){x+y,y-x,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
		rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0L*(x-r)/k)); rx = min(rx,(LL)floor(1.0L*(x+r)/k)); ly = max(ly,(LL)ceil(1.0L*(y-r)/k)); ry = min(ry,(LL)floor(1.0L*(y+r)/k));}
			else {lx = max(lx,(LL)ceil(1.0L*(x+r)/k)); rx = min(rx,(LL)floor(1.0L*(x-r)/k)); ly = max(ly,(LL)ceil(1.0L*(y+r)/k)); ry = min(ry,(LL)floor(1.0L*(y-r)/k));}
		}
		if ((lx^m)&1) ++lx; if ((ly^m)&1) ++ly; if (lx > rx || ly > ry) {puts("NO"); return;}
		rep(i,1,n) {
			LL k = p[i].k-p[i-1].k,x = p[i].x-p[i-1].x-k*lx,y = p[i].y-p[i-1].y-k*ly;
			rep(j,p[i-1].r+1,p[i].r) {if (x > 0) {--x; if (y > 0) {--y; putchar('U');} else {++y; putchar('R');}} else {++x; if (y > 0) {--y; putchar('L');} else {++y; putchar('D');}}}
		}
	}
}
int main() {qiqi::main(); return 0;}

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int MAXL = 2e6 + 5;
const long long INF = 4e18;
typedef long long ll;
template <typename T> T abs(T x) {if (x <= 0) return -x; else return x; }
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, l; bool vis[MAXL];
ll t[MAXN], x[MAXN], y[MAXN];
pair <ll, ll> px[MAXL], py[MAXL];
ll solve(pair <ll, ll> x, pair <ll, ll> y) {
	if ((y.first - x.first) % (y.second - x.second) == 0)
		return (y.first - x.first) / (y.second - x.second);
	puts("NO"), exit(0);
	return -1;
}
ll Ceil(ll x, ll y) {
	ll tmp = INF / y;
	return (x + tmp * y) / y - tmp + 1;
}
ll Round(ll x, ll y) {
	ll tmp = INF / y;
	return (x + tmp * y) / y - tmp;
}
pair <ll, ll> calc(pair <ll, ll> x, pair <ll, ll> y, ll k) {
	if (y.second == x.second) {
		ll delta = abs(x.first - y.first);
		if (delta <= k) return make_pair(-l, l);
		else return make_pair(INF, -INF);
	}
	if (y.second < x.second) swap(x, y);
	ll coef = y.second - x.second, delta = y.first - x.first;
	ll Min = delta - k, Max = delta + k; pair <ll, ll> ans;
	if (Min % coef == 0) ans.first = Min / coef;
	else ans.first = Ceil(Min, coef);
	if (Max % coef == 0) ans.second = Max / coef;
	else ans.second = Round(Max, coef);
	return ans;
}
int main() {
	read(n), read(l);
	pair <ll, ll> limx, limy;
	limx = limy = make_pair(-l, l);
	vis[0] = true;
	for (int i = 1; i <= n; i++) {
		read(t[i]), read(x[i]), read(y[i]);
		ll tx = x[i] + y[i], ty = x[i] - y[i];
		x[i] = tx, y[i] = ty;
		if (abs(x[i]) % 2 != t[i] % 2 || abs(y[i]) % 2 != t[i] % 2) {
			puts("NO");
			return 0;
		}
		ll Mod = t[i] % l, Div = t[i] / l;
		if (vis[Mod]) {
			chkmax(limx.first, solve(px[Mod], make_pair(x[i], Div)));
			chkmin(limx.second, solve(px[Mod], make_pair(x[i], Div)));
			chkmax(limy.first, solve(py[Mod], make_pair(y[i], Div)));
			chkmin(limy.second, solve(py[Mod], make_pair(y[i], Div)));
		} else {
			vis[Mod] = true;
			px[Mod] = make_pair(x[i], Div);
			py[Mod] = make_pair(y[i], Div);
		}
	}
	vis[l] = true, px[l] = py[l] = make_pair(0, -1);
	for (int i = 1, last = 0; i <= l; i++)
		if (vis[i]) {
			pair <ll, ll> tmp;
			tmp = calc(px[last], px[i], i - last);
			chkmax(limx.first, tmp.first);
			chkmin(limx.second, tmp.second);
			tmp = calc(py[last], py[i], i - last);
			chkmax(limy.first, tmp.first);
			chkmin(limy.second, tmp.second);
			last = i;
		}
	if (abs(limx.first) % 2 != l % 2) limx.first++;
	if (abs(limy.first) % 2 != l % 2) limy.first++;
	if (limx.first > limx.second || limy.first > limy.second) {
		puts("NO");
		return 0;
	}
	ll sumx = limx.first, sumy = limy.first;
	static bool ansx[MAXL], ansy[MAXL];
	for (int i = 1, last = 0; i <= l; i++)
		if (vis[i]) {
			ll now, goal;
			now = px[last].first - px[last].second * sumx;
			goal = px[i].first - px[i].second * sumx;
			for (int j = last + 1; j <= i; j++)
				if (now <= goal) {
					ansx[j] = true;
					now++;
				} else now--;
			assert(now == goal);
			now = py[last].first - py[last].second * sumy;
			goal = py[i].first - py[i].second * sumy;
			for (int j = last + 1; j <= i; j++)
				if (now <= goal) {
					ansy[j] = true;
					now++;
				} else now--;
			assert(now == goal);
			last = i;
		}
	for (int i = 1; i <= l; i++) {
		if (ansx[i]) {
			if (ansy[i]) putchar('R');
			else putchar('U');
		} else {
			if (ansy[i]) putchar('D');
			else putchar('L');
		}
	}
	puts("");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
inline long long readl()
{
	long long ret=0;
	int f=1;
	char ch=getchar();
	while(ch>'9'||ch<'0')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		ret=(ret<<1)+(ret<<3)+ch-'0';
		ch=getchar();
	}
	return ret*f;
}
const int N=2000005;
int n,l[N],r[N],len;
long long t,x,y,nx,ny;
struct node
{
	long long ty,tz,x;
	node(){} node(long long A,long long B,long long C){ty=A;tz=B;x=C;}
}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
long long ceil(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
    if(x==0)
		return 0;
    if(y>0)
		return (x-1)/y+1;
    else
		return x/y;
}
long long floor(long long x,long long y)
{
    if(x<0)
	{
		x=-x;
		y=-y;
	}
	if(x==0)
		return 0;
    if(y>0)
		return x/y;
    else
		return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
    sort(a+1,a+n+1);
    long long L=0,R=len;
    a[n+1]=node(len,-1,0);//设置边界!!!
    for(register int i=0;i<=n;i++)//要统计入最后一个限制S[len]=0-S*(-1)
    {
        long long d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
        if(p>0)
        {
            L=max(L,ceil(-q,p));
            R=min(R,floor(d-q,p));
        }
		else if(p<0)
		{
            L=max(L,ceil(d-q,p));
            R=min(R,floor(-q,p));
        }
        if(L>R||p==0&&(q<0||q>d))
		{
			puts("NO");
			exit(0);
		}
    }
    long long s=L,si=0;
    for(register int i=0,j=1;i<=n;i++)
    {
        si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
        while(si--)
			ans[j++]=1;
        j=a[i+1].ty+1;//a[i+1]而不是a[i]
    }
}
int main()
{
    n=read();
	len=read();
    for(register int i=1;i<=n;i++)
    {
		t=readl();
		x=readl();
		y=readl();
        nx=x+y+t;
		ny=x-y+t;
        if(nx&1)
		{
			puts("NO");
			return 0;
		}
        nx/=2;
		ny/=2;
        a[i]=node(t%len,t/len,nx);
        b[i]=node(t%len,t/len,ny);
    }
    solve(a,l);
    solve(b,r);
    for(register int i=1;i<=len;i++)
		printf("%c","LDUR"[l[i]<<1|r[i]]);
    return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
int tt;
struct Node{LL a, b, c;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (int)ceil(l - eps));
	R = min(R, (int)floor(r + eps));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if((pos[ty][i] - ord[to].b) % (ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			vis[m - 1] = 1;
			ord[m - 1] = (Node){0, tem};
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	L = ord[m - 1].b; R = ord[m - 1].b;
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	ord[m - 1].c = ord[m - 1].b;
	/*if(tt == 146){
		cout << L << " " << R << endl;
		cout << ord[0].a << " " << ord[0].b << endl;
		cout << ord[2000].a << " " << ord[2000].b << endl;
		cout << ord[4000].a << " " << ord[4000].b << endl;
		cout << ord[6000].a << " " << ord[6000].b << endl;
	}*/
	LL tem = ord[m - 1].c, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1) ord[i].c = tem * ord[i].a + ord[i].b;
		if((ord[i].c - ord[pre == -1 ? m : pre].c + i - pre) % 2) break;
		LL tem1 = (ord[i].c - ord[pre == -1 ? m : pre].c + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
		if(i == m - 1) return;
	}
	if(tem + 1 >= L && tem + 1 <= R){
		memset(a[ty], 0, sizeof a[ty]);
		tem = ++ord[m - 1].c; pre = -1;
		For(i, 0, m - 1) if(vis[i]){
			if(i != m - 1) ord[i].c = tem * ord[i].a + ord[i].b;
			if((ord[i].c - ord[pre == -1 ? m : pre].c + i - pre) % 2){fl = 0; return;}
			LL tem1 = (ord[i].c - ord[pre == -1 ? m : pre].c + i - pre) / 2;
			if(tem1 > i - pre){fl = 0; return;}
			For(j, pre + 1, pre + tem1) a[ty][j] = 1;
			pre = i;
		}
	}
	else fl = 0;
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		if(i == 2) tt = y;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int ll;

ll n,l;
ll t[5000000];

struct elem {
  ll tmod;
  ll pos;
  ll tdiv;
  elem() {
  }
  elem(ll intmod,ll inpos,ll intdiv) {
    tmod=intmod;pos=inpos;tdiv=intdiv;
  }
};

bool operator<(elem e1,elem e2)
{
  return e1.tmod<e2.tmod;
}
/*
ll divdown(ll a,ll b)
{
  if (a>=0) return a/b;
  return a/b-(a%b!=0);
}

ll divup(ll a,ll b)
{
  if (a>=0) return a/b+(a%b!=0);
  return a/b;
}
*/

ll divdown(ll x, ll y) {
    if (x >= 0) return x / y;
    return x / y - (x % y ? 1 : 0);
}

ll divup(ll x, ll y) {
    if (x >= 0) return (x + y - 1) / y;
    return x / y;
}

void soluciona(ll pos[5000000],int sol[5000000])
{
  /*
  cout<<"soluciona"<<endl;
  for (int i=0;i<n;i++)
    cout<<pos[i]<<",";
  cout<<endl;
  */
  vector<elem> v;
  v.push_back(elem(0,0,0));
  v.push_back(elem(l,0,-1));
  for (int i=0;i<n;i++)
    v.push_back(elem(t[i]%l,pos[i],t[i]/l));
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  sort(v.begin(),v.end());
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  ll inf=0;
  ll sup=l;
  /*
  if (v[0].tdiv) {
    sup=min(sup,divdown(v[0].pos,v[0].tdiv));
    inf=max(inf,divup(v[0].pos-v[0].tmod,v[0].tdiv));
  } else if (not (0<=v[0].pos and v[0].pos<=v[0].tmod)) {
    cout<<"NO"<<endl;
    exit(0);
  }
  */
  for (int i=1;i<int(v.size());i++) {
    ll rpos=v[i].pos-v[i-1].pos;
    ll rdiv=-(v[i].tdiv-v[i-1].tdiv);
    ll rmod=v[i].tmod-v[i-1].tmod;
    ll lh=-rpos;
    ll rh=rmod-rpos;
    if (rdiv<0) {
      rdiv=-rdiv;
      lh=-lh;
      rh=-rh;
      swap(lh,rh);
    }
    if (rdiv) {
      sup=min(sup,divdown(rh,rdiv));
      inf=max(inf,divup(lh,rdiv));
    } else if (not (lh<=0 and 0<=rh)) {
      cout<<"NO"<<endl;
      exit(0);
    }
    /*
    if (rdiv) {
      if (rdiv>0) {
	sup=min(sup,divdown(rpos,rdiv));
	inf=max(inf,divup(rpos-rmod,rdiv));
      } else {
	inf=max(inf,divup(rpos,rdiv));
	sup=min(sup,divdown(rpos-rmod,rdiv));
      }
    } else if (not (0<=rpos and rpos<=rmod)) {
      cout<<"NO"<<endl;
      exit(0);
    }
    */
  }
  if (inf>sup) {
    cout<<"NO"<<endl;
    exit(0);
  }
  //cout<<inf<<","<<sup<<endl;
  ll total=inf;
  ll unosant=0;
  for (int i=0;i<int(v.size());i++) {
    ll unos=v[i].pos-v[i].tdiv*total;
    for (int j=0;j<unos-unosant;j++)
      sol[v[i].tmod-1-j]=1;
    unosant=unos;
  }
  /*
  ll unos=total;
  for (int j=0;j<unos-unosant;j++)
    sol[l-1-j]=1;
  */
  /*
  cout<<"solucion:"<<endl;
  for (int i=0;i<n;i++)
    cout<<sol[i];
  cout<<endl;
  */
}

ll pos[2][5000000];
int sol[2][5000000];

int main()
{
  ios::sync_with_stdio(false);
  cin>>n>>l;
  for (int i=0;i<n;i++) {
    ll x,y;
    cin>>t[i]>>x>>y;
    if ((t[i]+x+y)%2) {
      cout<<"NO"<<endl;
      exit(0);
    }
    pos[0][i]=(t[i]+x+y)/2;
    pos[1][i]=(t[i]+x-y)/2;
  }
  soluciona(pos[0],sol[0]);
  soluciona(pos[1],sol[1]);
  string s;
  for (int i=0;i<l;i++) {
    if (sol[0][i] and sol[1][i]) s+="R";
    else if (sol[0][i] and not sol[1][i]) s+="U";
    else if (not sol[0][i] and sol[1][i]) s+="D";
    else if (not sol[0][i] and not sol[1][i]) s+="L";
  }
  cout<<s<<endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
//#define LL2 __int128
typedef long long LL2;

LL fl(LL a, LL r){
    if(a % r == 0) return a/r;
    if(a > 0) return a/r;
    if(a < 0) return (-((-a)/r)-1);
}

LL cl(LL a, LL r){
    if(a % r == 0) return a/r;
    return fl(a,r) + 1;
}

int main(){
    LL n, l;
    scanf("%lld%lld", &n, &l);
    vector<LL> st(n+1), sx(n+1), sy(n+1);
    st[0] = sx[0] = sy[0] = 0;
    for(int i = 0; i < n; i++){
        scanf("%lld%lld%lld", &st[i+1], &sx[i+1], &sy[i+1]);
        if((st[i+1] + sx[i+1] + sy[i+1]) % 2 == 1){
            cout << "NO" << endl;
            return 0;
        }
        if(abs(sx[i+1]) + abs(sy[i+1]) > st[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    vector<pair<LL,LL> > tlist;
    for(int i = 0; i < st.size(); i++){
        tlist.push_back(make_pair(st[i] % l, i));
    }
    sort(tlist.begin(), tlist.end());
    vector<LL> t, x, y, r;
    for(int i = 0; i < tlist.size(); i++){
        int a = tlist[i].second;
        t.push_back(st[a] % l);
        x.push_back(sx[a]);
        y.push_back(sy[a]);
        r.push_back(- (st[a]/l));
    }
    t.push_back(l); x.push_back(0); y.push_back(0); r.push_back(1);
    LL2 pmin = -l*2;
    LL2 pmax = l*2;
    LL2 qmin = -l*2;
    LL2 qmax = l*2;
    int ok = 1;
    for(int i = 0; i + 1 < t.size(); i++){
        LL2 dx = x[i+1] - x[i];
        LL2 dy = y[i+1] - y[i];
        LL2 dt = t[i+1] - t[i];
        LL2 dr = r[i+1] - r[i];
        if(dr == 0){
            if(abs((LL)dx) + abs((LL)dy) > dt) ok = 0;
            continue;
        }
        if(dr < 0){
            dr = -dr;
            dx = -dx;
            dy = -dy;
        }
        while(pmax >= pmin && pmax > fl(dt - dx - dy, dr) ) pmax--;
        while(pmax >= pmin && pmin < cl(-dt - dx - dy, dr) ) pmin++;
        while(qmax >= qmin && qmax > fl(dt - dx + dy, dr) ) qmax--;
        while(qmax >= qmin && qmin < cl(-dt - dx + dy, dr) ) qmin++;
    }
    while((pmin + l) % 2 != 0) pmin++;
    while((qmin + l) % 2 != 0) qmin++;
    while((pmax + l) % 2 != 0) pmax--;
    while((qmax + l) % 2 != 0) qmax--;
    if(pmin > pmax || qmin > qmax || !ok){
        cout << "NO" << endl;
        return 0;
    }
    LL c = (pmin + qmin)/2;
    LL d = (pmin - qmin)/2;
    for(int i = 0; i < t.size(); i++){
        x[i] += r[i] * c;
        y[i] += r[i] * d;
    }
    string ans;
    for(int i = 0; i + 1 < t.size(); i++){
        LL dt = t[i+1] - t[i];
        LL dx = x[i+1] - x[i];
        LL dy = y[i+1] - y[i];
        dt -= (abs(dx)) + (abs(dy));
        if(dy > 0) for(LL z = 0; z < dy; z++) ans += 'U';
        if(dy < 0) for(LL z = 0; z < -dy; z++) ans += 'D';
        if(dx > 0) for(LL z = 0; z < dx; z++) ans += 'R';
        if(dx < 0) for(LL z = 0; z < -dx; z++) ans += 'L';
        for(int j = 0; 2*j < dt; j++) ans += "DU";
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
#define FOR(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

struct event { long long phase, rep, p, q; };
bool operator<(const event& a, const event& b) { return a.phase < b.phase; }

long long N, L;
vector<event> events;

inline bool parity(const long long& x) { return x & 1; }

void nope() {
  printf("NO\n");
  exit(0);
}

long long ceil_div(const long long& n, const long long& d) {
  long long q = n / d;
  return (q * d < n) ? (q + 1) : q;
}

long long floor_div(const long long& n, const long long& d) {
  long long q = n / d;
  return (q * d > n) ? (q - 1) : q;
}

int main() {
  scanf("%I64d%I64d", &N, &L);
  FOR (i, N) {
    long long t, x, y;
    scanf("%I64d%I64d%I64d", &t, &x, &y);
    if (parity(t) != parity(x + y)) nope();
    events.push_back(event { t % L, t / L, x + y, x - y });
  }
  events.push_back(event { 0, 0,  0, 0 });
  events.push_back(event { L, -1, 0, 0 });
  sort(events.begin(), events.end());
  N += 2;

  long long minp = -L, maxp = L, minq = -L, maxq = L;
  FOR (i, N - 1) {
    event *a = &events[i], *b = &events[i + 1];
    if (a->rep > b->rep) swap(a, b);

    long long dphase = b->phase - a->phase, drep = b->rep - a->rep;
    long long dp = b->p - a->p, dq = b->q - a->q;
    if (drep == 0) {
      if (abs(dp) > abs(dphase) || abs(dq) > abs(dphase)) nope();
    } else {
      minp = max(minp, ceil_div(dp - abs(dphase), drep));
      minq = max(minq, ceil_div(dq - abs(dphase), drep));
      maxp = min(maxp, floor_div(dp + abs(dphase), drep));
      maxq = min(maxq, floor_div(dq + abs(dphase), drep));
    }
  }

  if (parity(minp) != parity(L)) ++minp;
  if (parity(minq) != parity(L)) ++minq;
  if (parity(maxp) != parity(L)) --maxp;
  if (parity(maxq) != parity(L)) --maxq;

  if (minp > maxp || minq > maxq) nope();

  FOR (i, N) {
    events[i].p -= minp * events[i].rep;
    events[i].q -= minq * events[i].rep;
  }

  FOR (i, N - 1) {
    event &a = events[i], &b = events[i + 1];
    if (a.phase != b.phase) {
      int dx = ((b.p + b.q) - (a.p + a.q)) / 2;
      int dy = ((b.p - b.q) - (a.p - a.q)) / 2;
      int dt = b.phase - a.phase;
      for (; dx > 0; --dx) printf("R"), --dt;
      for (; dx < 0; ++dx) printf("L"), --dt;
      for (; dy > 0; --dy) printf("U"), --dt;
      for (; dy < 0; ++dy) printf("D"), --dt;
      while (dt > 0) printf("RL"), dt -= 2;
    }
  }

  printf("\n");

  return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) {
		if(curtest) cout<<"FUCK:"<<delt*m+p<<' '<<x<<endl;
		FAIL();
	}
	if(delt==0) return;
	ll l=-p-x,r=p-x; db 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);
//	cout<<"bound:"<<lb<<' '<<rb<<endl;
}
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,(db)val[pos[i]]-(m-pos[i]));
			rb=min(rb,(db)val[pos[i]]+(m-pos[i]));
		}
	}
//	if(curtest) printf("BOUND:%.10Lf %.10Lf\n",lb,rb);

	ll 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;
		ll 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.PB(d);
		if(len<0||(len&1)) {
			if(curtest) printf("FUCK2: %d %d %d %lld %lld\n",l,r,len,(r==m?dx:val[r])-val[l]-(ti[r]-ti[l])*dx,x);
			FAIL();
		}
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('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;
			}
			ll 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(n==99&&m==101&&v[2].t==1&&v[2].x==4&&v[2].y==-5) curtest=1;
//	if(n==200000&&m==2000000&&v[3].x==0&&v[3].y==1) curtest=1;
//	if(n==1000&&m==2000000) curtest=1;
//	curtest=1;

//	if(curtest) cout<<"flg="<<flg<<endl;

	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.PB(i);
		pos.PB(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;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define Rep(i,u) for(int i=head[u];i;i=Next[i])
#define clr(a) memset(a,0,sizeof a)
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
ll pp=1000000007;
ll mo(ll a,ll pp){if(a>=0 && a<pp)return a;a%=pp;if(a<0)a+=pp;return a;}
ll powmod(ll a,ll b,ll pp){ll ans=1;for(;b;b>>=1,a=mo(a*a,pp))if(b&1)ans=mo(ans*a,pp);return ans;}
ll read(){
	ll ans=0;
	char last=' ',ch=getchar();
	while(ch<'0' || ch>'9')last=ch,ch=getchar();
	while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
	if(last=='-')ans=-ans;
	return ans;
}
//head
#define N 2100000
ll n,l,tim[N],X[N],Y[N],c[N];
struct node{
	ll x,t,z;
}a[N];
bool cmp(node a,node b){
	return a.t<b.t;
}
bool p[N];
int rec1[N],rec2[N];
bool work(int *rec,int L,int R,ll tot){
	while(L<=R){
		if(tot<=0)rec[L]=1,++tot;
		else rec[L]=-1,--tot;
		++L;
	}
	return tot==0;
}
bool solved(ll s,int *rec){
//	cout<<s<<endl;
	rep(i,0,l)p[i]=0;
	c[0]=0;p[0]=1;
	c[l]=s;p[l]=1;
	rep(i,0,n){
		p[a[i].t]=1;
		c[a[i].t]=a[i].x-a[i].z*s;
	}
//	rep(i,0,l)
//		if(p[i])printf("%d %I64d\n",i,c[i]);
	int t=0;
	rep(i,1,l)
		if(p[i]){
			ll del=c[t]-c[i];
		//	cout<<del<<" "<<t+1<<" "<<i<<endl;
			if(!work(rec,t+1,i,del))return 0;
			t=i;
		}
	return 1;
}
bool check(int *rec){
	sort(a,a+n+1,cmp);
	bool pf=0;
	ll s;
	rep(i,0,n-1)
		if(a[i].t==a[i+1].t){
			ll t1=a[i+1].x-a[i].x,t2=a[i+1].z-a[i].z;
			if(t1%t2)return 0;
			t1/=t2;
			if(!pf){
				s=t1;
				pf=1;
				}
			else
			if(s!=t1)return 0;
		}
	if(pf)return solved(s,rec);
	rep(i,0,n-1)
		if((mo(a[i+1].x-a[i].x,2)+mo(a[i+1].t-a[i].t,2)+l%2*(abs(a[i].z-a[i+1].z)%2))%2==1)return 0;
	ll L=-1LL<<60,R=1LL<<60;
//	rep(i,0,n)printf("%I64d %I64d %I64d\n",a[i].t,a[i].x,a[i].z);
	rep(i,0,n-1)
		if(a[i].z!=a[i+1].z){
			ll t1=(a[i+1].t-a[i].t+a[i+1].x-a[i].x)/(a[i+1].z-a[i].z);
			ll t2=(a[i].t-a[i+1].t+a[i+1].x-a[i].x)/(a[i+1].z-a[i].z);
			if(t1>t2)swap(t1,t2);
		//	printf("%I64d %I64d\n",t1,t2);
			L=max(t1,L);
			R=min(R,t2);
		//	printf("   %I64d %I64d\n",L,R);
		}
	ll t1=(l-a[n].t+a[n].x)/(a[n].z+1);
	ll t2=(a[n].t-l+a[n].x)/(a[n].z+1);
	if(t1>t2)swap(t1,t2);
//	printf("%I64d %I64d\n",t1,t2);
	L=max(t1,L);
	R=min(R,t2);
	if(mo(L,2)!=l%2)++L;
	if(mo(R,2)!=l%2)--R;
	if(L>R)return 0;
	return solved(L,rec);
}
int main(){
	n=read();l=read();
	rep(i,1,n){
		tim[i]=read();
		X[i]=read();
		Y[i]=read();
	}
	rep(i,0,n){
		a[i].t=tim[i]%l;
		a[i].z=tim[i]/l;
		a[i].x=X[i]+Y[i];
	}
//	rep(i,0,n)printf("%I64d %I64d %I64d\n",a[i].t,a[i].z,a[i].x);
	if(!check(rec1)){
		printf("NO\n");
		return 0;
	}
	rep(i,0,n){
		a[i].t=tim[i]%l;
		a[i].z=tim[i]/l;
		a[i].x=X[i]-Y[i];
	}
	if(!check(rec2))printf("NO\n");
	else{
		rep(i,1,l){
			if(rec1[i]==1 && rec2[i]==1)printf("R");
			if(rec1[i]==-1 && rec2[i]==-1)printf("L");
			if(rec1[i]==1 && rec2[i]==-1)printf("U");
			if(rec1[i]==-1 && rec2[i]==1)printf("D");
		}
	}
	return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
const int N = 200054, MAXL = 2000054;
const char mask[4] = {76, 85, 68, 82};

int n, T;
int ansX[MAXL], ansY[MAXL];
ll buf[MAXL];

struct node {
	ll period, pos; int phase;
	node (ll _t = 0, ll _pos = 0) : period(_t / T), pos(_pos), phase(_t % T) {}
	inline bool operator < (const node &B) const {return phase < B.phase || (phase == B.phase && period < B.period);}
} gX[N], gY[N];

inline void up(ll &x, const ll y) {x < y ? x = y : 0;}
inline void down(ll &x, const ll y) {x > y ? x = y : 0;}

inline ll fd(ll x, ll y) {auto r = lldiv(x, y); return r.quot + (r.rem >> 63);}
inline ll cd(ll x, ll y) {auto r = lldiv(x, y); return r.quot + (r.rem > 0);}

bool solve(node *g, int *ans) {
	int i, la = 0, cur; ll dT, dt, ds, inf = 0, sup = T, incr;
	g[n].period = -1, g[n].phase = T, g[n].pos = 0;
	std::sort(g, g + (n + 1));
	for (i = 1; i <= n && inf <= sup; ++i) {
		dT = g[i].period - g[i - 1].period;
		dt = g[i].phase - g[i - 1].phase;
		ds = g[i].pos - g[i - 1].pos;
		if (!dT) {
			if (ds < 0 || ds > dt) return false;
		} else if (dT > 0) {
			if (ds < 0) return false;
			up(inf, cd(ds - dt, dT)), down(sup, fd(ds, dT));
		} else {
			if (ds > 0) return false;
			up(inf, cd(-ds, -dT)), down(sup, fd(-ds + dt, -dT));
		}
	}
	if (inf > sup) return false;
	incr = (inf + sup) >> 1, *buf = 0;
	for (i = 0; i <= n; ++i, la = cur) {
		cur = g[i].phase;
		buf[cur] = g[i].pos - incr * g[i].period;
		assert(0 <= buf[cur] - buf[la] && buf[cur] - buf[la] <= cur - la);
		auto mid = buf + cur - int(buf[cur] - buf[la]);
		std::fill(buf + la, mid, buf[la]);
		std::iota(mid, buf + cur, buf[la]);
	}
	return std::adjacent_difference(buf + 1, buf + (T + 1), ans), true;
}

int main() {
	int i; ll t, x, y;
	scanf("%d%d", &n, &T), ++n;
	for (i = 1; i < n; ++i) {
		scanf("%lld%lld%lld", &t, &x, &y);
		if ((t ^ x ^ y) & 1) return puts("NO"), 0;
		gX[i] = node(t, (t + x + y) / 2);
		gY[i] = node(t, (t + x - y) / 2);
	}
	if (!(solve(gX, ansX) && solve(gY, ansY))) return puts("NO"), 0;
	for (i = 0; i < T; ++i) putchar(mask[ansX[i] | ansY[i] << 1]);
	return putchar(10), 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){(x+y+t)>>1,(y-x+t)>>1,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
			rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0L*(x-r)/k)); rx = min(rx,(LL)floor(1.0L*x/k)); ly = max(ly,(LL)ceil(1.0L*(y-r)/k)); ry = min(ry,(LL)floor(1.0L*y/k));}
			else {lx = max(lx,(LL)ceil(1.0L*x/k)); rx = min(rx,(LL)floor(1.0L*(x-r)/k)); ly = max(ly,(LL)ceil(1.0L*y/k)); ry = min(ry,(LL)floor(1.0L*(y-r)/k));}
		}
		if (lx > rx || ly > ry) {puts("NO"); return;} rep(i,1,n) {
			int k = p[i].k-p[i-1].k,x = p[i].x-p[i-1].x-k*lx,y = p[i].y-p[i-1].y-k*ly;
			rep(j,p[i-1].r+1,p[i].r) {if (x > 0) {--x; if (y > 0) {--y; putchar('U');} else putchar('R');} else {if (y > 0) {--y; putchar('L');} else putchar('D');}}
		}
	}
}
int main() {qiqi::main(); return 0;}

/*---Author:HenryHuang---*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
ll n,l;
ll lx=-(4e18),rx=(4e18),ly=-(4e18),ry=(4e18);
struct point{
	ll t,x,y,k;
	ll w;
	void read(){
		ll p,q;cin>>t>>p>>q;
		if((t^p^q)&1){
			cout<<"NO\n",exit(0);
		}
		k=t/l,w=t%l;
		x=(p+q+t)/2,y=(q-p+t)/2;
	}
	bool operator<(const point &h)const{
		return w<h.w;
	}
}p[maxn];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n>>l;
	for(int i=1;i<=n;++i) p[i].read();
	sort(p+1,p+n+1);
	p[++n].k=-1,p[n].w=l;
	for(int i=1;i<=n;++i){
		ll k=p[i].k-p[i-1].k,w=p[i].w-p[i-1].w;
		if(!k){
			if(p[i].x-p[i-1].x-w>0||p[i].x-p[i-1].x<0) cout<<"NO\n",exit(0);
			if(p[i].y-p[i-1].y-w>0||p[i].y-p[i-1].y<0) cout<<"NO\n",exit(0);
		}
		else if(k>0){
			lx=max(lx,(ll)ceil(1.0L*(p[i].x-p[i-1].x-w)/k));
			rx=min(rx,(ll)floor(1.0L*(p[i].x-p[i-1].x)/k));
			ly=max(ly,(ll)ceil(1.0L*(p[i].y-p[i-1].y-w)/k));
			ry=min(ry,(ll)floor(1.0L*(p[i].y-p[i-1].y)/k));
		}
		else{
			k*=-1;
			lx=max(lx,(ll)ceil(1.0L*(p[i-1].x-p[i].x)/k));
			rx=min(rx,(ll)floor(1.0L*(p[i-1].x-p[i].x+w)/k));
			ly=max(ly,(ll)ceil(1.0L*(p[i-1].y-p[i].y)/k));
			ry=min(ry,(ll)floor(1.0L*(p[i-1].y-p[i].y+w)/k));
		}
	}
	if(lx>rx||ly>ry){
		cout<<"NO\n",exit(0);
	}
	for(int i=1;i<=n;++i){
		ll dx=(p[i].x-p[i].k*lx)-(p[i-1].x-p[i-1].k*lx);
		ll dy=(p[i].y-p[i].k*ly)-(p[i-1].y-p[i-1].k*ly);
		ll t=p[i].w-p[i-1].w,x=0,y=0;
		while(t--){
			if(x<dx){
				++x;
				if(y<dy) cout<<'U',++y;
				else cout<<'R';
			}
			else{
				if(y<dy) cout<<'L',++y;
				else cout<<'D';
			}
		}
	}
	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define FOR(i,s,e) for (int i=(s); i<(e); i++)
#define FOE(i,s,e) for (int i=(s); i<=(e); i++)
#define LL long long
LL max(LL a,LL b){if (a>b){return a;} else {return b;}}
LL min(LL a,LL b){if (a<b){return a;} else {return b;}}

#define M 400001

int n, l;
LL x, y, t;

struct dat{
    int ma;
    LL cy, x, y;
}a[M];

bool operator< (dat u, dat v){return u.ma < v.ma;}

int f(LL d){
    if (d < 0) return f(-d);
    return d % 2;
}

int main(){
    scanf("%d%d", &n, &l);
    FOE(i, 1, n){
        scanf("%I64d%I64d%I64d", &t, &x, &y);
        if (f(x + y) != f(t)){
            puts("NO");
            return 0;
        }
        a[i].x = x;
        a[i].y = y;
        a[i].cy = t / (LL)l;
        a[i].ma = t % (LL)l;
    }

    a[0].x = 0;
    a[0].y = 0;
    a[0].cy = 0;
    a[0].ma = 0;

    a[++n].x = 0;
    a[n].y = 0;
    a[n].cy = -1;
    a[n].ma = l;

    sort(a, a + n);

    int mx = -1 * l, my = -1 * l, Mx = l, My = l;
    //mx is the x+y border, my is the x-y border
    FOE(i, 1, n){
        LL dx = abs(a[i].x - a[i - 1].x);
        LL dy = abs(a[i].y - a[i - 1].y);
        if ((dx + dy) > abs(a[i].cy - a[i - 1].cy) * l + abs(a[i].ma - a[i - 1].ma)){
            puts("NO");
            return 0;
        }

        if (a[i].cy != a[i - 1].cy){
            LL dif = a[i].ma - a[i - 1].ma;
            LL df = abs(a[i].cy - a[i - 1].cy);
            LL de = 1; if (a[i].cy < a[i - 1].cy) de = -1;
            LL ax = a[i].x - a[i - 1].x;
            LL ay = a[i].y - a[i - 1].y;
            ax *= de;
            ay *= de;
      //      printf("%d %I64d %I64d %I64d %I64d\n", i, dif, df, ax, ay);

            while (mx <= Mx && mx * df < ax + ay - dif) mx++;
            while (my <= My && my * df < ax - ay - dif) my++;
            while (mx <= Mx && Mx * df > dif + ax + ay) Mx--;
            while (my <= My && My * df > dif + ax - ay) My--;
     //       printf("Res = {%d, %d}, {%d, %d}\n", mx, Mx, my, My);
        }
    }

    if (f(mx) != f(l)) mx++;
    if (f(my) != f(l)) my++;

  //  printf("%d %d %d %d\n", mx, Mx, my, My);
    if (mx > Mx || my > My){
        puts("NO");
        return 0;
    }

    LL dx = (mx + my) / 2;
    LL dy = (mx - my) / 2;

  //  printf("%I64d %I64d\n", dx, dy);

    FOE(i, 0, n - 1){
        a[i].x -= a[i].cy * dx;
        a[i].y -= a[i].cy * dy;
    }

    int j = 0;
    int px = 0;
    int py = 0;

    a[n].x = dx;
    a[n].y = dy;
    FOE(i, 0, n){
      //  printf("TAR %I64d, %I64d now %d, %d\n", a[i].x, a[i].y, px, py);
        while (px < a[i].x){
            px++;
            j++;
            printf("R");
        }
        while (px > a[i].x){
            px--;
            j++;
            printf("L");
        }
        while (py < a[i].y){
            py++;
            j++;
            printf("U");
        }
        while (py > a[i].y){
            py--;
            j++;
            printf("D");
        }
        while (j != a[i].ma){
            printf("LR");
            j += 2;
        }
    }

    puts("");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
char S[6] = {'D', 'L', 'R', 'U'};
int nex[6] = {0, 0, 1, 1};
int ney[6] = {0, 1, 0, 1};
int cnt[6];
#define LL long long
int n;
LL loop, lx = -4e18, rx = 4e18, ly = -4e18, ry = 4e18;
string ans, tmp;
struct Pos{
	LL x, y, t, k, w;
}a[N], now[N];
bool cmp(Pos X, Pos Y){
	return X.w < Y.w;
}
void fail(){
	puts("NO");
	exit(0);
}
LL floor(LL x, LL y){
	if(!x)return 0;
	int flx = x < 0 ? -1 : 1;
	int fly = y < 0 ? -1 : 1;
	x = abs(x), y = abs(y);
	if(flx * fly > 0)return x / y;
	else return -((x - 1) / y + 1);
}
LL ceil(LL x, LL y){
	if(!x)return 0;
	int flx = x < 0 ? -1 : 1;
	int fly = y < 0 ? -1 : 1;
	x = abs(x), y = abs(y);
	if(flx * fly > 0)return (x - 1) / y + 1;
	return -(x / y);
}
void update(LL &l, LL &r, LL k, LL w, LL x1, LL x2){
	LL L = -w - x1 + x2, R = -x1 + x2;
//	printf("L=%lld R=%lld k=%lld\n", L, R, k);
	if(!k) {if(L > 0 || R < 0)fail();}
	else{
		if(k > 0){
//			printf("case1: L=%lld R=%lld\n", (LL)ceil(1.0 * L / k), (LL)floor(1.0 * R / k));
			l = max(l, ceil(L, k));
			r = min(r, floor(R, k));
		}
		else{
//			printf("case2: L=%lld R=%lld\n", (LL)ceil(1.0 * R / k), (LL)floor(1.0 * L / k));
			l = max(l, ceil(R, k));
			r = min(r, floor(L, k));
		}
	}
}
void work(LL rx, LL ry){
	for(int i = 1;i <= n; i++){
//	 printf("i=%d x=%lld y=%lld k=%lld w=%lld\n", i, a[i].x, a[i].y, a[i].k, a[i].w);

		a[i].x = a[i].x - a[i].k * rx;
		a[i].y = a[i].y - a[i].k * ry;
	}
//	printf("rx=%lld ry=%lld\n", rx, ry);
	a[n+1].x = rx; a[n+1].y = ry;
	tmp.clear();
	for(int i = 0;i <= n; i++){
		LL t = a[i+1].w - a[i].w;
		LL nx = a[i].x, ny = a[i].y;
		LL x = a[i+1].x, y = a[i+1].y;
//		printf("i=%d nx=%lld ny=%lld x=%lld y=%lld wi+1=%lld wi=%lld\n", i, nx, ny, x, y, a[i+1].w, a[i].w);
		memset(cnt, 0, sizeof(cnt));
		while(t--){
			if(nx < x){
				if(ny < y)cnt[3]++, nx++, ny++;
				else cnt[2]++, nx++;
			}
			else{
				if(ny < y)cnt[1]++, ny++;
				else cnt[0]++;
			}
		}
		for(int j = 0;j <= 3; j++)
			for(int k = 1;k <= cnt[j]; k++)tmp += S[j];
	}
	if(ans.empty() || ans > tmp)ans = tmp;
}
int main(){
//	freopen("robot.in", "r", stdin);
//	freopen("robot.out", "w", stdout);
	cin>>n>>loop;
	LL x, y, t;
	for(int i = 1;i <= n; i++){
		scanf("%lld%lld%lld", &t, &x, &y);
		if((x ^ y ^ t) & 1)fail();
		a[i].t = t;
		a[i].x = (x + y + t) >> 1;
		a[i].y = (y - x + t) >> 1;
		a[i].k = t / loop;
		a[i].w = t % loop;
//		printf("i=%d x=%lld y=%lld\n", i, a[i].x, a[i].y);
	}
	sort(a + 1, a + 1 + n, cmp);
	a[n+1].k = -1; a[n+1].w = loop;
	for(int i = 0; i <= n; i++){
		LL k = a[i+1].k - a[i].k;
		LL w = a[i+1].w - a[i].w;
		update(lx, rx, k, w, a[i].x, a[i+1].x);
		update(ly, ry, k, w, a[i].y, a[i+1].y);
//		printf("i=%d k=%lld w=%lld lx=%lld rx=%lld ly=%lld ry=%lld\n", i, k, w, lx, rx, ly, ry);

	}
//	puts("xbx");
	if(lx > rx || ly > ry)fail();
	memcpy(now, a, sizeof(now));
	work(lx, ly);
	memcpy(a, now, sizeof(now));
	work(rx, ry);
//	printf("lx=%lld rx=%lld ly=%lld ry=%lld\n", lx, rx, ly, ry);
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long n, l;
const int maxN = 2 * (int)1e5 + 10;
long long t[maxN];
long long y[maxN];
long long x[maxN];
vector < pair < int, int > > f;
long long ceil(long long x, long long  y) {
    if (x >= 0) {
        return (x / y);
    }
    long long a = (x / y);
    if (a * y > x) a--;
    if ((a + 1) * y <= x) a++;
    return a;
}
int main() {
    srand(time(0));
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    cin >> n >> l;
    for (int i = 1; i <= n; i++) {
        cin >> t[i] >> x[i] >> y[i];
        if (t[i] % 2 != (((x[i] + y[i]) % 2) + 2) % 2) {
            cout << "NO";
            return 0;
        }
        if (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) > t[i] - t[i - 1]) {
            cout << "NO";
            return 0;
        }
        f.push_back(make_pair(t[i] % l, i));
    }
    //cout << "HERE" << endl;
    f.push_back(make_pair(0, 0));
    long long l1 = -l;
    long long r1 = l;
    long long l2 = -l;
    long long r2 = l;
    sort(f.begin(), f.end());
    for (int i = 0; i + 1 < f.size(); i++) {
        long long t1 = f[i].first;
        long long t2 = f[i + 1].first;
        int ind1 = f[i].second;
        int ind2 = f[i + 1].second;
        if (t[ind1] < t[ind2]) {
            swap(ind1, ind2);
            swap(t1, t2);
        }
        if ((t[ind1] / l) == (t[ind2] / l)) continue;
        r1 = min(r1, ceil((x[ind1] + y[ind1] - x[ind2] - y[ind2] + abs(t1 - t2)), ((t[ind1] / l) - (t[ind2] / l))));
        l1 = max(l1, ceil((x[ind1] + y[ind1] - x[ind2] - y[ind2] - abs(t1 - t2) + (t[ind1] / l) - (t[ind2] / l) - 1), ((t[ind1] / l) - (t[ind2] / l))));
        r2 = min(r2, ceil((x[ind1] - y[ind1] - x[ind2] + y[ind2] + abs(t1 - t2)), ((t[ind1] / l) - (t[ind2] / l))));
        l2 = max(l2, ceil((x[ind1] - y[ind1] - x[ind2] + y[ind2] - abs(t1 - t2) + (t[ind1] / l) - (t[ind2] / l) - 1), ((t[ind1] / l) - (t[ind2] / l))));
    }
    int ind = f[f.size() - 1].second;
    r1 = min(r1, ceil((x[ind] + y[ind] + l - (t[ind] % l)), (1 + (t[ind] / l))));
    l1 = max(l1, ceil((x[ind] + y[ind] + (t[ind] % l) - l + (t[ind] / l)), (1 + (t[ind] / l))));
    r2 = min(r2, ceil((x[ind] - y[ind] + l - (t[ind] % l)), (1 + (t[ind] / l))));
    l2 = max(l2, ceil((x[ind] - y[ind] + (t[ind] % l) - l + (t[ind] / l)), (1 + (t[ind] / l))));
    if (abs(l1 - l) % 2 != 0) l1++;
    if (abs(l2 - l) % 2 != 0) l2++;
    if (abs(l2 - l1) % 2 != 0) {
        if (r2 > l2) l2++;
        else l1++;
    }
    if (r1 < l1 || r2 < l2) {
        cout << "NO";
        return 0;
    }
    int a = l1;
    int b = l2;
    int curr = 0;
    int curu = 0;
    f.push_back(make_pair(l, n + 1));
    x[n + 1] = (a + b) / 2;
    y[n + 1] = (a - b) / 2;
    t[n + 1] = 0;
    //cout << a << " " << b << endl;
    for (int i = 0; i + 1 < f.size(); i++) {
        int ind1 = f[i].second;
        int ind2 = f[i + 1].second;
        //cout << ind1 << " " << ind2 << '\n';
        long long c = (x[ind2] + y[ind2] - a * (t[ind2] / l) - x[ind1] - y[ind1] + a * (t[ind1] / l));
        long long d = (x[ind2] - y[ind2] - b * (t[ind2] / l) - x[ind1] + y[ind1] + b * (t[ind1] / l));
        long long e = f[i + 1].first - f[i].first;
        //cout << c << " " << d << endl;
        for (int i = 0; i < (c - d) / 2; i++) {
            curu++;
            cout << "U";
        }
        for (int i = 0; i < (d - c) / 2; i++) {
            curu--;
            cout << "D";
        }
        for (int i = 0; i < (c + d) / 2; i++) {
            curr++;
            cout <<"R";
        }
        for (int i = 0; i < (-c - d) / 2; i++) {
            curr--;
            cout << "L";
        }
        for (int i = 0; i < (e - max(abs(c), abs(d))); i += 2) {
            cout << "R";
            cout << "L";
        }
    }
    return 0;
}

#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=2000006;
const LL INF=4.5e18;
void NO(){
	puts("NO");
	exit(0);
}
void ckmin(LL &a,LL b){
	if (a>b)
		a=b;
}
void ckmax(LL &a,LL b){
	if (a<b)
		a=b;
}
int n,L;
struct Node{
	LL t,x,y,p;
}a[N];
bool cmp(Node a,Node b){
	return a.p<b.p;
}
LL U(LL a,LL b){
	return a>=0?(a+b-1)/b:a/b;
}
LL D(LL a,LL b){
	return a>=0?a/b:(a-b+1)/b;
}
char res[N];
int cly=0;
int main(){
	n=read(),L=read();
	if (n==1000&&L==2000000)
		cly=1;
	For(i,1,n){
		a[i].t=read(),a[i].x=read(),a[i].y=read();
		a[i].p=a[i].t%L;
		if ((a[i].x+a[i].y+a[i].t)%2!=0)
			NO();
	}
	++n,a[n].t=a[n].x=a[n].y=a[n].p=0;
	++n,a[n]=a[n-1],a[n].p=L;
	sort(a+1,a+n+1,cmp);
	LL minp=-L,maxp=L,minm=-L,maxm=L;
	For(i,1,n-1){
		LL dx=a[i+1].x-a[i].x,dy=a[i+1].y-a[i].y;
		LL k=((a[i+1].t-a[i+1].p)-(a[i].t-a[i].p))/L;
		LL t=a[i+1].p-a[i].p;
		if (k<0)
			k=-k,dx=-dx,dy=-dy;
		if (k!=0){
			ckmax(minp,U(dx+dy-t,k));
			ckmin(maxp,D(dx+dy+t,k));
			ckmax(minm,U(dx-dy-t,k));
			ckmin(maxm,D(dx-dy+t,k));
		}
		else {
			if (t<abs(dx)+abs(dy))
				NO();
		}
	}
	LL dx,dy;
	int flag=0;
	for (LL i=minp;!flag&&i<=maxp;i++)
		if ((i+L)%2==0)
			for (LL j=minm;!flag&&j<=maxm;j++){
				LL x=i+j,y=i-j;
				if (x%2==0&&y%2==0)
					flag=1,dx=x/2,dy=y/2;
			}
	if (!flag)
		NO();
	For(i,1,n){
		LL k=(a[i].t-a[i].p)/L;
		a[i].x-=k*dx,a[i].y-=k*dy;
	}
	For(i,1,n-1){
		int t0=a[i].p,t1=a[i+1].p;
		LL x=a[i+1].x-a[i].x,y=a[i+1].y-a[i].y;
		assert(t1-t0>=abs(x)+abs(y));
		while (x>0)
			res[t0++]='R',x--;
		while (x<0)
			res[t0++]='L',x++;
		while (y>0)
			res[t0++]='U',y--;
		while (y<0)
			res[t0++]='D',y++;
		while (t0<t1)
			res[t0++]='L',res[t0++]='R';
		assert(t0==t1);
	}
	puts(res);
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) FAIL();
	if(delt==0) return;
	ll l=-p-x,r=p-x; db 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]]);
	}
	ll 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;
		ll 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.PB(d);
		if(len<0||(len&1)) FAIL();
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('D'),r-=2;
}

vector<int> ax,ay;
int main() {
//	freopen("a.in","r",stdin);
	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;
			}
			ll 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.PB(i);
		pos.PB(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;
}

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <complex>
#define X(x) (real(x))
#define Y(x) (imag(x))
using namespace std;

typedef long long LL;
struct Q {
	LL t;
	LL x, y;
	LL tr, tn;

	bool operator < (const Q & b) const{
		return tr < b.tr;
	}
} inp[1000010];

int n, l;
int ans;

typedef complex<LL> P;
P mi, mx;

P div1(P x, LL d) {
	P r;
	X(r) = X(x) >= 0 ? X(x)/d : -(-X(x)+d-1)/d;
	Y(r) = Y(x) >= 0 ? Y(x)/d : -(-Y(x)+d-1)/d;
	return r;
}
P div2(P x, LL d) {
	P r;
	X(r) = X(x) >= 0 ? (X(x)+d-1)/d : -(-X(x))/d;
	Y(r) = Y(x) >= 0 ? (Y(x)+d-1)/d : -(-Y(x))/d;
	return r;
}
void update(P d, LL dr, LL dn) {
	if (!dn) {
		if (abs(X(d)) > dr || abs(Y(d)) > dr) ans = 0;
	} else {
		if (dn < 0) {
			d = -d;
			dn = -dn;
		}
		P d1 = div2(d - P(dr, dr) , dn), d2 = div1(d + P(dr, dr), dn);
		X(mi) = max(X(mi), X(d1));
		Y(mi) =max(Y(mi), Y(d1));
		X(mx) = min(X(mx), X(d2));
		Y(mx) =min(Y(mx), Y(d2));
	}
}

LL gx, gy;
char out[3000010];
int main() {
	scanf("%d%d", &n, &l);
	ans = 1;
	for (int i=1; i<=n; i++) {
		scanf("%I64d%I64d%I64d", &inp[i].t, &inp[i].x, &inp[i].y);
		inp[i].tr = inp[i].t % l;
		inp[i].tn = inp[i].t / l;
		if ((inp[i].x + inp[i].y + inp[i].t) & 1 != 0) ans = 0;
	}
	if (!ans) {
		puts("NO");
		return 0;
	}
	mi = P(-l, -l);
	mx = P(l, l);
	std::sort(inp+1, inp+n+1);
	for (int i=0; i<n; i++) {
		P p0(inp[i].x + inp[i].y, inp[i].x - inp[i].y), p1(inp[i+1].x+inp[i+1].y, inp[i+1].x - inp[i+1].y);
			update(p1-p0, inp[i+1].tr - inp[i].tr, inp[i+1].tn - inp[i].tn);
	}

		P p0(inp[n].x + inp[n].y, inp[n].x - inp[n].y), p1(inp[0].x+inp[0].y, inp[0].x - inp[0].y);
		update(p0, l - inp[n].tr, inp[n].tn+1);

	if (X(mi) > X(mx) || Y(mi) > Y(mx)) ans = 0;
	else if (X(mi) == X(mx) && Y(mi) == Y(mx) && (X(mi) + Y(mi)) % 2 != 0) ans = 0;
	else {
		LL xx = X(mi), yy = Y(mi);
		if ((X(mi) + Y(mi)) % 2) {
			if (X(mx)-X(mi) > Y(mx)-Y(mi)) xx++;
			else yy++;
		}
		gx = (xx + yy )/2;
		gy = (xx - yy )/ 2;
		if ((gx + gy + l) % 2) {
			if (xx < X(mx) && yy < Y(mx)) xx++, yy++;
			else if (xx < X(mx) && yy > Y(mi)) xx++, yy--;
			else if (xx > X(mi) && yy < Y(mx)) xx--, yy++;
			else ans = 0;

		gx = (xx + yy )/2;
		gy = (xx - yy )/ 2;
		}
	}
	if (!ans) {
		puts("NO");
		return 0;
	}

	inp[n+1].x = gx;
	inp[n+1].y = gy;
	inp[n+1].tr = l;
	inp[n+1].tn = 0;
	for (int i=0; i<=n; i++) {
		inp[i].x -= inp[i].tn * gx;
		inp[i].y -= inp[i].tn * gy;
	}
	for (int i=0; i<=n; i++) {

		LL dx = inp[i+1].x - inp[i].x, dy = inp[i+1].y - inp[i].y;
		assert(abs(dx)+abs(dy) <= inp[i+1].tr - inp[i].tr);
		for (int j=inp[i].tr; j < inp[i+1].tr; j++) {
			if (dx < 0) {
				dx++;
				out[j] = 'L';
			} else if (dx > 0) {
				dx--;
				out[j] = 'R';
			} else if (dy < 0) {
				dy++;
				out[j] = 'D';
			} else if (dy > 0) {
				dy--;
				out[j] = 'U';
			} else {
				dx++;
								out[j] = 'L';
			}
		}
	}
	puts(out);
	return 0;

}

#include<bits/stdc++.h>
#define ll long long
#define N 200010
#define L 2000010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
struct Po{ll x,y,t;}po[N];
struct shj{ll t,x,zh;}a[N];
int n,l;
bool an1[L],an2[L];
bool c1(const shj &a,const shj &b){return a.t<b.t;}
int main(){
	read(n);read(l);
	for (int i=1;i<=n;i++){read(po[i].t);read(po[i].x);read(po[i].y);}
	for (int i=1;i<=n;i++){
		a[i].t=po[i].t%l;a[i].x=po[i].x+po[i].y+po[i].t;
		if (a[i].x%2==1||a[i].x<0){puts("NO");return 0;}
		else a[i].x/=2;a[i].zh=po[i].t/l;
	}
	a[n+1]=(shj){0,0,0};a[n+2]=(shj){l,0,-1};
	sort(a+1,a+n+3,c1);
	ll nl=0,nr=l;
	for (int i=1;i<=n+1;i++){
		ll x=a[i+1].t-a[i].t,y=a[i+1].zh-a[i].zh,z=a[i+1].x-a[i].x;
		if (y>0){
			if ((z-x)%y==0)nl=max(nl,(z-x)/y);else nl=max(nl,(z-x)/y+1);
			nr=min(nr,z/y);
		}
		if (y<0){
			z=-z;y=-y;
			if (z%y==0)nl=max(nl,z/y);else nl=max(nl,z/y+1);
			nr=min(nr,(z+x)/y);
		}
	}
	if (nl>nr){puts("NO");return 0;}
	for (int i=1;i<=n+1;i++){
		ll su=a[i+1].x-a[i].x-(a[i+1].zh-a[i].zh)*nl;
		for (int j=a[i].t+1;j<=a[i+1].t;j++)if (su){an1[j]=1;su--;}else an1[j]=0;
	}
	for (int i=1;i<=n;i++){
		a[i].t=po[i].t%l;a[i].x=po[i].x-po[i].y+po[i].t;
		if (a[i].x%2==1||a[i].x<0){puts("NO");return 0;}
		else a[i].x/=2;a[i].zh=po[i].t/l;
	}
	a[n+1]=(shj){0,0,0};a[n+2]=(shj){l,0,-1};
	sort(a+1,a+n+3,c1);
	nl=0,nr=l;
	for (int i=1;i<=n+1;i++){
		ll x=a[i+1].t-a[i].t,y=a[i+1].zh-a[i].zh,z=a[i+1].x-a[i].x;
		if (y>0){
			if ((z-x)%y==0)nl=max(nl,(z-x)/y);else nl=max(nl,(z-x)/y+1);
			nr=min(nr,z/y);
		}
		if (y<0){
			z=-z;y=-y;
			if (z%y==0)nl=max(nl,z/y);else nl=max(nl,z/y+1);
			nr=min(nr,(z+x)/y);
		}
	}
	if (nl>nr){puts("NO");return 0;}
	for (int i=1;i<=n+1;i++){
		ll su=a[i+1].x-a[i].x-(a[i+1].zh-a[i].zh)*nl;
		for (int j=a[i].t+1;j<=a[i+1].t;j++){
			if (su){an2[j]=1;su--;}else an2[j]=0;
		}
	}
	for (int i=1;i<=l;i++)printf("%c","LDUR"[2*an1[i]+an2[i]]);
	puts("");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int N=2e6+10;
typedef long long ll;

ll gi() {
	ll x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,l,tt;
bool ans1[N],ans2[N];
char s[2][2]={{'L','D'},{'U','R'}};
ll t[N],x[N],y[N];

void No() {
	cout<<"NO";exit(0);
}

struct dat {
	int u;ll k,b;
	bool operator<(const dat &A) const {
		return u<A.u;
	}
} lim[N];

void work(ll *x,bool *ans) {
	tt=0;
	for(int i=1;i<=n;i++) {
		if((abs(x[i])&1)!=(abs(t[i])&1)) No();
		x[i]=(x[i]+t[i])/2;
		lim[++tt]=(dat){t[i]%l,-(t[i]/l),x[i]};
	}
	lim[++tt]=(dat){l,1,0};
	lim[++tt]=(dat){0,0,0};
	sort(lim+1,lim+tt+1);
	ll L=0,R=l;
	for(int i=2;i<=tt;i++) {
		ll kk=lim[i].k-lim[i-1].k,bb=lim[i].b-lim[i-1].b,uu=lim[i].u-lim[i-1].u;
		if(kk==0) {
			if(bb>uu||bb<0) No();
		}
		else if(kk>0) {
			if(bb>uu) No(); R=min(R,(uu-bb)/kk);
			if(bb<0) L=max(L,(-bb-1)/kk+1);
		}
		else {
			if(bb<0) No(); R=min(R,bb/(-kk));
			if(bb>uu) L=max(L,(bb-uu-1)/(-kk)+1);
		}
		if(L>R) No();
	}
	ll sum=0;
	for(int i=2;i<=tt;i++)
		for(int j=lim[i-1].u+1;j<=lim[i].u;j++)
			if(sum<lim[i].k*L+lim[i].b) ++sum,ans[j]=1;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
#endif
	cin>>n>>l;
	for(int i=1;i<=n;i++) {
		t[i]=gi();ll xx=gi(),yy=gi();
		x[i]=xx+yy,y[i]=xx-yy;
	}
	work(x,ans1),work(y,ans2);
	for(int i=1;i<=l;i++) putchar(s[ans1[i]][ans2[i]]);
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define mp make_pair
#define what_is(x) cerr << #x << " is " << x << endl;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;

/*
const int p = 1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}*/

vector<int> Z(vector<int> s)
{
    int n = s.size();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R-L] == s[R]) R++;
            z[i] = R-L; R--;
        } else {
            int k = i-L;
            if (z[k] < R-i+1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R-L] == s[R]) R++;
                z[i] = R-L; R--;
            }
        }
    }
    return z;
}

mt19937 rnd(time(0));
/*
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const { return k < o.k; }
    bool operator<(ll x) const { return p < x; }
};

struct CHT : multiset<Line, less<>> {
    // (for doubles, use inf = 1/.0, div(a,b) = a/b)
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b) { // floored division
        return a /b - ((a ^ b) < 0 && a % b); }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};
*/

ll divide(ll x, ll y)
{
    if (x>=0) return x/y;
    else
    {
        ll t = (y-x) - (y-x)%y;
        return (x+t)/y - t/y;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    ll n, l;
    cin>>n>>l;
    vector<ll> d(n), x(n), y(n);
    for (int i = 0; i<n; i++)
    {
        cin>>d[i]>>x[i]>>y[i];
        if ((x[i]+y[i]+d[i])%2 != 0) {cout<<"NO"; return 0;}
    }

    vector<pair<pair<ll, ll>, pair<ll, ll>>> days(n+2);
    days[n+1] = mp(mp(l, -1), mp(0, 0));
    days[n] = mp( mp(0, 0), mp(0, 0) );
    //day, k, x, y
    for (int i = 0; i<n; i++)
    {
        ll period = d[i]/l;
        days[i] = mp( mp(d[i]%l, period), mp(x[i], y[i]));
    }
    sort(days.begin(), days.end());
    vector<ll> max_XplusY(n+1, 1e18);
    vector<ll> min_XplusY(n+1, -1e18);
    vector<ll> max_XminusY(n+1, 1e18);
    vector<ll> min_XminusY(n+1, -1e18);

    /*for (auto it: days) cout<<it.first.first<<' '<<it.first.second<<' '<<it.second.first<<' '<<it.second.second<<endl;
    cout<<">>>"<<endl;
    //ll X_ANS, Y_ANS
    cout<<"D K X Y\n";*/
    for (int i = 0; i<=n; i++)
    {
        ll d1 = days[i].first.first;
        ll k1 = days[i].first.second;
        ll x1 = days[i].second.first;
        ll y1 = days[i].second.second;
        ll d2 = days[i+1].first.first;
        ll k2 = days[i+1].first.second;
        ll x2 = days[i+1].second.first;
        ll y2 = days[i+1].second.second;

        ll X = x2-x1;
        ll Y = y2-y1;
        ll K = k2-k1;
        ll D = d2-d1;

        if (K==0)
        {
            if (abs(X) + abs(Y)>D) {cout<<"NO"; return 0;}
            continue;
        }

        if (K<0)
        {
            K = -K;
            X = -X;
            Y = -Y;
        }

        //cout<<"rule "<<D<<' '<<K<<' '<<X<<' '<<Y<<endl;

        min_XplusY[i] = divide((X+Y-D+K-1), K);
        max_XplusY[i] = divide((D+X+Y), K);
        max_XminusY[i] = divide((D+X-Y), K);
        min_XminusY[i] = divide((X-Y-D+K-1), K);
        //cout<<min_XplusY[i]<<' '<<max_XplusY[i]<<' '<<max_XminusY[i]<<' '<<min_XminusY[i]<<endl;
    }

    ll minn_XplusY, minn_XminusY, maxx_XplusY, maxx_XminusY;
    minn_XplusY = min_XplusY[0];
    for (int i = 0; i<=n; i++) minn_XplusY = max(minn_XplusY, min_XplusY[i]);
    maxx_XplusY = max_XplusY[0];
    for (int i = 0; i<=n; i++) maxx_XplusY = min(maxx_XplusY, max_XplusY[i]);
    minn_XminusY = min_XminusY[0];
    for (int i = 0; i<=n; i++) minn_XminusY = max(minn_XminusY, min_XminusY[i]);
    maxx_XminusY = max_XminusY[0];
    for (int i = 0; i<=n; i++) maxx_XminusY = min(maxx_XminusY, max_XminusY[i]);

    //cout<<minn_XplusY<<' '<<minn_XminusY<<' '<<maxx_XplusY<<' '<<maxx_XminusY<<endl;

    if ( (maxx_XminusY+l)%2!=0) maxx_XminusY--;
    if ( (maxx_XplusY+l)%2!=0) maxx_XplusY--;
    if ( (minn_XminusY+l)%2!=0) minn_XminusY++;
    if ( (minn_XplusY+l)%2!=0) minn_XplusY++;

    if (maxx_XminusY<minn_XminusY) {cout<<"NO"; return 0;}
    if (maxx_XplusY<minn_XplusY) {cout<<"NO"; return 0;}

    ll X_ans = divide((minn_XminusY + minn_XplusY), 2);
    ll Y_ans = divide((minn_XplusY - minn_XminusY), 2);
    //cout<<"GUYS "<<X_ans<<' '<<Y_ans<<endl;

    vector<pair<ll, pair<ll, ll>>> schedule;

    for (int i = 0; i<=n+1; i++)
    {
        schedule.push_back(mp(days[i].first.first,
                mp(days[i].second.first - X_ans*days[i].first.second, days[i].second.second - Y_ans*days[i].first.second)));
    }
    string answer;
    ll current_day = 0;
    ll current_x = 0;
    ll current_y = 0;
    for (int i = 1; i<=n+1; i++)
    {
        ll to_spare = schedule[i].first - current_day;
        ll on_x = schedule[i].second.first - current_x;
        ll on_y = schedule[i].second.second - current_y;
        if (on_x>0)
        {
            for (int j = 0; j<on_x; j++) answer+='R';
            to_spare-=on_x;
        }
        if (on_x<0)
        {
            for (int j = 0; j<(-on_x); j++) answer+='L';
            to_spare+=on_x;
        }
        if (on_y>0)
        {
            for (int j = 0; j<on_y; j++) answer+='U';
            to_spare-=on_y;
        }
        if (on_y<0)
        {
            for (int j = 0; j<(-on_y); j++) answer+='D';
            to_spare+=on_y;
        }
        for (int j = 0; j<to_spare; j+=2) answer+="UD";
        current_day = schedule[i].first;
        current_x = schedule[i].second.first;
        current_y = schedule[i].second.second;
    }
    cout<<answer;

}

/*
	  author : evenbao
	  created : 2020 / 02 / 21
*/

#include<bits/stdc++.h>

using namespace std;

#ifndef LOCAL
	  #define eprintf(...) fprintf(stderr , _VA_ARGS)
#else
	  #define eprintf(...) 42
#endif

// define evenbao
#define PII pair<int , int>
#define FI first
#define SE second
#define MP make_pair

typedef long long LL;

const int N = 3e5 + 10;
const LL INF = 4e18;

int n;
LL l;

template <typename T> inline void chkmax(T &x , T y) { x = max(x , y); }
template <typename T> inline void chkmin(T &x , T y) { x = min(x , y); }
template <typename T> inline void read(T &x) {
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

struct PNode {
		LL k , w , t , x , y;
		inline void input() {
				LL p , q;
				read(t); read(p); read(q);
				if ((t ^ p ^ q) & 1LL) {
						puts("NO");
						exit(0);
				}
				x = (p + q + t) / 2LL;
				y = (q - p + t) / 2LL;
				k =  t / l; w = t % l;
				return;
		}
} P[N];

inline bool cmp(PNode a , PNode b) {
		return a.w < b.w;
}

inline void Fail() {
		printf("NO\n");
		exit(0);
}

int main() {

		read(n); read(l);
		for (int i = 1; i <= n; ++i) P[i].input();
		sort(P + 1 , P + n + 1 , cmp);
		P[++n].k = -1 , P[n].w = l;
		LL lx = -INF , rx = INF , ly = -INF , ry = INF;
		for (int i = 1; i <= n; ++i) {
				LL k = P[i].k - P[i - 1].k ,
					 w = P[i].w - P[i - 1].w;
				if (k == 0) {
						if (P[i].x - P[i - 1].x - w > 0 || P[i].x - P[i - 1].x < 0) Fail();
						if (P[i].y - P[i - 1].y - w > 0 || P[i].y - P[i - 1].y < 0) Fail();
				}	else if (k > 0) {
						chkmax(lx , (LL)ceil(1.0L * (P[i].x - P[i - 1].x - w) / k));
						chkmin(rx , (LL)floor(1.0L * (P[i].x - P[i - 1].x) / k));
						chkmax(ly , (LL)ceil(1.0L * (P[i].y - P[i - 1].y - w) / k));
						chkmin(ry , (LL)floor(1.0L * (P[i].y - P[i - 1].y) / k));
				} else if (k < 0) {
						k *= -1;
						chkmax(lx , (LL)ceil(1.0L * (P[i - 1].x - P[i].x) / k));
						chkmin(rx , (LL)floor(1.0L * (P[i - 1].x - P[i].x + w) / k));
						chkmax(ly , (LL)ceil(1.0L * (P[i - 1].y - P[i].y) / k));
						chkmin(ry , (LL)floor(1.0L * (P[i - 1].y - P[i].y + w) / k));
				}
		}
 		if (lx > rx || ly > ry) Fail();
 		for (int i = 1; i <= n; ++i) {
 				LL dx = (P[i].x - (LL)lx * P[i].k) - (P[i - 1].x - (LL)lx * P[i - 1].k) ,
 					 dy = (P[i].y - (LL)ly * P[i].k) - (P[i - 1].y - (LL)ly * P[i - 1].k);
				LL t = P[i].w - P[i - 1].w , x = 0 , y = 0;
				while (t--) {
						if (x < dx) {
								++x;
								if (y < dy) ++y , putchar('U');
								else putchar('R');
						} else {
								if (y < dy) ++y , putchar('L');
								else putchar('D');
						}
				}
		}
		printf("\n");
	  return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define x first
#define y second

template<typename T0,typename T1>inline void check_min(T0 a,T1 &b){if(a<b)b=a;}
template<typename T0,typename T1>inline void check_max(T0 a,T1 &b){if(a>b)b=a;}

typedef long long ll;
typedef std::pair<ll,ll> pii;

const int N=201000,M=2010000;

int n,m;

namespace worker
{
	bool cmp(pii A,pii B){return A.x%m<B.x%m;}

	ll K[N],len[N],V[N];

	void build(int *t,int L,int R,int delta)
	{

		if(delta>(R-L+1))printf("fuck\n"),exit(-1);

		int pos=L-1;
		while(delta-- && pos<R)
			t[++pos]=1;
		while(pos<R)
			t[++pos]=-1;
	}

	int lim[N],pos[N];

	bool work(pii *s,int *t)
	{
		for(int i=1;i<=n;i++)
		{
			if((s[i].y+s[i].x)&1)return 0;
			s[i].y=(s[i].y+s[i].x)/2;
		}
		std::sort(s+1,s+n+1,cmp);

		pii tmp=pii(0,m);

		for(int i=1;i<=n;i++)
		{
			K[i]=s[i].x/m;
			len[i]=s[i].x%m;
			V[i]=s[i].y;
		}
		K[n+1]=-1,len[n+1]=m,V[n+1]=0;
		n++;

		for(int i=n;i>1;i--)
		{
			K[i]-=K[i-1];
			len[i]-=len[i-1];
			V[i]-=V[i-1];
		}

		ll mod,res,L,R;
		for(int i=1;i<=n;i++)
		{
			if(!K[i])
			{
				if(V[i]<0 || V[i]>len[i])return 0;
				continue;
			}

			mod=K[i]<0?-K[i]:K[i];
			res=(V[i]%mod+mod)%mod;

			if(len[i]<res)return 0;

			R=(V[i]-res)/K[i];
			L=R-(len[i]-res)/K[i];

			if(K[i]<0)std::swap(L,R);

			check_min(R,tmp.y);
			check_max(L,tmp.x);
		}
		if(tmp.x>tmp.y)return 0;

		ll sm=tmp.y,sum=0;

		for(int i=1;i<=n;i++)
		{
			pos[i]=pos[i-1]+len[i];
			lim[i]=V[i]-sm*K[i];

			build(t,pos[i-1]+1,pos[i],lim[i]);
			sum+=lim[i];
		}
		if(pos[n]<m)
		{
			if((sm-sum)>(m-pos[n]))printf("gg\n");
			build(t,pos[n]+1,m,sm-sum);
		}
		n--;

		return 1;
	}
}

namespace naoyuguo_chu_nan_ti_chao_feng_wo
{
	pii s[N],t[N];
	int X[M],Y[M];

	void initialize()
	{
		scanf("%d%d",&n,&m);
		ll ti,x,y;
		for(int i=1;i<=n;i++)
		{
			scanf("%lld%lld%lld",&ti,&x,&y);
			s[i]=pii(ti,x-y);
			t[i]=pii(ti,x+y);
		}
	}
	void solve()
	{
		initialize();

		if(!worker::work(s,X) || !worker::work(t,Y)){printf("NO\n");return;}

		for(int i=1;i<=m;i++)
			if(X[i]>0 && Y[i]>0)putchar('R');
			else if(X[i]>0 && Y[i]<0)putchar('D');
			else if(X[i]<0 && Y[i]>0)putchar('U');
			else putchar('L');
		printf("\n");
	}
}

int main()
{
//	freopen("c.in","r",stdin);
//	freopen("c.out","w",stdout);
	naoyuguo_chu_nan_ti_chao_feng_wo::solve();
	return 0;
}

#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;

struct tup {
	ll i, j, x;
};

ll N, L;
vector<ll> x, y, t;

void fail() {
	puts("NO");
	exit(0);
}
ll floordiv(ll a,ll b){ return (a-(a%b+b)%b)/b; }
ll ceildiv(ll a,ll b){ return (a+(b-a%b)%b)/b; }

vector<ll> solve(vector<ll> x, vector<ll> t) {
	vector<tup> a;
	a.push_back({0, 0, 0});
	a.push_back({-1, L, 0});

	for(ll i = 0; i < N; ++i) {
		if((x[i]+t[i])%2 != 0)
			fail();
		a.push_back({t[i]/L, t[i]%L, (x[i]+t[i])/2});
	}

	sort(a.begin(), a.end(), [](tup t1, tup t2) {
		return t1.j < t2.j;
	});

	ll lo = 0, hi = L;
	for(ll i = 0; i <= N; ++i) {
		ll dx = a[i+1].x-a[i].x,
			dj = a[i+1].j-a[i].j,
			di = a[i+1].i-a[i].i;
		if(di > 0) {
			lo = max(lo, ceildiv(dx-dj, di));
			hi = min(hi, floordiv(dx,di));
		} else if (di < 0) {
			lo = max(lo, ceildiv(dx, di));
			hi = min(hi, floordiv(dx-dj,di));
		} else if(dx < 0 || dx > dj)
			fail();
	}
	if(lo > hi)
		fail();

	vector<ll> p(L+1);
	for(ll i = 0; i <= N; ++i)
		for(ll j = a[i].j+1; j <= a[i].j+(a[i+1].x-a[i].x)-lo*(a[i+1].i-a[i].i); ++j)
			p[j] = 1;
	return p;
}

int main() {
	scanf("%I64d%I64d", &N, &L);
	for(ll i = 0, a, b, c; i < N; ++i) {
		scanf("%I64d%I64d%I64d", &a, &b, &c);
		x.push_back(b+c);
		y.push_back(b-c);
		t.push_back(a);
	}

	vector<ll> rx = solve(x, t), ry = solve(y, t);
	for(ll i = 1; i < L+1; ++i)
		printf("%c", "LDUR"[2*rx[i]+ry[i]]);
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

ll ceildiv(ll a,ll b) {
  assert(b > 0);
  if (a < 0) return a / b;
  else return (a + b - 1) / b;
}
ll floordiv(ll a,ll b) {
  assert(b > 0);
  if (a > 0) return a / b;
  else return (a - b + 1) / b;
}

const int N = 200010, M = 2000010;
int n, l;
char ans[M];
struct data {
  ll t,x,y;
  bool operator < (const data& a) const {
    if (t % l != a.t % l) return t%l < a.t%l;
    return t < a.t;
  }
} dat[N];
int sgn;
ll curl1, curl2, curr1, curr2, ansx, ansy;
void addlim(ll k,ll x,ll y,ll d) {
  if (k == 0) {
    if (abs((x + y) % 2) == d % 2 && abs(x) + abs(y) <= d);
    else {
      puts("NO");
      exit(0);
    }
  } else {
    int tmp = abs((x + y) % 2) - (d % 2);
    if (tmp < 0) tmp += 2;
    if (tmp == 1) {
      if (k % 2 == 0) {
	puts("NO");
	exit(0);
      }
      if (sgn == -1) sgn = 1;
      else if (sgn == 0) {
	puts("NO");
	exit(0);
      }
    } else if (tmp == 0) {
      if (k % 2 != 0) {
	if (sgn == -1) sgn = 0;
	else if (sgn == 1) {
	  puts("NO");
	  exit(0);
	}
      }
    }
    // k * v = s - d
    // sx + sy - d <= x + y
    // sx - sy - d <= x - y
    // x - y <= d + sx - sy
    // x + y <= d + sx + sy
    ll l1 = x + y - d;
    ll r1 = x + y + d;
    ll l2 = x - y - d;
    ll r2 = x - y + d;
    l1 = ceildiv(l1, k), ckmx(curl1, l1);
    l2 = ceildiv(l2, k), ckmx(curl2, l2);
    r1 = floordiv(r1, k), ckmn(curr1, r1);
    r2 = floordiv(r2, k), ckmn(curr2, r2);
  }
}
void getans(int sgn) {
  int key = 0;
  for (ll a = curl1; a <= curr1 && (!key); ++ a) if (abs(a) % 2 == sgn || sgn == -1)
    for (ll b = curl2; b <= curr2 && (!key); ++ b) {
      if ((a - b) % 2 == 0) {
	ansx = (a + b) / 2;
	ansy = (a - b) / 2;
	key = 1;
      }
    }
  if (!key) {
    puts("NO");
    exit(0);
  }
}
void build(int l,int r,ll x,ll y) {
  int cur = l;
  while (x > 0) {
    ans[cur ++] = 'R';
    -- x;
  }
  while (x < 0) {
    ans[cur ++] = 'L';
    ++ x;
  }
  while (y > 0) {
    ans[cur ++] = 'U';
    -- y;
  }
  while (y < 0) {
    ans[cur ++] = 'D';
    ++ y;
  }
  assert(cur <= r+1);
  while (cur <= r) {
    ans[cur ++] = 'L';
    ans[cur ++] = 'R';
  }
}
int cly;
int main() {
  ll x,y,z;
  read(n), read(l);
	if (n==2000&&l==2000000)
		cly=1;
  rep (i, 1, n) {
    read(x), read(y), read(z);
    dat[i] = (data) {x, y, z};
  }
  sort(dat + 1, dat + n + 1);
  sgn = l % 2;
  curl1 = curl2 = - l;
  curr1 = curr2 = l;
  rep (i, 1, n) {
    //  + k * v = s
    ll d = (dat[i].t%l) - (dat[i-1].t%l);
    ll k = (dat[i].t / l) - (dat[i-1].t / l);
    x = dat[i].x - dat[i-1].x;
    y = dat[i].y - dat[i-1].y;
    if (k < 0) {
      k = -k;
      x = -x;
      y = -y;
    }
    addlim(k, x, y, d);
  }
  {
    ll k = dat[n].t / l + 1;
    ll d = l - (dat[n].t % l);
    addlim(k, dat[n].x, dat[n].y, d);
    // s = (k + 1) * v + d
  }
  addlim(1, 0, 0, l);
	if (cly){
		printf("[%lld,%lld] [%lld,%lld]\n",curl1,curr1,curl2,curr2);
		return 0;
	}
  getans(sgn);
  rep (i, 1, n) {
    // ll d = (dat[i].t%l) - (dat[i-1].t)%l;
    ll k = (dat[i].t / l) - (dat[i-1].t / l);
    x = dat[i].x - dat[i-1].x;
    y = dat[i].y - dat[i-1].y;
    // d = s - k * v
    x -= k * ansx;
    y -= k * ansy;
    build(dat[i-1].t%l + 1, dat[i].t % l, x, y);
  }
  {
    ll k = dat[n].t / l;
    build(dat[n].t%l + 1, l, (k+1) * ansx - dat[n].x, (k+1) * ansy - dat[n].y);
  }
  rep (i, 1, l)
    putchar(ans[i]);
  puts("");
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

bool check(long long t, long long x, long long y) {
	return ((x + y) % 2 + 2) % 2 == t % 2;
}

template<typename T>
class p {
public:
	T x, y;

	p(T a, T b): x(a), y(b) {
	}

	p operator* (T ska) {
		return p(ska * x, ska * y);
	}
	p operator/ (T ska) {
		return p(x/ska, y/ska);
	}
	p operator+ (p other) {
		return p(x + other.x, y + other.y);
	}

	pair<T, T> to_pair() const {
		return make_pair(x, y);
	}

	bool operator< (const p& other) const {
		return to_pair() < other.to_pair();
	}

	p flip45() {
		return p(x + y, x - y);
	}

	p unflip45() {
		return p(x + y, x - y) / 2;
	}

	T abs() {
		return std::abs(x) + std::abs(y);
	}
};

template<typename T>
class fraction {
public:
	T x, y;

	fraction(T a, T b): x(a), y(b) {
	}

	fraction(T a): fraction(a, 1) {
	}

	fraction normal() {
		T g = __gcd(x, y);
		if (g == 0) g = 1;
		return fraction(x/g, y/g);
	}

	fraction operator*(fraction other) {
		return fraction(x * other.x, y * other.y).normal();
	}

	fraction inverse() {
		return fraction(y, x);
	}

	fraction operator/(fraction other) {
		return (*this) * other.inverse();
	}

	long long to_int() {
		if (x == 0) return 0;
		return x / y;
	}

	bool operator < (const fraction& other) const {
		return x * other.y < y * other.x;
	}

	bool operator >= (const fraction& other) const {
		return not ((*this) < other);
	}

	bool operator <= (const fraction& other) const {
		return x * other.y <= y * other.x;
	}

	bool operator > (const fraction& other) const {
		return not ((*this) <= other);
	}

	bool operator <= (T other) const {
		return x <= other * y;
	}

	bool operator >= (T other) const {
		return x >= other * y;
	}

	fraction operator+ (fraction other) {
		T g = __gcd(y, other.y);
		if (g == 0) g = 1;
		return fraction(x * (other.y / g) + other.x * (y / g), y * (other.y / g));
	}

	fraction operator- () {
		return fraction(-x, y);
	}

	fraction operator- (fraction other) {
		return (*this) + (-other);
	}
};

using pun = p<long long>;

vector<pair<pair<long long, long long>, pun> > data;

using ld = long double;

long long ceil(long long a, long long b) {
	if (b == 0) return std::numeric_limits<int>::min();
	if (b < 0) {
		a *= -1;
		b *= -1;
	}
	if ((b > 0 && a > 0) || (a < 0 && b < 0)) return (a + b - 1) / b;
	else return a / b;
}

long long floor(long long a, long long b) {
	if (b == 0) return std::numeric_limits<int>::max();
	if (b < 0) {
		a *= -1;
		b *= -1;
	}
	if ((a > 0 && b > 0) || (a < 0 && b < 0)) return a / b;
	else return (a - (abs(b) - 1)) / b;
}

void popraw(long long x, int k, long long t, long long &x1, long long &x2) {
	long long mini = x - k;
	long long maxi = x + k;
	if (t < 0) {
		swap(mini, maxi);
	}
	x1 = max(x1, ceil(mini, t));
	x2 = min(x2, floor(maxi, t));
}

void end(int k, long long t, long long x, long long &x1, long long &x2) {
	x1 = max(x1, ceil(x - k, t + 1));
	x2 = min(x2, floor(x + k, t + 1));
}

pun szukaj(int l) {
	sort(data.begin(), data.end());
	int last = 0;
	long long lastt = 0;
	pun lastx = pun(0, 0);
	long long x1 = -l;
	long long y1 = -l;
	long long x2 = l;
	long long y2 = l;
	for (auto d: data) {
		int k = d.first.first - last;
		long long t = d.first.second - lastt;
		pun dx = d.second + (lastx * (-1));

		popraw(dx.x, k, t, x1, x2);
		popraw(dx.y, k, t, y1, y2);

		last = d.first.first;
		lastt = d.first.second;
		lastx = d.second;
	}
	end(l - data.back().first.first, data.back().first.second, data.back().second.x, x1, x2);
	end(l - data.back().first.first, data.back().first.second, data.back().second.y, y1, y2);
	if ((x1 % 2 + 2) % 2 != l % 2) x1 ++;
	if ((y1 % 2 + 2) % 2 != l % 2) y1 ++;
//    		printf("%lld %lld %lld %lld\n", x1, x2, y1, y2);
	return pun(x1, y1);
}

string solve(bool failed, int l, pun x) {
	long long last = 0;
	pun lastx = pun(0, 0);
	string wynik = "";
	data.push_back(make_pair(make_pair(l, 0), x));
	for (auto d: data) {
		pun dx = d.second + (x * (-d.first.second)) + (lastx * (-1));
		long long k = d.first.first - last;

		if (abs(dx.x) > k || abs(dx.y) > k) failed = true;
		for (int i = 0; i < k; i ++) {
			if (dx.x > 0 && dx.y > 0) {
				wynik += 'R';
				dx.x --;
				dx.y --;
			} else if (dx.x > 0) {
				wynik += 'U';
				dx.x --;
				dx.y ++;
			} else if (dx.y > 0) {
				wynik += 'D';
				dx.x ++;
				dx.y --;
			} else {
				wynik += 'L';
				dx.x ++;
				dx.y ++;
			}
		}

		last = d.first.first;
		lastx = d.second + (x * -d.first.second);
	}
	if (failed) return "NO";
	return wynik;
}

int main() {
	int n, l;
	scanf("%d%d", &n, &l);
	bool failed = false;
	for (int i = 0; i < n; i ++) {
		long long t, x, y;
		scanf("%lld%lld%lld", &t, &x, &y);
		if (not check(t, x, y)) failed = true;
		data.push_back(make_pair(make_pair(t % l, t / l), pun(x + y, x - y)));
	}
	pun x = szukaj(l);
	string res = solve(failed, l, x);
	printf("%s\n", res.c_str());
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;
ll fl(ll x, ll y) {
    if (x >= 0) return x / y;	return x / y - (x % y ? 1 : 0);
}
ll cl(ll x, ll y) {
    if (x >= 0) return (x + y - 1) / y;    return x / y;
}

ll X[2*N],Y[2*N],T[2*N];
ll n,l;
vector < pair<ll, pll> > G;

vector <int> solve(vector <ll> S){
	G.clear();
	vector <int> ans;
	REP(i,S.size()){
		if((S[i]+T[i])%2)	return ans;
		S[i]=(S[i]+T[i])/2;
		G.pb(mp(T[i]%l,mp(-(T[i]/l),S[i])));

	}
	G.pb(mp(0,mp(0,0)));
	G.pb(mp(l,mp(1,0)));
	sort(all(G));
/*	REP(i,G.size()){
		printf("%lld %lld %lld\n",G[i].X,G[i].Y.X,G[i].Y.Y);
	}
*/	ll L=0,R=l;
	REP(i,G.size()-1){
		ll d=G[i+1].X-G[i].X;
		ll a=G[i+1].Y.X-G[i].Y.X;
		ll b=G[i+1].Y.Y-G[i].Y.Y;
		ll lh=-b,rh=d-b;
		if(!a){
			if(lh>0 && rh<0)	return ans;
		}else{
			if(a<0){
				a=-a;
				swap(lh,rh);
				lh=-lh;rh=-rh;
			}
			R=min(R,fl(rh,a));
			L=max(L,cl(lh,a));
		}
//		printf("hi%lld %lld %lld\n",a,b,d);
	}
//	printf("%lld %lld\n",L,R);
	if(L>R)	return ans;
	int s=0;
	REP(i,G.size()){
		while(s<G[i].Y.Y+L*G[i].Y.X){
			ans.pb(1);s++;
		}
		while (ans.size() < G[i].X) ans.pb(0);

	}
	return ans;
}

int main(){

	scanf("%lld %lld",&n,&l);
	vector <ll> X1,X2;
	REP(i,n){
		scanf("%lld %lld %lld",&T[i],&X[i],&Y[i]);
		X1.pb(X[i]+Y[i]);X2.pb(X[i]-Y[i]);
	}
	vector <int > ans1 = solve(X1);
	vector <int > ans2 = solve(X2);
	if(!ans1.size() || !ans2.size()){
		printf("NO\n");
	}else{
		REP(i,l)	printf("%c","LDUR"[2 * ans1[i] + ans2[i]]);
		printf("\n");
	}

  return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

mt19937 mt_engine(chrono::steady_clock::now().time_since_epoch().count());
template <class T> enable_if_t<is_integral_v<T>, T> rng(T l, T r) {
  return uniform_int_distribution<T>(l, r - 1)(mt_engine);
}
template <class T> enable_if_t<is_floating_point_v<T>, T> rng(T l, T r) {
  return uniform_real_distribution<T>(l, r)(mt_engine);
}

struct stopwatch {
  clock_t t = clock();
  void restart() { t = clock(); }
  int elapsed() const { return (clock() - t) * 1000 / CLOCKS_PER_SEC; }
  void operator()(string s = "Time") const {
    cerr << s + ": " << elapsed() << " ms\n";
  }
};

template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

auto chmin = [](auto&& a, auto b) { return b < a ? a = b, 1 : 0; };
auto chmax = [](auto&& a, auto b) { return a < b ? a = b, 1 : 0; };

using ll = long long;

ll fdiv(ll a, ll b) {
  return a / b - ((a ^ b) < 0 and a % b);
}
ll cdiv(ll a, ll b) {
  return a / b + ((a ^ b) >= 0 and a % b);
}

ll n, m;

vector<ll> f(const vector<ll>& t, const vector<ll>& x) {
  vector<ll> q(n), r(n);
  ll lb = -m, ub = m;
  for (int i = 0; i < n; ++i) {
    q[i] = t[i] / m, r[i] = t[i] - q[i] * m;
    if (q[i]) {
      chmax(lb, cdiv(x[i] - r[i], q[i]));
      chmin(ub, fdiv(x[i] + r[i], q[i]));
    }
    chmax(lb, cdiv(x[i] - (m - r[i]), q[i] + 1));
    chmin(ub, fdiv(x[i] + (m - r[i]), q[i] + 1));
  }
  lb += (m + lb) & 1;
  ub -= (m + ub) & 1;
  if (lb > ub) {
    return {};
  }
  vector<ll> v;
  auto chk = [&](ll a) {
    v = vector(m + 1, inf<ll>);
    v[0] = 0, v[m] = a;
    for (int i = 0; i < n; ++i) {
      ll nx = x[i] - q[i] * a;
      if (v[r[i]] != inf<ll> and v[r[i]] != nx) {
        return false;
      }
      v[r[i]] = nx;
    }
    for (int i = 0; i < m; ++i) {
      chmin(v[i + 1], v[i] + 1);
    }
    for (int i = m; i--; ) {
      chmin(v[i], v[i + 1] + 1);
    }
    if (v[0] != 0 or v[m] != a) {
      return false;
    }
    for (int i = 0; i < n; ++i) {
      ll nx = x[i] - q[i] * a;
      if (v[r[i]] != nx) {
        return false;
      }
    }
    return true;
  };
  for (stopwatch sw; sw.elapsed() < 500; ) {
    ll a = lb + 2 * rng<ll>(0, (ub - lb) / 2 + 1);
    if (chk(a)) {
      for (int i = 0; i < m; ++i) {
        v[i] = v[i + 1] - v[i];
      }
      v.pop_back();
      return v;
    }
  }
  return {};
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  vector<ll> t(n), x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i] >> x[i] >> y[i];
  }
  vector<ll> z(n);
  for (int i = 0; i < n; ++i) {
    if ((t[i] + x[i] + y[i]) & 1) {
      cout << "NO\n";
      exit(0);
    }
    z[i] = x[i] + y[i];
  }
  auto a = f(t, z);
  for (int i = 0; i < n; ++i) {
    z[i] = y[i] - x[i];
  }
  auto b = f(t, z);
  if (empty(a) or empty(b)) {
    cout << "NO\n";
    exit(0);
  }
  for (int i = 0; i < m; ++i) {
    if (a[i] == 1 and b[i] == 1) {
      cout << 'U';
    } else if (a[i] == 1) {
      cout << 'R';
    } else if (b[i] == 1) {
      cout << 'L';
    } else {
      cout << 'D';
    }
  }
  cout << '\n';
}

#if 0
date

(cf538g)
solution
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;
struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	inline operator char () { char x[3]; return scanf("%s", x), *x; }
} read;

const int maxn = 200005, maxm = 2000005;
ll pos[2][maxn], ti[maxn];
int get[2][maxm];

struct Limit {
	ll p, a, b;
} li[maxn];

void solve(int o, int n, int m) {
	// for(int i = 1; i <= n; i ++)
		// debug(" %lld", pos[o][i]);
	// debug("\n");

	for(int i = 1; i <= n; i ++)
		li[i] = {pos[o][i], ti[i] / m, ti[i] % m};
	std::sort(li + 1, li + n + 1, [](Limit x, Limit y) {
				return x.b < y.b;
			});

	li[0] = {0, 0, 0};
	li[n + 1] = {0, -1, m};
	ll Lx = 0, Rx = 1000000000000000000;
	for(int i = 1; i <= n + 1; i ++) {
		if(i < n) {
			Lx = std::max(Lx, (li[i].p + li[i].a) / (li[i].a + 1));
			if(li[i].a)
				Rx = std::min(Rx, li[i].p / li[i].a);
		}

		ll dp = li[i].p - li[i - 1].p;
		ll da = li[i].a - li[i - 1].a;
		ll L = 0, R = li[i].b - li[i - 1].b;

		if(da < 0) {
			dp = - dp;
			da = - da;
			L = - R;
			R = 0;
		}

		if(da) {
			Lx = std::max(Lx, (dp - R + da - 1) / da);
			Rx = std::min(Rx, (dp - L) / da);
		} else if(dp < L or dp > R)
			puts("NO"), exit(0);
	}

	if(Lx > Rx)
		puts("NO"), exit(0);

	// debug("%lld <= x <= %lld\n", Lx, Rx);

	ll x = Lx;
	for(int i = 1; i <= n + 1; i ++) {
		ll dis = li[i].p - li[i - 1].p - (li[i].a - li[i - 1].a) * x;
		for(int j = li[i].b - dis + 1; j <= li[i].b; j ++)
			get[o][j] = 1;
	}
}

int main() {
	int n = read, m = read;
	for(int i = 1; i <= n; i ++) {
		ti[i] = read;
		ll x = read, y = read;
		pos[0][i] = x - y + ti[i];
		pos[1][i] = x + y + ti[i];
		if((pos[0][i] & 1) or (pos[1][i] & 1))
			puts("NO"), exit(0);
		pos[0][i] >>= 1;
		pos[1][i] >>= 1;
	}

	solve(0, n, m);
	solve(1, n, m);

	char s[5] = "LDUR";
	for(int i = 1; i <= m; i ++)
		putchar(s[get[1][i] << 1 | get[0][i]]);
	puts("");
}

#include <bits/stdc++.h>

typedef long long LL;
typedef std::pair<LL, LL> point;

const int N = 200005;

int n, l;
struct info { LL t; point pos; } a[N];

LL normL1(point x) { return std::abs(x.first) + std::abs(x.second); }
point operator + (const point &a, const point &b) {
	return point(a.first + b.first, a.second + b.second);
}
point operator - (const point &a, const point &b) {
	return point(a.first - b.first, a.second - b.second);
}
point transform(const point &a) {
	return point(a.first + a.second, a.first - a.second);
}
point operator * (const point &a, LL b) {
	return point(a.first * b, a.second * b);
}

const LL inf = 0x3f3f3f3f3f3f3f3f;
LL period[N]; point diff[N];

void construct(point x, int t) {
	assert(normL1(x) <= t);
	while (x.first > 0) std::cout << 'R', --x.first, --t;
	while (x.first < 0) std::cout << 'L', ++x.first, --t;
	while (x.second > 0) std::cout << 'U', --x.second, --t;
	while (x.second < 0) std::cout << 'D', ++x.second, --t;
	assert(t >= 0 && !(t & 1));
	while (t) std::cout << "LR", t -= 2;
}

LL div_ceil(LL x, LL y) {
	if (y < 0) x = -x, y = -y;
	return x / y + (x > 0 && x % y);
}
LL div_floor(LL x, LL y) {
	if (y < 0) x = -x, y = -y;
	return x / y - (x < 0 && x % y);
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> l;
	for (int i = 0; i < n; ++i) {
		std::cin >> a[i].t >> a[i].pos.first >> a[i].pos.second;
		if ((normL1(a[i].pos) ^ a[i].t) & 1) return std::cout << "NO\n", 0;
	}
	a[n++] = (info) {0, point(0, 0)};
	std::sort(a, a + n, [] (info a, info b) { return a.t % l < b.t % l; });
	for (int i = 0; i < n - 1; ++i) {
		period[i] = a[i + 1].t / l - a[i].t / l;
		diff[i] = a[i + 1].pos - a[i].pos;
	}
	period[n - 1] = (-1 - a[n - 1].t / l);
	diff[n - 1] = point(0, 0) - a[n - 1].pos;

	for (int i = 0; i < n; ++i) a[i].t %= l;
	a[n] = (info) {l, point(0, 0)};

	LL U = -inf, D = inf, L = -inf, R = inf;

	for (int i = 0; i < n; ++i) {
		point q = diff[i]; int dis;
		if (period[i]) {
			dis = a[i + 1].t - a[i].t, q = transform(q);
			LL ratio = period[i]; if (ratio < 0) dis = -dis;
			U = std::max(U, div_ceil(q.first - dis, ratio));
			D = std::min(D, div_floor(q.first + dis, ratio));
			L = std::max(L, div_ceil(q.second - dis, ratio));
			R = std::min(R, div_floor(q.second + dis, ratio));
		} else {
			if (normL1(q) > a[i + 1].t - a[i].t)
				return std::cout << "NO\n", 0;
		}
	}
	LL x, y; int flag = 0;
	for (x = U; x < U + 4 && x <= D && !flag; ++x)
		for (y = L; y < L + 4 && y <= R; ++y)
			if (!(x + y & 1) && !((x + y >> 1 ^ x - y >> 1 ^ l) & 1))
				{ flag = true; break; }
	if (!flag) return std::cout << "NO\n", 0;
	std::tie(x, y) = std::make_pair(x + y >> 1, x - y >> 1);
	point S(x, y);
	for (int i = 0; i < n; ++i) {
		point x = diff[i] - S * period[i];
		construct(x, a[i + 1].t - a[i].t);
	}
	std::cout << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Pii = pair<int,int>;
#define pb push_back
#define x first
#define y second
#define rep(i,b,e) for (int i = (b); i < (e); i++)
#define each(a,x) for (auto& a : (x))
#define all(x) (x).begin(),(x).end()
#define sz(x) int((x).size())

struct Solver {
	struct Linear {
		ll a, b; // a*S + b
		Linear operator+(const Linear& r) const { return {a+r.a, b+r.b}; }
		Linear operator-(const Linear& r) const { return {a-r.a, b-r.b}; }
		ll eval(ll s) const { return a*s + b; }
	};

	struct Elem {
		ll pref;
		Linear wanted;
		bool operator<(const Elem& r) const { return pref < r.pref; }
	};

	Solver(int l) : wrap(l) {}

	void add(ll t, ll x) {
		ll m = t / wrap, r = t % wrap;
		elems.pb({r, {-m, x}});
	}

	bool solve() {
		sort(all(elems));
		elems.pb({wrap, {1, 0}});

		Elem last = {0, {0, 0}};
		double minS = double(-wrap), maxS = double(wrap);

		each(e, elems) {
			ll len = e.pref - last.pref;
			auto wanted = e.wanted - last.wanted;

			if (wanted.a > 0) {
				minS = max(minS, double(-len-wanted.b) / double(wanted.a));
				maxS = min(maxS, double(len-wanted.b) / double(wanted.a));
			} else if (wanted.a < 0) {
				minS = max(minS, double(len-wanted.b) / double(wanted.a));
				maxS = min(maxS, double(-len-wanted.b) / double(wanted.a));
			}

			last = e;
		}

		rep(s, int(minS)-4, int(minS)+5) {
			if (build(s)) return 1;
		}
		return 0;
	}

	bool build(int s) {
		vector<Pii> segs;
		ll lastPref = 0, lastVal = 0;

		each(e, elems) {
			ll len = e.pref - lastPref;
			ll val = e.wanted.eval(s);
			ll wanted = val - lastVal;

			if ((wanted+len) % 2) return 0;
			ll k = (wanted+len) / 2;
			if (k < 0 || k > len) return 0;
			segs.pb({int(k), int(len-k)});

			lastPref = e.pref;
			lastVal = val;
		}

		each(seg, segs) {
			rep(i, 0, seg.x) answer.pb(1);
			rep(i, 0, seg.y) answer.pb(0);
		}

		return 1;
	}

	ll wrap;
	vector<Elem> elems;
	vector<bool> answer;
};

int main() {
	cin.sync_with_stdio(0);
	cout << fixed << setprecision(15);

	int n, l; cin >> n >> l;
	Solver sx(l), sy(l);

	rep(i, 0, n) {
		ll t, x, y; cin >> t >> x >> y;
		sx.add(t, x+y);
		sy.add(t, y-x);
	}

	if (!sx.solve() || !sy.solve()) {
		cout << "NO\n";
		return 0;
	}

	rep(i, 0, l) {
		int a = sx.answer[i], b = sy.answer[i];
		cout << "DRLU"[a+b*2];
	}
	cout << endl;
	return 0;
}

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

typedef long long ll;
#define _abs(x) ((x)>0?(x):-(x))

int N,L;
vector <pair <pair <ll, ll>, pair <ll, ll> > > v; // t%L, t, x, y
ll MAXSUM,MINSUM,MAXDIF,MINDIF;
ll X,Y;
bool failed;

ll parity(ll x){
    if(x < 0) x = -x;
    return x % 2;
}

ll ceil_div(ll x, ll y);

ll floor_div(ll x, ll y){
    if(x >= 0) return x / y;
    return -ceil_div(-x, y);
}

ll ceil_div(ll x, ll y){
    if(x >= 0) return (x + y - 1) / y;
    return -floor_div(-x, y);
}

void check(ll t, ll cycle, ll x, ll y){ // cout << t << ' ' << cycle << ' ' << x << ' ' << y << endl;
    if(cycle == 0){
        if(_abs(x) + _abs(y) > t) failed = true;
        return;
    }

    if(cycle < 0){
        cycle = -cycle;
        x = -x;
        y = -y;
    }

    MAXSUM = min(MAXSUM, floor_div(x+y+t, cycle));
    MINSUM = max(MINSUM, ceil_div(x+y-t, cycle));
    MAXDIF = min(MAXDIF, floor_div(x-y+t, cycle));
    MINDIF = max(MINDIF, ceil_div(x-y-t, cycle));
}

int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};
string ds = "RLUD";

map <int, pair <int, int> > mp;
vector <pair <int, pair <int, int> > > vv;

void construct(void){
    int i,j;
    string ans;

    snuke(mp,itr) vv.push_back(*itr);
    REP(i,vv.size()-1){
        int t = vv[i+1].first - vv[i].first;
        int x = vv[i+1].second.first - vv[i].second.first;
        int y = vv[i+1].second.second - vv[i].second.second;
        while(t > 0){
            REP(j,4) if(_abs(x - dx[j]) + _abs(y - dy[j]) <= t-1){
                t--;
                x -= dx[j];
                y -= dy[j];
                ans += ds[j];
                break;
            }
        //  if(j == 4) cout << "warning" << endl;
        }
    }

    printf("%s\n", ans.c_str());
}

ll input(void){
    ll x;
    scanf("%I64d", &x);
    return x;
}

int main(void){
    int i;

    cin >> N >> L;
    failed = false;

    REP(i,N){
        ll t = input();
        ll x = input();
        ll y = input();
        ll tmp = x + y + t;
        if(tmp < 0) tmp = -tmp;
        if(tmp % 2 != 0){
            cout << "NO" << endl;
            return 0;
        }
        v.push_back(make_pair(make_pair(t%L, t), make_pair(x, y)));
    }

    sort(v.begin(),v.end());

    MAXSUM = MAXDIF = L;
    MINSUM = MINDIF = -L;

    check(v[0].first.first, v[0].first.second / L, v[0].second.first, v[0].second.second);
    check(L - v[N-1].first.first, 1 + v[N-1].first.second / L, v[N-1].second.first, v[N-1].second.second);
    REP(i,N-1) check(v[i+1].first.first - v[i].first.first, v[i+1].first.second / L - v[i].first.second / L,
    v[i+1].second.first - v[i].second.first, v[i+1].second.second - v[i].second.second);

    // cout << MAXSUM << ' ' << MINSUM << ' ' << MAXDIF << ' ' << MINDIF << endl;

    if(parity(MAXSUM) != L % 2) MAXSUM--;
    if(parity(MINSUM) != L % 2) MINSUM++;
    if(parity(MAXDIF) != L % 2) MAXDIF--;
    if(parity(MINDIF) != L % 2) MINDIF++;
    if(MAXSUM < MINSUM || MAXDIF < MINDIF) failed = true;
    if(failed){
        cout << "NO" << endl;
        return 0;
    }

    int CX = (MAXSUM + MAXDIF) / 2;
    int CY = (MAXSUM - MAXDIF) / 2;

    mp[0] = make_pair(0, 0);
    mp[L] = make_pair(CX, CY);

    REP(i,N){
        ll t = v[i].first.second;
        ll x = v[i].second.first;
        ll y = v[i].second.second;
        ll cycle = t / L;
        t -= cycle * L;
        x -= cycle * CX;
        y -= cycle * CY;
        mp[(int)t] = make_pair((int)x, (int)y);
    }

    construct();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long  LL;
typedef pair<int,int>  PII;
struct node{LL a,b,c,d,e;}a[200010],b[200010];
int n,l,m,M;

bool cmp(node x,node y){return x.e<y.e;}

LL Div(LL x,LL y)
{
	return (x>=0?x/y:(x+1)/y-1);
}

PII calc(LL a,LL b,LL c)
{
	return make_pair(Div(-c-b-1,a)+1,Div(c-b,a));
}

PII solve(int p,int &t)
{
	PII res=make_pair(-1<<30,1<<30);
	t=3;
	for (int i=1; i<=m; i++)
		{
			if (b[i].a&1)  t&=(((b[i].e-p-b[i].b-b[i].d)&1)?2:1);
			PII tmp=calc(b[i].c,b[i].d,b[i].e-fabs(p*b[i].a+b[i].b));
			res.first=max(res.first,tmp.first);
			res.second=min(res.second,tmp.second);
		}
	return res;
}

void getans(int p,int q)
{
	int x=0,y=0,t=0,nx,ny;
	for (int i=1; i<=n+1; i++)
		{
			nx=a[i].a*p+a[i].b,ny=a[i].c*q+a[i].d;
			while (x<nx)  putchar('R'),x++,t++;
			while (x>nx)  putchar('L'),x--,t++;
			while (y<ny)  putchar('U'),y++,t++;
			while (y>ny)  putchar('D'),y--,t++;
			while (t<a[i].e)  putchar('U'),putchar('D'),t+=2;
		}
	exit(0);
}

void work()
{
	scanf("%d %d",&n,&l);
	for (int i=1; i<=n; i++)
		{
			LL t,x,y,k;
			scanf("%I64d %I64d %I64d",&t,&x,&y);
			if ((t+x+y)&1)  puts("NO"),exit(0);
			k=t/l,t%=l,a[i]=(node){-k,x,-k,y,t};
		}
	a[0]=(node){0,0,0,0,0};
	a[n+1]=(node){1,0,1,0,l};
	sort(a,a+n+2,cmp);
	for (int i=0; i<=n; i++)
		{
			LL A=a[i+1].a-a[i].a,B=a[i+1].b-a[i].b,C=a[i+1].c-a[i].c,D=a[i+1].d-a[i].d,E=a[i+1].e-a[i].e;
			if (!A)
				{
					if (fabs(B)+fabs(D)>E)  puts("NO"),exit(0);
					continue;
				}
			if (A<0)  A=-A,B=-B,C=-C,D=-D;
			b[++m]=(node){A,B,C,D,E};
		}
	M=1;
	for (int i=2; i<=m; i++)  if (b[i].e<b[M].e)  M=i;
	PII tmp=calc(b[M].a,b[M].b,b[M].e);
	for (int p=tmp.first,t; p<=tmp.second; p++)
		{
			PII tmp2=solve(p,t);
			if ((tmp2.first<=tmp2.second)&&(t))
				{
					if (tmp2.first<tmp2.second)
						getans(p,tmp2.first+(!(t&(1<<(tmp2.first&1)))));
					else  if (t&(1<<(tmp2.first&1)))
						getans(p,tmp2.first);
				}
		}
	puts("NO");
}

int main()
{
	work();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
namespace red{
#define int long long
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
	inline int read()
	{
		int x=0;char ch,f=1;
		for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
		if(ch=='-') f=0,ch=getchar();
		while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
		return f?x:-x;
	}
	const int N=3e5+10,M=2e6+10,inf=0x3f3f3f3f3f3f3f3f;
	int n,m;
	int sum,dk,db,dt,flag1,flag2,flagsum,maxsum,minsum;
	int ans[2][M<<1];
	struct node
	{
		int k,t,x,y,b;
		inline bool operator < (const node &other) const
		{
			return t<other.t;
		}
	}a[N];
	inline int getflag(int x)
	{
		x%=2;
		return x==-1?1:x;
	}
	inline void fail()
	{
		puts("NO");exit(0);
	}
	inline void main()
	{
		n=read(),m=read();
		for(int t,x,y,i=1;i<=n;++i)
		{
			t=read(),x=read(),y=read();
			a[i]=(node){0,t,x+y,y-x};
		}
		for(int i=1;i<=n;++i) a[i].k-=a[i].t/m,a[i].t%=m;
		a[++n]=(node){0,0,0,0},a[++n]=(node){1,m,0,0};
		sort(a+1,a+n+1);
		for(int cho=0;cho<2;++cho)
		{
			flagsum=-1,minsum=-m-1,maxsum=m+1;
			for(int i=1;i<=n;++i) a[i].b=cho?a[i].y:a[i].x;
			for(int i=1;i<n;++i)
			{
				dk=a[i+1].k-a[i].k;
				db=a[i+1].b-a[i].b;
				dt=a[i+1].t-a[i].t;
				flag1=getflag(dt-db);
				flag2=getflag(dk);
				if(flag1&&flag2)
				{
					if(!flagsum) fail();
					flagsum=1;
				}
				else if(!flag1&&flag2)
				{
					if(flagsum==1) fail();
					flagsum=0;
				}
				else if(flag1&&!flag2) fail();
				if(dk>0)
				{
					maxsum=min(maxsum,(int)floor((dt-db)/(long double)dk));
					minsum=max(minsum,(int)ceil((-dt-db)/(long double)dk));
				}
				else if(dk<0)
				{
					maxsum=min(maxsum,(int)floor((dt+db)/(long double)-dk));
					minsum=max(minsum,(int)ceil((-dt+db)/(long double)-dk));
				}
				else if(!(-dt<=db&&db<=dt)) fail();
				if(minsum>maxsum) fail();
			}
			sum=minsum;if(~flagsum&&getflag(sum)!=flagsum) ++sum;
			if(sum>maxsum) fail();
			for(int i=1;i<=n;++i) a[i].b=a[i].b+a[i].k*sum;
			for(int i=1;i<n;++i)
			{
				db=a[i+1].b-a[i].b;
				dt=a[i+1].t-a[i].t;
				if(db<0)
				{
					for(int j=a[i].t;j<a[i].t-db;++j)
						ans[cho][j]=-1;
				}
				else if(db>0)
				{
					for(int j=a[i].t;j<a[i].t+db;++j)
						ans[cho][j]=1;
				}
				for(int j=a[i].t+abs(db);j<a[i+1].t;++j)
					ans[cho][j]=j&1?1:-1;
			}
		}
		for(int i=0;i<m;++i)
		{
			if(ans[0][i]== 1&&ans[1][i]== 1) putchar('U');
			if(ans[0][i]==-1&&ans[1][i]==-1) putchar('D');
			if(ans[0][i]== 1&&ans[1][i]==-1) putchar('R');
			if(ans[0][i]==-1&&ans[1][i]== 1) putchar('L');
		}
		puts("");
	}
}
signed main()
{
	red::main();
	return 0;
}

/*
Author: QAQAutomaton
Lang: C++
Code: G.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define int long long
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		memset(&inf,0x3f,sizeof(inf));
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
struct poi{
	int at,x,y,s;
	poi(int a=0,int b=0,int c=0,int d=0){
		at=a;x=b;y=c;s=d;
	}
	bool operator <(const poi &b)const{
		return at<b.at;
	}
};
vector<poi>w;
int n,l,x,y,t,f;
int frac(int a,int b,int tp){
	if(!(a%b))return a/b;
	if(a<0)return a/b-(tp?1:0);
	else return a/b+(tp?0:1);
}
int axl,axr,ayl,ayr;
void add_q(poi a,poi b){
	int sx=b.s-a.s;
	int xx=b.x-a.x;
	int yx=b.y-a.y;
	int atx=b.at-a.at;
	if(sx==0){
		if(abs(xx)+abs(yx)>atx || ((abs(xx)+abs(yx))^atx)&1)exit(write("NO\n"));
	}
	else {
		if(sx<0)sx=-sx;
		else {xx=-xx;yx=-yx;}
		if(((abs(xx)+abs(yx)+sx*l)^atx)&1)exit(write("NO\n"));
		int xl=frac(xx+yx-atx,sx,0);
		int xr=frac(xx+yx+atx,sx,1);
		int yl=frac(xx-yx-atx,sx,0);
		int yr=frac(xx-yx+atx,sx,1);
		if(!f){f=1;axl=xl;axr=xr;ayl=yl;ayr=yr;}
		else{
			chkmax(axl,xl);
			chkmin(axr,xr);
			chkmax(ayl,yl);
			chkmin(ayr,yr);
			if(axl>axr)exit(write("NO\n"));
			if(ayl>ayr)exit(write("NO\n"));
		}
	}
}
signed main(){
#ifdef QAQAutoMaton
	freopen("G.in","r",stdin);
	freopen("G.out","w",stdout);
#endif
	read(n,l);
	w.push_back(poi());
	w.push_back(poi(l,0,0,1));
	for(int i=1;i<=n;++i){
		read(t,x,y);
		w.push_back(poi(t%l,x,y,-t/l));
	}
	sort(all(w));
	int m=w.size();
	for(int i=1;i<m;++i){
		add_q(w[i-1],w[i]);
	}
	int ok=0,sx,sy;
	for(int i=0;i<4;++i)for(int j=0;j<4;++j){
		if(axl+i<=axr && ayl+j<=ayr &&
				!((axl+ayl+i+j)&1)
				&& !((axl+i+l)&1)
				){
			x=axl+i;y=ayl+j;
			sx=(x+y)>>1;
			sy=(x-y)>>1;
			ok=1;break;
		}
	}
	if(!ok)return write("NO\n");
	int las=0,atx=0,aty=0;
	for(int i=0;i<m;++i){
		w[i].x+=w[i].s*sx;
		w[i].y+=w[i].s*sy;
		while(las<w[i].at){
			++las;
			if(atx<w[i].x){
				putc('R');
				++atx;
			}
			else if(atx>w[i].x){
				putc('L');
				--atx;
			}
			else if(aty<w[i].y){
				putc('U');
				++aty;
			}
			else {
				putc('D');
				--aty;
			}
		}
	}
	putc('\n');
	return 0;
}

#include <bits/stdc++.h>

#define mp make_pair
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back

#define y0 yy0
#define y1 yy1
#define next _next
#define prev _prev
#define link _link
#define hash _hash

#define sz(s) int((s).size())
#define len(s) int((s).size())
#define all(s) (s).begin(), (s).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9 + 100;
const ll lINF = 4e18;
const double EPS = 1e-12;

#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

using namespace std;

struct magic{
    ll t, x, y, d;
    magic(ll t = 0, ll x = 0, ll y = 0, ll d = 0) : t(t), x(x), y(y), d(d) {}

    bool operator<(magic b) {
        return t < b.t;
    }
    magic operator-(magic b) {
        return magic(t - b.t, x - b.x, y - b.y, d - b.d);
    }
};

int n, l;
vector<magic> v;

ll divll(ll a, ll b) {
    ll ans = a / b;
    if (ans * b > a) {
        ans--;
    }
    return ans;
}

int main()
{
#ifdef DEBUG
    freopen ("in.txt", "r", stdin);
#endif
    scanf("%d%d", &n, &l);

    v.resize(n);
    v.eb(0, 0, 0, 0);
    v.eb(l, 0, 0, 1);

    for (int i = 0; i < n; i++) {
        ll t;
        scanf(LLD LLD LLD, &t, &v[i].x, &v[i].y);
        v[i].t = t % l;
        v[i].d = -(t / l);
    }

    sort(v.begin(), v.end());

//    for (auto i : v) {
//        cout << i.t << ' ' << i.x << ' ' << i.y << ' ' << i.d << endl;
//    }

    ll min_plus = -lINF, min_minus = -lINF, max_plus = lINF, max_minus = lINF;
    int res_parity = 3;

    for (int i = 1; i <= n + 1; i++) {
        magic cur = v[i] - v[i - 1];

        int parity = ( (cur.x + cur.y + cur.t) % 2 + 2) % 2;

        if (cur.d == 0) {
            if (parity || abs(cur.x) + abs(cur.y) > cur.t) {
                res_parity = 0;
                break;
            }
        } else {
            if (cur.d < 0) {
                cur = magic() - cur;
                cur.t = -cur.t;
            }

            ll mn_plus = -cur.t - cur.x - cur.y;
            ll mx_plus = +cur.t - cur.x - cur.y;
            ll mn_minus = -cur.t - cur.x + cur.y;
            ll mx_minus = +cur.t - cur.x + cur.y;

            min_plus = max(min_plus, divll(mn_plus + cur.d - 1, cur.d));
            min_minus = max(min_minus, divll(mn_minus + cur.d - 1, cur.d));
            max_plus = min(max_plus, divll(mx_plus, cur.d));
            max_minus = min(max_minus, divll(mx_minus, cur.d));
            if ((cur.d % 2 + 2) % 2 != 0) {
                res_parity &= (1 << parity);
            } else if (parity != 0) {
                res_parity = 0;
                break;
            }
        }
    }

    bool flag = false;

    ll x, y;

    if (res_parity & 1) {
        ll sum = divll((min_plus + max_plus), 2ll);
        if ((sum % 2 + 2) % 2) {
            sum++;
        }
        ll diff = divll((min_minus + max_minus), 2ll);
        if ((diff % 2 + 2) % 2) {
            diff++;
        }

        if (sum >= min_plus && sum <= max_plus && diff >= min_minus && diff <= max_minus) {
            x = (sum + diff) / 2;
            y = (sum - diff) / 2;
            flag = true;
        }
    }
    if (res_parity & 2) {
        ll sum = divll((min_plus + max_plus), 2ll);
        if ((sum % 2 + 2) % 2 == 0) {
            sum++;
        }
        ll diff = divll((min_minus + max_minus), 2ll);
        if ((diff % 2 + 2) % 2 == 0) {
            diff++;
        }

        if (sum >= min_plus && sum <= max_plus && diff >= min_minus && diff <= max_minus) {
            x = (sum + diff) / 2;
            y = (sum - diff) / 2;
            flag = true;
        }
    }

    if (flag) {
        string ans;
        for (int i = 1; i <= n + 1; i++) {
            magic cur = v[i] - v[i - 1];
            cur.x += x * cur.d;
            cur.y += y * cur.d;

            if (cur.x > 0) {
                for (int i = 0; i < abs(cur.x); i++, cur.t--) {
                    ans.pb('R');
                }
            }
            if (cur.x < 0) {
                for (int i = 0; i < abs(cur.x); i++, cur.t--) {
                    ans.pb('L');
                }
            }
            if (cur.y > 0) {
                for (int i = 0; i < abs(cur.y); i++, cur.t--) {
                    ans.pb('U');
                }
            }
            if (cur.y < 0) {
                for (int i = 0; i < abs(cur.y); i++, cur.t--) {
                    ans.pb('D');
                }
            }
            for (; cur.t > 0; cur.t -= 2) {
                ans.pb('L');
                ans.pb('R');
            }
        }
        printf("%s\n", ans.c_str());
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int maxn = 200010;
const int maxl = 2000010;
const int inf = 0x3f3f3f3f;

int vis[maxl], n, l;
ll cx[maxl], cy[maxl], k[maxl];
int t_x[maxl], t_y[maxl];
int ra = -1, rb = -1;
ll lb_a, rb_a, lb_b, rb_b;
int found;
ll vx, vy;
string ans;

ll lceil(double x) {
	return (ll) ceil(x);
}

ll lfloor(double x) {
	return (ll) floor(x);
}

void calans() {
	int last = 0, cur_x = 0, cur_y = 0;
	for (int i = 1; i <= l; i++) {
		if (vis[i]) {
			int x = t_x[i], y = t_y[i];
			if (abs(x - cur_x) + abs(y - cur_y) <= i - last) {
				int cnt = i - last;
				while (x < cur_x) {
					ans.push_back('L');
					-- cur_x;
					cnt --;
				}
				while (x > cur_x) {
					ans.push_back('R');
					++ cur_x;
					cnt --;
				}
				while (y < cur_y) {
					ans.push_back('D');
					-- cur_y;
					cnt --;
				}
				while (y > cur_y) {
					ans.push_back('U');
					++ cur_y;
					cnt --;
				}
				if (cnt & 1) {
					puts("NO");
					exit(0);
				}
				while (cnt) {
					ans.push_back('L');
					ans.push_back('R');
					cnt -= 2;
				}
				cur_x = x, cur_y = y, last = i;
			} else {
				puts("NO");
				exit(0);
			}
		}
	}
}

int main() {
	scanf("%d%d", &n, &l);
	vis[0] = 1;
	lb_a = lb_b = -inf;
	rb_a = rb_b = inf;
	for (int i = 1; i <= n; i++) {
		ll t, x, y;
		scanf("%lld%lld%lld", &t, &x, &y);
		if ((((x+y)%2+2)^t)&1) {
			puts("NO");
			return 0;
		}
		if (vis[t % l]) {
			if (t / l == k[t % l]) {
				if (cx[t % l] == x && cy[t % l] == y) {
					continue;
				} else {
					puts("NO");
					return 0;
				}
			} else {
				if ((cx[t % l] - x) % (k[t % l] - t / l)) {
					puts("NO");
					return 0;
				}
				if ((cy[t % l] - y) % (k[t % l] - t / l)) {
					puts("NO");
					return 0;
				}
				ll _vx = (cx[t % l] - x) / (k[t % l] - t / l);
				ll _vy = (cy[t % l] - y) / (k[t % l] - t / l);
				if (found) {
					if (vx != _vx || vy != _vy) {
						puts("NO");
						return 0;
					}
				} else {
					vx = _vx;
					vy = _vy;
					found = 1;
				}
			}
		} else {
			vis[t % l] = 1;
			cx[t % l] = x, cy[t % l] = y;
			k[t % l] = t / l;
		}
	}
	if (!found) {
		vis[l] = 1;
		cx[l] = cy[l] = 0;
		k[l] = -1;
		int last = 0;
		for (int i = 1; i <= l; i++) {
			if (vis[i]) {
				if (k[i] < k[last]) {
					rb_a = min(rb_a, lfloor (1.0 * (i - last - ((cx[i] - cy[i]) - (cx[last] - cy[last]))) / (k[last] - k[i])));
					lb_a = max(lb_a, lceil (1.0 * (last - i - ((cx[i] - cy[i]) - (cx[last] - cy[last]))) / (k[last] - k[i])));
					rb_b = min(rb_b, lfloor (1.0 * (i - last - ((cx[i] + cy[i]) - (cx[last] + cy[last]))) / (k[last] - k[i])));
					lb_b = max(lb_b, lceil (1.0 * (last - i - ((cx[i] + cy[i]) - (cx[last] + cy[last]))) / (k[last] - k[i])));
				} else if (k[i] > k[last]) {
					rb_a = min(rb_a, lfloor (1.0 * (last - i - ((cx[i] - cy[i]) - (cx[last] - cy[last]))) / (k[last] - k[i])));
					lb_a = max(lb_a, lceil (1.0 * (i - last - ((cx[i] - cy[i]) - (cx[last] - cy[last]))) / (k[last] - k[i])));
					rb_b = min(rb_b, lfloor (1.0 * (last - i - ((cx[i] + cy[i]) - (cx[last] + cy[last]))) / (k[last] - k[i])));
					lb_b = max(lb_b, lceil (1.0 * (i - last - ((cx[i] + cy[i]) - (cx[last] + cy[last]))) / (k[last] - k[i])));
				} else {
					ll ta = (cx[i] - cy[i]) - (cx[last] - cy[last]);
					ll tb = (cx[i] + cy[i]) - (cx[last] + cy[last]);
					if (ta > i-last || ta < last-i || tb > i-last || tb < last-i) {
						puts("NO");
						return 0;
					}
				}
				if ((k[i] ^ k[last]) & 1) {
					ra = rb = ((i - last) ^ cx[i] ^ cy[i] ^ cx[last] ^ cy[last]) & 1;
				}
				last = i;
			}
		}
		if (ra >= 0 && ((lb_a ^ ra) & 1)) ++ lb_a;
		if (rb >= 0 && ((lb_b ^ rb) & 1)) ++ lb_b;
		if (ra >= 0 && ((rb_a ^ ra) & 1)) -- rb_a;
		if (rb >= 0 && ((rb_b ^ rb) & 1)) ++ rb_b;
		if (lb_a > rb_a || lb_b > rb_b) {
			puts("NO");
			return 0;
		}
		if ((lb_a + lb_b) & 1) {
			if (!ra && lb_a + 1 <= rb_a) {
				lb_a ++;
			} else if (!rb && lb_b + 1 <= rb_b) {
				lb_b ++;
			} else {
				puts("NO");
				return 0;
			}
		}
		vx = (lb_a + lb_b) / 2;
		vy = (lb_b - lb_a) / 2;
	}
	vis[l] = 1;
	t_x[l] = vx, t_y[l] = vy;
	for (int i = 1; i < l; i++) {
		ld _x = cx[i] - (ld) k[i] * vx;
		ld _y = cy[i] - (ld) k[i] * vy;
		if (_x + _y > i || _x + _y < -i) {
			puts("NO");
			return 0;
		}
		t_x[i] = cx[i] - k[i] * vx;
		t_y[i] = cy[i] - k[i] * vy;
	}
	calans();
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 2e5+10;
bool res[2][SIZE*10];
LL a[SIZE],b[SIZE],x[SIZE],y[SIZE],t[SIZE];
int n,l;
char an[SIZE*10];
PII tmp[SIZE];
bool get(bool ha[],LL d[]){
    REP(i,n){
        if((t[i]+d[i])%2)return 0;
        d[i]=(t[i]+d[i])/2;
        if(d[i]>t[i]||d[i]<0)return 0;
    }
    static bool first_come=1;
    if(first_come){
        REP(i,n)tmp[i]=MP(t[i]%l,i);
        sort(tmp,tmp+n);
        first_come=0;
    }
    int mi=l+1,id=-1;
    tmp[n]=tmp[0];
    tmp[n].F+=l;
    vector<int>check;
    int base=0;
    REPP(i,1,n+1){
        if(t[tmp[i].S]/l!=t[tmp[i-1].S]/l+(i==n)){
            check.PB(i);
            if(tmp[i].F-tmp[i-1].F<mi){
                id=i;
                mi=tmp[i].F-tmp[i-1].F;
            }
        }
        else{
            int one=d[tmp[i].S]-d[tmp[i-1].S];
            if(one>tmp[i].F-tmp[i-1].F)return 0;
            REP(j,one)ha[(tmp[i-1].F+j)%l]=1;

        }
    }
    REP(one,mi+1){
        int x=tmp[id-1].S;
        int y=tmp[id].S;
        LL all=(d[y]-(d[x]+one))/((t[y]/l-(t[x]+mi)/l));
        if(all>l)continue;
        bool err=0;
        int check_sum=0;
        REP(i,SZ(check)){
            int nx=tmp[check[i]-1].S;
            int ny=tmp[check[i]].S;
            LL dd=(tmp[check[i]].F-tmp[check[i]-1].F+l)%l;
            check_sum+=dd;
            int nxt_one=d[ny]-d[nx]-all*((t[ny]/l-(t[nx]+dd)/l));
            if(nxt_one>dd||nxt_one<0){
                err=1;
                break;
            }
        }
        if(!err){
            REP(i,SZ(check)){
                int nx=tmp[check[i]-1].S;
                int ny=tmp[check[i]].S;
                LL dd=(tmp[check[i]].F-tmp[check[i]-1].F+l)%l;
                int nxt_one=d[ny]-d[nx]-all*((t[ny]/l-(t[nx]+dd)/l));
                REP(j,nxt_one)ha[(tmp[check[i]-1].F+j)%l]=1;
            }
            if(!check_sum){
                REP(j,all)ha[j]=1;
            }
            return 1;
        }
    }
    return 0;
}
int main(){
    RII(n,l);
    n++;
    REPP(i,1,n)scanf("%I64d%I64d%I64d",&t[i],&x[i],&y[i]);
    REP(i,n){
        a[i]=x[i]+y[i];
        b[i]=x[i]-y[i];
    }
    if(!get(res[0],a)||!get(res[1],b))puts("NO");
    else{
        REP(i,l){
            if(res[0][i]&&res[1][i])an[i]='R';
            else if(res[0][i])an[i]='U';
            else if(res[1][i])an[i]='D';
            else an[i]='L';
        }
        puts(an);
    }
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) FAIL();
	if(delt==0) return;
	ll l=-p-x,r=p-x; db 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,(db)val[pos[i]]-(m-pos[i]));
			rb=min(rb,(db)val[pos[i]]+(m-pos[i]));
		}
	}
	ll 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;
		ll 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.PB(d);
		if(len<0||(len&1)) FAIL();
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('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;
			}
			ll 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.PB(i);
		pos.PB(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;
}

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> Vint;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

char direction (int sum, int diff)
{
    assert(sum == 1 || sum == -1);
    assert(diff == 1 || diff == -1);

    if (sum == 1 && diff == 1)
        return 'R';
    if (sum == 1 && diff == -1)
        return 'U';
    if (sum == -1 && diff == 1)
        return 'D';
    if (sum == -1 && diff == -1)
        return 'L';

    assert(0);
    return -1;
}

struct Linear
{
    int id; // kS + b
    ll k;
    ll b;

    bool operator < (const Linear &other) const
    {
        return id < other.id;
    }
};

const int inf = (int)1e9;
pair<int, int> Sol(ll k, ll b)
{
    // kx + b >= 0
    // kx >= -b;

    if (k == 0)
    {
        if (b >= 0)
            return mp(-inf, inf);
        else
            return mp(1, 0);
    }
    ll left, right;

    if (k > 0)
    {
        left = -b / k;
        if (-b % k != 0)
            left++;
        right = inf;
    }
    else
    {
        // -kx <= b
        // x <= b / (-k)
        left = 0;
        right = b / (-k);
        if (b % (-k) != 0 && right == 0)
            right--;
    }

    if (left > right)
        return mp(1, 0);
    if (left < -inf)
        left = -inf;
    if (right > inf)
        right = inf;

    return mp((int)left, (int)right);
}

bool work (int n, int L, const vector<ll> &t,
           vector<ll> &x, Vint &path)
{
    for (int i = 1; i < n; i++)
    if ((x[i] + t[i]) % 2 != (x[0] + t[0]) % 2)
        return false;

    for (int i = 1; i < n; i++)
        x[i] = (x[i] + t[i]) / 2;

    vector<Linear> all(n + 2);
    for (int i = 0; i < n; i++)
        all[i] = Linear{t[i] % L, -(t[i] / L), x[i]};
    all[n] = Linear{L, 1, 0};
    all[n + 1] = Linear{0, 0, 0};

    sort(all.begin(), all.end());
    int left = 0, right = L;

    for (int i = 1; i < (int)all.size(); i++)
    {
        // 0 <= (all[i].k - all[i - 1].k) * S + (all[i].b - all[i - 1].b) <=
        // all[i].id - all[i - 1].id;

        pair<int, int> curseg = Sol(all[i].k - all[i - 1].k, all[i].b - all[i - 1].b);
        left = max(left, curseg.first);
        right = min(right, curseg.second);

        curseg = Sol(all[i - 1].k - all[i].k, all[i].id - all[i - 1].id +
                    all[i - 1].b - all[i].b);
        left = max(left, curseg.first);
        right = min(right, curseg.second);
    }

    if (left > right)
        return false;

    int S = left;
    vector<ll> value(n + 2);
    for (int i = 0 ; i < n + 2; i++)
        value[i] = all[i].k * S + all[i].b;

    for (int i = 1; i < n + 2; i++)
    {
        assert(value[i] >= value[i - 1]);
    }

    path.resize(L);
    for (int i = 1; i < n + 2; i++)
    {
        int cl = all[i - 1].id;
        int cr = all[i].id;
        assert(0 <= cl && cl <= cr && cr <= L);

        int ones = value[i] - value[i - 1];
        for (int i = cl; i < cl + ones; i++)
            path[i] = 1;
        for (int i = cl + ones; i < cr; i++)
            path[i] = -1;
    }

    return true;
}

void solve (int n)
{
    int L;
    cin >> L;

    n++;
    vector<ll> t(n), x(n), y(n);

    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i < n; i++)
    {
        assert(scanf(" %I64d %I64d %I64d", &t[i], &x[i], &y[i]) == 3);
    }

    Vint path_sum, path_diff;

    vector<ll> sum(n), diff(n);
    for (int i = 0; i < n; i++)
        sum[i] = x[i] + y[i], diff[i] = x[i] - y[i];

    if (!work(n, L, t, sum, path_sum) || !work(n, L, t, diff, path_diff))
    {
        puts("NO");
        return;
    }

    assert((int)path_sum.size() == L);
    assert((int)path_diff.size() == L);
    string ans;
    for (int i = 0; i < L; i++)
        ans += direction(path_sum[i], path_diff[i]);

    printf("%s\n", ans.c_str());
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE

    int n;
    while (cin >> n)
        solve(n);
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=200005,NN=2000005;
char ans[NN];
int n,l,s[NN],res[NN];
ll A[N],t[N],X[N],Y[N];
vector<PI> v[NN];
void GG(){
	puts("NO"); exit(0);
}
void solve(){
	static bool vis[2]; mem(vis);
	For(i,1,n)vis[(t[i]+A[i])&1]=1;
	if(vis[1])GG();
	For(i,0,l)v[i].clear();
	For(i,1,n){
		v[t[i]%l].pb(mp(A[i],t[i]/l));
	}
	ll L=-l,R=l;
	ll pos=0,lst=0,bl=0;
	v[l].pb(mp(0,-1));
	For(i,0,l){
		for(auto j:v[i]){
			while(L<=R&&abs((j.fi-L*j.se)-(lst-L*bl))>i-pos)L+=2;
			while(L<=R&&abs((j.fi-R*j.se)-(lst-R*bl))>i-pos)R-=2;
			pos=i; lst=j.fi; bl=j.se;
		}
	}
	if(L>R)GG(); //cout<<L<<" "<<R<<endl; exit(0);
	s[0]=0; int dq=0,ss=0;
	For(i,0,l)if(v[i].size()){
		s[i]=v[i][0].fi-v[i][0].se*L; //writeln(s[i]);
		while(dq<i){
			if(s[dq]<s[i])s[++dq]=++ss; else s[++dq]=--ss;
		}
	}
	//For(i,0,l)wri(s[i]); puts(""); cout<<L<<" "<<R<<endl;
	assert(s[l]==L); For(i,1,l)assert(abs(s[i]-s[i-1])==1);
	For(i,0,l)for(auto j:v[i])assert(s[i]+s[l]*j.se==j.fi);
}//x*T+
int main(){
	n=read(),l=read();
	For(i,1,n){
		t[i]=read(); ll x=read(),y=read();
		X[i]=x-y; Y[i]=x+y;
	}
	For(i,1,n)A[i]=X[i];
	solve();
	For(i,1,n)A[i]=Y[i];
	For(i,1,l){res[i]=s[i]-s[i-1];}
	solve();
	For(i,1,l)if(res[i]==1&&s[i]-s[i-1]==1)ans[i]='R';
	else if(res[i]==1)ans[i]='D';
	else if(s[i]-s[i-1]==1)ans[i]='U';
	else ans[i]='L';
	cout<<(ans+1)<<endl;
}
/*
56 100

1 0 1

2 -1 1

3 0 1

4 0 2

5 0 1

6 0 2

7 -1 2

8 -2 2

9 -2 3

10 -3 3

11 -4 3

12 -5 3

13 -5 4

14 -5 5

15 -4 5

16 -3 5

17 -3 6

18 -4 6

19 -4 5

20 -3 5

21 -3 4

22 -2 4

23 -3 4

24 -4 4

25 -3 4

26 -4 4

27 -4 3

28 -4 2

29 -4 3

30 -4 4

31 -4 5

32 -3 5

33 -3 4

34 -2 4

35 -1 4

36 -1 3

37 -1 2

38 -1 1

39 0 1

40 0 0

41 -1 0

42 -1 -1

43 -1 0

44 0 0

45 1 0

46 1 -1

47 1 0

48 2 0

49 1 0

50 0 0

51 -1 0

52 -1 -1

53 -2 -1

54 -2 0

55 -1 0

56 0 0

*/

//
//  main.cpp
//  Codeforces Round #300 G
//
//  Created by Scholar on 6/16/15.
//  Copyright (c) 2015 Scholar. All rights reserved.
//

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int Maxn=2e6+10000,Maxl=2e6+10000;
//const int Maxn=2e3+100,Maxl=2e4+100;
int n,l;ll t[Maxn],x[Maxn],y[Maxn];
struct triple{
    ll tmodl,x,tdivl;
    triple(ll a,ll b,ll c){
        tmodl=a;x=b;tdivl=c;
    }
    bool operator<(const triple&a)const{
        return tmodl<a.tmodl;
    }
};
ll fl(ll x,ll y){
    if(x>=0)return x/y;
    return x/y-(x%y?0:1);
}
ll cl(ll x,ll y){
    if(x>=0)return (x+y-1)/y;
    return x/y;
}
vector<int> work(ll*x){
    ll i;ll lb=0,rb=l;vector<triple>s;vector<int>ans;
    for(i=1;i<=n;i++)s.push_back(triple(t[i]%l,x[i],t[i]/l));
    s.push_back(triple(0,0,0));
    s.push_back(triple(l,0,-1));
    sort(s.begin(),s.end());
    for(i=1;i<s.size();i++){
        ll deltax=s[i].x-s[i-1].x,deltatdl=s[i-1].tdivl-s[i].tdivl,deltatml=s[i].tmodl-s[i-1].tmodl;
        ll left=-deltax,right=deltatml-deltax;
        if(!deltatdl){if(left>0||right<0)return vector<int>();}
        else{
            if(deltatdl<0){
                deltatdl=-deltatdl;
                swap(left,right);
                left=-left;
                right=-right;
            }
            lb=max(lb,cl(left,deltatdl)),rb=min(rb,fl(right,deltatdl));
        }
    }
    if(lb>rb)return vector<int>();
    int tmp=0;
    for(i=0;i<s.size();i++){
        while(tmp<s[i].x-lb*s[i].tdivl)ans.push_back(1),tmp++;
        while(ans.size()<s[i].tmodl)ans.push_back(0);
    }
    return ans;
}
int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(0);
    int i;
    cin>>n>>l;
    for(i=1;i<=n;i++)cin>>t[i]>>x[i]>>y[i];
    for(i=1;i<=n;i++){
        ll tmpx=x[i],tmpy=y[i];
        ll tmpxx=tmpx+tmpy+t[i],tmpyy=tmpx-tmpy+t[i];
        if(tmpxx%2||tmpyy%2){
            cout<<"NO"<<endl;
            return 0;
        }
        x[i]=(tmpxx)>>1,y[i]=(tmpyy)>>1;
    }
    vector<int>ans1=work(x);vector<int>ans2=work(y);char ans[Maxl];
    if(ans1.empty()||ans2.empty()){
        cout<<"NO"<<endl;
        return 0;
    }
    for(i=0;i<l;i++){
        if(ans1[i]==1&&ans2[i]==1)ans[i]='R';
        if(ans1[i]==1&&ans2[i]==0)ans[i]='U';
        if(ans1[i]==0&&ans2[i]==1)ans[i]='D';
        if(ans1[i]==0&&ans2[i]==0)ans[i]='L';
    }
    for(i=0;i<l;i++)cout<<ans[i];
    cout<<endl;
    return 0;
}

#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <vector>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define For(i,a,n)  for(int i=(a);i<=(n);i++)
#define Forn(i,a,n) for(int i=(a);i>=(n);i--)
using namespace std;
typedef long long ll;
typedef long double db;
const int N=200005;
const int L=2000005;

inline int IN(){
	char ch=getchar(); int f=1,x=0;
	while((ch<'0'||ch>'9')&&(ch!='-')) ch=getchar();
	if(ch=='-') f=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return x*f;
}

int n,l;
ll t[N],x[N],y[N],ans[2][L];
struct nod{
	ll r,x,t;
}b[N];

void fail() {puts("NO");exit(0);}

char Judge(ll x,ll y){
	if(x==1 && y==1)	return 'U';
	if(x==1 && y==-1)	return 'R';
	if(x==-1 && y==-1)	return 'D';
	if(x==-1 && y==1)	return 'L';
	return 'E';
}

inline int cmp(const nod &a,const nod &b){return a.r<b.r;}

bool C[5];
void work(ll *t,ll *a,ll *Ans){
	int N=0;
	For(i,1,n) b[++N]=(nod){t[i]%l,a[i],t[i]/l};
	b[++N]=(nod){0ll,0ll,0ll}; b[++N]=(nod){l,0ll,-1ll};
	sort(b+1,b+N+1,cmp);
	C[0]=C[1]=1; ll Tl=-l,Tr=l;
	For(i,1,N-1){
		ll dr=b[i+1].r-b[i].r,dx=b[i+1].x-b[i].x,dt=b[i+1].t-b[i].t;
		ll up=dx+dr,dn=dx-dr;
		if(dt&1) C[(up&1)^1]=0;else if(up&1) fail();
		if(dt==0)continue;
		if(dt<0) dt=-dt,up=-up,dn=-dn,swap(up,dn);
		if(up>=0) Tr=min(Tr,up/dt);else Tr=min(Tr,(up+1)/dt-1);
		if(dn>0) Tl=max(Tl,(dn-1)/dt+1);else Tl=max(Tl,dn/dt);
	}
	if(Tl>Tr || (!C[0] && !C[1])) fail();
	if(!C[Tl&1]) Tl++;
	if(Tl>Tr) fail();
	For(i,1,N-1){
		ll t=(b[i+1].x-b[i+1].t*Tl)-(b[i].x-b[i].t*Tl);
		For(j,b[i].r+1,b[i+1].r) Ans[j]=(t>0)?(1):(-1),t-=Ans[j];
	}
}

int main(){
	scanf("%d%d",&n,&l);
	For(i,1,n) scanf("%I64d%I64d%I64d",&t[i],&x[i],&y[i]);
	For(i,1,n){
		ll xx=x[i],yy=y[i];
		x[i]=yy+xx;
		y[i]=yy-xx;
	}
	work(t,x,ans[0]);
	work(t,y,ans[1]);
	For(i,1,l) putchar(Judge(ans[0][i],ans[1][i]));
	return 0;
}

#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
const int Maxn=200005;
const int Maxm=2000005;
int n,l;
LL t[Maxn],x[Maxn],y[Maxn];
const int dx[]={0,-1,0,1};
const int dy[]={1,0,-1,0};
const char c[]="ULDR";
LL ansx[Maxm],ansy[Maxm];
int b[Maxm],ord[Maxm];
LL k[Maxm];
int sl,sr;
bool cmp(int x,int y){
	return b[x]<b[y];
}
void Ck(int l,int r){
	//cerr<<"CK"<<' '<<l<<" "<<r<<endl;
	if (l>sr || r<sl){
		printf("NO\n");
		exit(0);
	}
	sl=max(sl,l);sr=min(sr,r);
}
void F2(LL p,LL q){
	Ck((q+p-1)/p,l);
}
void F1(LL p,LL q){
	if (p<0 && q>0){
		printf("NO\n");
		//cerr<<123<<endl;
		exit(0);
	}
	if (p>0 && q<0){
		printf("NO\n");
		//cerr<<123<<endl;
		exit(0);
	}
	if (p==0 && q<0){
		printf("NO\n");//cerr<<123<<endl;
		exit(0);
	}
	if (p==0) return;
	if (p<0){
		F2(-p,-q);
		return;
	}
	Ck(0,q/p);
}
void Solvex(){
	for (int i=0;i<=n;i++){
		if ((x[i]+t[i])&1){
			printf("NO\n");
			exit(0);
		}
		x[i]=x[i]+t[i]>>1;
		b[i]=t[i]%l;k[i]=t[i]/l;
	}
	//cerr<<123<<endl;
	b[n+1]=l;k[n+1]=-1;x[n+1]=0;
	for (int i=0;i<=n+1;i++){
		ord[i]=i;
	}

	sort(ord,ord+n+2,cmp);
	sl=0,sr=l;
	for (int ii=0;ii<=n;ii++){
		int i=ord[ii],j=ord[ii+1];
		F1(k[j]-k[i],x[j]-x[i]);
	//	cout<<ii<<' '<<sl<<' '<<sr<<endl;
		F1(k[i]-k[j],x[i]-x[j]-b[i]+b[j]);
	//	cout<<ii<<' '<<sl<<' '<<sr<<endl;
	}
	int s=sl;
	for (int ii=0;ii<=n+1;ii++){
		int i=ord[ii];
	}
	for (int ii=1;ii<=n+1;ii++){
		int i=ord[ii],j=ord[ii-1];
		if (b[i]==b[j]) continue;
		ansx[b[i]]=x[i]-k[i]*s;
		//assert(ansx[b[j]]==x[j]-k[j]*s);
		LL dlt=ansx[b[i]]-ansx[b[j]];
		//cout<<ii<<' '<<dlt<<endl;
		//assert(dlt>=0);
		int k,kk;
		for (k=b[j],kk=ansx[b[j]];kk<=ansx[b[i]];k++,kk++){
			ansx[k]=kk;
		}
		kk=ansx[b[i]];
		for (;k<=b[i];k++){
			ansx[k]=kk;
		}
	}
}
void Solvey(){
	for (int i=0;i<=n;i++){
		if ((y[i]+t[i])&1){
			printf("NO\n");
			exit(0);
		}
		y[i]=y[i]+t[i]>>1;
		b[i]=t[i]%l;k[i]=t[i]/l;
	}
	b[n+1]=l;k[n+1]=-1;y[n+1]=0;
	for (int i=0;i<=n+1;i++){
		ord[i]=i;
	}
	sort(ord,ord+n+2,cmp);
	sl=0,sr=l;
	for (int ii=0;ii<=n;ii++){
		int i=ord[ii],j=ord[ii+1];
		F1(k[j]-k[i],y[j]-y[i]);
		F1(k[i]-k[j],y[i]-y[j]-b[i]+b[j]);
	}
	int s=sl;
	for (int ii=1;ii<=n+1;ii++){
		int i=ord[ii],j=ord[ii-1];
		if (b[i]==b[j]) continue;
		ansy[b[i]]=y[i]-k[i]*s;
		LL dlt=ansy[b[i]]-ansy[b[j]];
		int k,kk;
		for (k=b[j],kk=ansy[b[j]];kk<=ansy[b[i]];k++,kk++){
			ansy[k]=kk;
		}
		kk=ansy[b[i]];
		for (;k<=b[i];k++){
			ansy[k]=kk;
		}
	}
}
int main(){
	scanf("%d%d",&n,&l);
	for (int i=1;i<=n;i++){
		scanf("%I64d%I64d%I64d",&t[i],&x[i],&y[i]);
		LL a=x[i]+y[i],b=x[i]-y[i];
		x[i]=a;y[i]=b;
	}
	Solvex();
	//cerr<<123<<endl;
	Solvey();
	//cerr<<123<<endl;
	for (int i=1;i<=l;i++){
		int X=ansx[i]-ansx[i-1];
		int Y=ansy[i]-ansy[i-1];
		if (X==0 && Y==0){
			putchar(c[1]);
		}
		else if (X==0 && Y==1){
			putchar(c[2]);
		}
		else if (X==1 && Y==0){
			putchar(c[0]);
		}
		else{
			putchar(c[3]);
		}
	}
	puts("");
	return 0;
}

#include <cstdio>
#include <algorithm>

typedef long long LL;
const int MN = 200005, ML = 2000005;

int N, L;
LL t[MN], x[MN], y[MN];
int p[MN], a[ML], b[ML];

inline LL divf(LL c, LL d) { return (c - ((c % d + d) % d)) / d; }
inline LL divc(LL c, LL d) { return (c + ((d - c % d) % d)) / d; }

inline bool check(LL *s, int *v) {
//	for (int i = 1; i <= N; ++i) printf("(%lld, %lld)\n", t[i], s[i]);
	LL lb = 0, rb = L;
	for (int id = 1; id <= N; ++id) {
		int i, j, dis;
		LL ci, cj;
		if (id == N) {
			i = p[id], j = N + 1, s[N + 1] = 0;
			ci = t[i] / L, cj = -1;
			dis = L - t[i] % L;
		} else {
			i = p[id], j = p[id + 1];
			ci = t[i] / L, cj = t[j] / L;
			dis = t[j] % L - t[i] % L;
		}
		if (ci == cj) if (s[i] > s[j] || s[j] > s[i] + dis) return 0;
		if (ci > cj) {
			lb = std::max(lb, divc(s[i] - s[j], ci - cj));
			rb = std::min(rb, divf(s[i] - s[j] + dis, ci - cj));
		}
		if (ci < cj) {
			rb = std::min(rb, divf(s[j] - s[i], cj - ci));
			lb = std::max(lb, divc(s[j] - s[i] - dis, cj - ci));
		}
	}
	if (lb > rb) return 0;
//	printf("[lb - rb] = [%lld - %lld]\n", lb, rb);
	for (int id = 1; id <= N; ++id) {
		int posj, posi, dif;
		if (id == N) {
			int i = p[id];
			posi = t[i] % L, posj = L;
			dif = lb - (s[i] - (t[i] / L) * lb);
		} else {
			int i = p[id], j = p[id + 1];
			posi = t[i] % L, posj = t[j] % L;
			LL xi = s[i] - (t[i] / L) * lb;
			LL xj = s[j] - (t[j] / L) * lb;
			dif = xj - xi;
		}
		for (int k = posj; k > posi; --k) v[k] = dif ? --dif, 1 : 0;
	}
//	for (int i = 1; i <= L; ++i) printf("%d", v[i]); puts("");
	return 1;
}

int main() {
	scanf("%d%d", &N, &L), ++N;
	p[1] = 1;
	for (int i = 2; i <= N; ++i) {
		LL X, Y;
		scanf("%lld%lld%lld", &t[i], &X, &Y);
		if ((X ^ Y ^ t[i]) & 1) return puts("NO"), 0;
		x[i] = (X + Y + t[i]) / 2, y[i] = (X - Y + t[i]) / 2;
		p[i] = i;
	}
	std::sort(p + 1, p + N + 1, [](int i, int j) {
		return t[i] % L < t[j] % L;
	});
	if (!check(x, a) || !check(y, b)) return puts("NO"), 0;
	for (int i = 1; i <= L; ++i) putchar("LUDR"[b[i] * 2 + a[i]]);
	puts("");
	return 0;
}

#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=2000006;
const LL INF=4.5e18;
void NO(){
	puts("NO");
	exit(0);
}
void ckmin(LL &a,LL b){
	if (a>b)
		a=b;
}
void ckmax(LL &a,LL b){
	if (a<b)
		a=b;
}
int n,L;
struct Node{
	LL t,x,y,p;
}a[N];
bool cmp(Node a,Node b){
	return a.p<b.p;
}
LL U(LL a,LL b){
	return a>=0?(a+b-1)/b:a/b;
}
LL D(LL a,LL b){
	return a>=0?a/b:(a-b+1)/b;
}
char res[N];
int cly=0;
int main(){
	n=read(),L=read();
	if (n==1000&&L==2000000)
		cly=1;
	For(i,1,n){
		a[i].t=read(),a[i].x=read(),a[i].y=read();
		a[i].p=a[i].t%L;
		if ((a[i].x+a[i].y+a[i].t)%2!=0)
			NO();
	}
	++n,a[n].t=a[n].x=a[n].y=a[n].p=0;
	++n,a[n]=a[n-1],a[n].p=L;
	sort(a+1,a+n+1,cmp);
	LL minp=-L,maxp=L,minm=-L,maxm=L;
	For(i,1,n-1){
		LL dx=a[i+1].x-a[i].x,dy=a[i+1].y-a[i].y;
		LL k=((a[i+1].t-a[i+1].p)-(a[i].t-a[i].p))/L;
		LL t=a[i+1].p-a[i].p;
		if (k<0)
			k=-k,dx=-dx,dy=-dy;
		if (k!=0){
			ckmax(minp,U(dx+dy-t,k));
			ckmin(maxp,D(dx+dy+t,k));
			ckmax(minm,U(dx-dy-t,k));
			ckmin(maxm,D(dx-dy+t,k));
		}
		else {
			if (t<abs(dx)+abs(dy))
				NO();
		}
	}
	LL dx,dy;
	int flag=0;
	for (LL i=minp;!flag&&i<=maxp;i++)
		if ((i+L)%2==0)
			for (LL j=minm;!flag&&j<=maxm;j++){
				LL x=i+j,y=i-j;
				if (x%2==0&&y%2==0)
					flag=1,dx=x/2,dy=y/2;
			}
	if (!flag)
		NO();
	For(i,1,n){
		LL k=(a[i].t-a[i].p)/L;
		a[i].x-=k*dx,a[i].y-=k*dy;
	}
	For(i,1,n-1){
		int t0=a[i].p,t1=a[i+1].p;
		LL x=a[i+1].x-a[i].x,y=a[i+1].y-a[i].y;
		assert(t1-t0>=abs(x)+abs(y));
		while (x>0)
			res[t0++]='R',x--;
		while (x<0)
			res[t0++]='L',x++;
		while (y>0)
			res[t0++]='U',y--;
		while (y<0)
			res[t0++]='D',y++;
		while (t0<t1)
			res[t0++]='L',res[t0++]='R';
		assert(t0==t1);
	}
	puts(res);
	return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#define NO puts("NO"),exit(0)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int N=2002000,M=4000400;
int n,Len,s0[N],s1[N],b[M];
ll t,x,y,lx,rx,L,R,K,A,B,s[M];
struct ele{ll t,x;}p0[N],p1[N];
struct lin{ll a,k,b;}q[N];
bool cmp(lin x,lin y){return x.a<y.a;}
void work(ele *p,int *f){
	FOR(i,1,n){
		t=p[i].t,x=p[i].x;
		q[i]={t%Len,-t/Len,x};
	}
	q[0]={0,0,0};q[n+1]={Len,1,0};
	sort(q,q+n+2,cmp);
	lx=0;rx=Len;
	//FOR(i,0,n+1) cout<<q[i].a<<' '<<q[i].k<<' '<<q[i].b<<'\n';
	FOR(i,1,n+1){
		A=q[i].a,B=q[i-1].a;
		L=q[i-1].b-q[i].b;R=L+A-B;
		K=q[i].k-q[i-1].k;
		//cout<<L<<' '<<K<<' '<<R<<'\n';
		if(K<0) swap(L,R),L=-L,R=-R,K=-K;
		if(!K){if(L>R) NO;}
		else{
			L=L>0?(L-1)/K+1:0;
			if(R<0) NO;R/=K;
			if(L>R) NO;lx=max(lx,L);rx=min(rx,R);
		}
	}
	if(lx>rx) NO;//cout<<lx<<'\n';
	FOR(i,1,n){
		t=p[i].t,x=p[i].x;
		s[t%Len]=x-t/Len*lx;b[t%Len]=1;
	}
	s[Len]=lx;b[Len]=1;
	//FOR(i,1,Len) cout<<s[i];cout<<'\n';
	for(int i=0,j;i<Len;i=j){
		for(j=i+1;!b[j];j++);
		ROF(k,j,j-s[j]+s[i]+1) f[k]=1;
	}
	FOR(i,0,Len) b[i]=0;//cout<<f[i];cout<<'\n';
}
int main(){
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	scanf("%d%d",&n,&Len);
	FOR(i,1,n){
		scanf("%lld%lld%lld",&t,&x,&y);
		if(t+x+y<0 || t+x-y<0 || (t+x+y&1)) NO;
		p0[i]={t,t+x+y>>1};p1[i]={t,t+x-y>>1};
	}
	work(p0,s0);work(p1,s1);
	FOR(i,1,Len){
		int t=s0[i]<<1|s1[i];
		cout<<char(t&1?(t&2?'R':'D'):(t&2?'U':'L'));
	}
}

#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define A first
#define B second
typedef long long ll;

int n,l;

void quit() { printf("NO\n"), exit(0); }
vector<int> make(vector<pair<int,pair<ll,ll> > > X, int s) {
	vector<int> res;
	int prev = 0;
	int prevS = 0;
	for (auto cur: X) {
		ll hereS = cur.B.A-s*cur.B.B;
		for (int i=0;i<hereS-prevS;i++) res.push_back(1);
		int here = cur.A;
		for (int i=0;i<here-prev-(hereS-prevS);i++) res.push_back(0);
		prev = here;
		prevS = hereS;
	}
	while (prevS<s) res.push_back(1), prevS+=1;
	while (res.size()<l) res.push_back(0);
	return res;
}
vector<int> solve(vector<pair<ll,ll> > pts) {
	for (auto& p: pts) {
		if ((p.A+p.B)%2==1) quit();
		p.B = (p.B+p.A)/2;
	}
	vector<pair<int,pair<ll,ll> > > X;
	for (auto p: pts) X.push_back(MP(p.A%l,MP(p.B,p.A/l)));
	sort(X.begin(),X.end());
	ll low = 0;
	ll high = l;
	auto prev = X[0];
	for (auto cur: X) {
		if (cur==prev) continue;
		int z = cur.A-prev.A;
		ll x = cur.B.A-prev.B.A;
		ll y = -cur.B.B+prev.B.B;
		if (0<=x && x<=z) {
			if (y>0) high = min(high,(z-x)/y);
		} else if (x<0) {
			if (y<=0) quit();
			low = max(low,(-x+y-1)/y);
			high = min(high,(-x+z+y-1)/y);
		} else if (x>z) {
			if (y>=0) quit();
			y = -y;
			low = max(low,(x-z+y-1)/y);
			high = min(high,(x+y-1)/y);
		}
		prev = cur;
	}
	for (ll i=low;i<=high;i++) {
		ll val = prev.B.A-i*prev.B.B;
		if (val<=i && val+l-prev.A>=i) return make(X,i);
	}
	quit();
}

ll t[200013];
ll x[200013];
ll y[200013];
char rev[4] = {'L','U','D','R'};

int main() {
	scanf("%d%d",&n,&l);
	for (int i=1;i<=n;i++) scanf("%lld%lld%lld",&t[i],&x[i],&y[i]);
	vector<int> one,two;
	for (int r=-1;r<=1;r++) {
		if (!r) continue;
		vector<pair<ll,ll> > has;
		for (int i=0;i<=n;i++) has.push_back(MP(t[i],x[i]+r*y[i]));
		one = solve(has);
		swap(one,two);
	}
	for (int i=0;i<l;i++) printf("%c",rev[one[i]*2+two[i]]);
	printf("\n");

	return 0;
}

#include<bits/stdc++.h>
#define re register
using namespace std;
int n,l;
struct lim{long long t,x,y;}c[200100];
inline bool cmp(const lim&A,const lim&B){return A.t%l<B.t%l;}
long long xpy1,xpy2,xmy1,xmy2;
void nw(re long long px,re long long py,re long long pt)
{
	if(px==0){if(pt<0)puts("NO"),exit(0);return;}
	if(px<0)//>=
	{
		px=-px,py=-py,pt=-pt;pt=ceil((long double)pt/px);py/=px;px/=px;
		if(py<0)xmy1=max(xmy1,pt);
		else xpy1=max(xpy1,pt);
	}
	else//<=
	{
		pt=floor((long double)pt/px);py/=px;px/=px;
		if(py<0)xmy2=min(xmy2,pt);
		else xpy2=min(xpy2,pt);
	}
}
void rnw(re int a,re int b)
{
	re long long tt=c[b].t%l-c[a].t%l,ta=c[a].t/l,tb=c[b].t/l;
	nw(-(ta-tb),-(ta-tb),tt-(c[a].x-c[b].x)-(c[a].y-c[b].y));
	nw(+(ta-tb),-(ta-tb),tt+(c[a].x-c[b].x)-(c[a].y-c[b].y));
	nw(-(ta-tb),+(ta-tb),tt-(c[a].x-c[b].x)+(c[a].y-c[b].y));
	nw(+(ta-tb),+(ta-tb),tt+(c[a].x-c[b].x)+(c[a].y-c[b].y));
}
char ss[2000100];
int main()
{
	scanf("%d%d",&n,&l);
	re long long xx,yy,xc,yc,xk=0,yk=0,tt=0;
	for(re int i=1;i<=n;i++)
	{
		scanf("%lld%lld%lld",&c[i].t,&c[i].x,&c[i].y);
		if(c[i].t%2!=abs(c[i].x+c[i].y)%2){puts("NO");return 0;}
	}n++;
	xpy1=-l;xpy2=l;xmy1=-l;xmy2=l;
	sort(c+1,c+n+1,cmp);
	for(re int i=1;i<n;i++)rnw(i,i+1);
	nw((1+c[n].t/l),(1+c[n].t/l),(l-c[n].t%l)+c[n].x+c[n].y);
	nw((1+c[n].t/l),-(1+c[n].t/l),(l-c[n].t%l)+c[n].x-c[n].y);
	nw(-(1+c[n].t/l),(1+c[n].t/l),(l-c[n].t%l)-c[n].x+c[n].y);
	nw(-(1+c[n].t/l),-(1+c[n].t/l),(l-c[n].t%l)-c[n].x-c[n].y);
	if(abs(xpy1)%2!=l%2)xpy1++;if(abs(xmy1)%2!=l%2)xmy1++;if(xpy1>xpy2||xmy1>xmy2){puts("NO");;return 0;}
	xx=(xpy1+xmy1)/2;
	yy=xpy1-xx;
	for(re int i=1;i<=n;i++)
	{
		xc=c[i].x-c[i].t/l*xx;
		yc=c[i].y-c[i].t/l*yy;
		while(tt<c[i].t%l)
		{
			if(xk<xc)ss[++tt]='R',xk++;
			else if(xk>xc)ss[++tt]='L',xk--;
			else if(yk<yc)ss[++tt]='U',yk++;
			else ss[++tt]='D',yk--;
		}
	}
	xc=xx;
	yc=yy;
	while(tt<l)
	{
		if(xk<xc)ss[++tt]='R',xk++;
		else if(xk>xc)ss[++tt]='L',xk--;
		else if(yk<yc)ss[++tt]='U',yk++;
		else ss[++tt]='D',yk--;
	}
	puts(ss+1);
}

#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define foreach(e, x) for (__typeof(x.begin()) e = x.begin(); e != x.end(); ++e)
typedef long long LL;
typedef pair<int, int> PII;

int n, l;
LL t[200001], x[200001], y[200001];
int resX[2000001], resY[2000001];
int g[2000001];

bool solve(LL *x, int *res) {
    REP(i, l) g[i] = -1;
    int dLo = -l, dHi = l;
    REP(i, n) {
        int tt = t[i] % l;
        if (g[tt] == -1) {
            g[tt] = i;
        } else {
            int j = g[tt];
            LL a = x[i] - x[j];
            LL b = (t[i] - t[j]) / l;
            if (a % b != 0) return false;
            LL d = a / b;
            if (d > l || d < -l) return false;
            if ((d ^ l) & 1) return false;
            if (dLo == dHi && dLo != d) return false;
            dLo = dHi = d;
        }
    }
    int pre = 0;
    g[l] = g[0];
    for (int i = 1; i <= l; ++i) if (g[i] != -1) {
        if (i == l && pre == 0) break;
        int p = g[pre];
        int q = g[i];
        int v = i - pre;
        LL whole = (t[q] - t[p] - v) / l;
        if (((x[q] - x[p]) ^ (t[q] - t[p])) & 1) return false;
        //d = (x[q] - x[p] + [-v;v]) / whole;
        if (whole == 0) {
            if (abs(x[q] - x[p]) > v) return false;
            pre = i;
            continue;
        }
        LL xp = x[p], xq = x[q];
        if (whole < 0) {
            whole = -whole;
            swap(xp, xq);
        }
        LL tmp = (xq - xp - v) / whole;
        if ((xq - xp - v) % whole != 0 && xq - xp - v > 0)
            ++tmp;
        if (tmp < -l) tmp = -l - 1;
        if (tmp > l) tmp = l + 1;
        dLo = max(dLo, (int)tmp);
        tmp = (xq - xp + v) / whole;
        if ((xq - xp + v) % whole != 0 && xq - xp + v < 0)
            --tmp;
        if (tmp < -l) tmp = -l - 1;
        if (tmp > l) tmp = l + 1;
        dHi = min(dHi, (int)tmp);
        pre = i;
    }
    if ((dLo ^ l) & 1) ++dLo;
    if ((dHi ^ l) & 1) --dHi;
    if (dLo > dHi) return false;
    int d = dLo;
    res[0] = 0, res[l] = d;
    pre = 0;
    for (int i = 1; i <= l; ++i) if (g[i] != -1) {
        if (i == l && pre == 0) break;
        int p = g[pre];
        int q = g[i];
        int v = i - pre;
        LL whole = (t[q] - t[p] - v) / l;
        //d * whole + x[p] + dif = x[q]
        LL dif = x[q] - x[p] - d * whole;
        for (int j = pre + 1; j <= i; ++j) {
            if (dif > 0) --dif, res[j] = res[j - 1] + 1;
            else ++dif, res[j] = res[j - 1] - 1;
        }
        assert(dif == 0);
        pre = i;
    }
    return true;
}

int main() {
    scanf("%d%d", &n, &l), ++n;
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i < n; ++i) {
        scanf("%I64d%I64d%I64d", t + i, x + i, y + i);
        x[i] += y[i];
        y[i] = x[i] - 2 * y[i];
    }
    if (!solve(x, resX) || !solve(y, resY)) {
        printf("NO\n");
        return 0;
    }
    for (int i = 1; i <= l; ++i) {
        int dx = resX[i] - resX[i - 1];
        int dy = resY[i] - resY[i - 1];
        if (dx == -1) {
            if (dy == -1) printf("L");
            else printf("D");
        } else {
            if (dy == -1) printf("U");
            else printf("R");
        }
    }
    printf("\n");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2000005;
ll t,x,y,nx,ny;
int n,l[N],r[N],len;
struct node{ll ty,tz,x;node(){} node(ll A,ll B,ll C){ty=A;tz=B;x=C;}}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
ll ceil(ll x,ll y)
{
    if (x<0) x=-x,y=-y;
    if (x==0) return 0;
    if (y>0) return (x-1)/y+1;
    else return x/y;
}
ll floor(ll x,ll y)
{
   if (x<0) x=-x,y=-y;
   if (x==0) return 0;
    if (y>0) return x/y;
    else return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
    sort(a+1,a+n+1);
    ll L=0,R=len;
    a[n+1]=node(len,-1,0);//设置边界!!!
    for (int i=0;i<=n;i++)//要统计入最后一个限制S[len]=0-S*
    {
        ll d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
        if (p>0)
        {
            L=max(L,ceil(-q,p));
            R=min(R,floor(d-q,p));
        }else if (p<0) {
            L=max(L,ceil(d-q,p));
            R=min(R,floor(-q,p));
        }
        if (L>R||p==0&&(q<0||q>d)) {puts("NO");exit(0);}
    }
    ll s=L,si=0;
    for (int i=0,j=1;i<=n;i++)
    {
        si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
        while (si--) ans[j++]=1;
        j=a[i+1].ty+1;//a[i+1]而不是a[i]
    }
}
int main()
{
    scanf("%d%d",&n,&len);
    for (int i=1;i<=n;i++)
    {
        scanf("%lld%lld%lld",&t,&x,&y);
        nx=x+y+t;ny=x-y+t;
        if (nx&1) return puts("NO"),0;
        nx/=2;ny/=2;
        a[i]=node(t%len,t/len,nx);
        b[i]=node(t%len,t/len,ny);
    }
    solve(a,l);
    solve(b,r);
    for (int i=1;i<=len;i++)
      printf("%c","LDUR"[l[i]<<1|r[i]]);//此题的方向与常识相异！
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MX = 2000002;

template <typename T> void cmin(T &x, const T &y)
{
	if(y < x) x = y;
}

template <typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

struct TRI
{
	ll r, x, y;

	TRI (const ll &r0 = 0, const ll &x0 = 0, const ll &y0 = 0) : r(r0), x(x0), y(y0) {}
	TRI operator - (const TRI &t) const {return TRI(r-t.r, x-t.x, y-t.y);}
	ll len () const {return abs(x)+abs(y);}
};

bool test_case_33;
int n, len;
vector<TRI> pos[MX];

void fuck(const char *str)
{
	puts("NO");
	//if(test_case_33) cout << str << endl;
	exit(0);
}

ll updiv(ll u, ll d)
{
	assert(d > 0);
	if(u < 0) return u/d;
	else return (u-1)/d+1;
}

ll dndiv(ll u, ll d)
{
	assert(d > 0);
	if(u < 0) return (u+1)/d-1;
	else return u/d;
}

void input()
{
	read(n), read(len);
	pos[0].push_back(TRI(0, 0, 0));
	for(int i=0; i<n; i++)
	{
		ll t, x, y;
		read(t), read(x), read(y);
		if((t&1) != ((x&1)^(y&1))) fuck("cannot reach at all");
		pos[t%len].push_back(TRI(t/len, x, y));
	}
	if(n==1000 && len==2000000) test_case_33 = 1;
}

void print_seq(TRI t)
{
	for(int i=0; i<t.r; i++)
	{
		if(t.x > 0) putchar('R'), t.x--;
		else if(t.x < 0) putchar('L'), t.x++;
		else if(t.y > 0) putchar('U'), t.y--;
		else putchar('D'), t.y++;
	}
	assert(t.x==0 && t.y==0);
}

void print_by_dxdy(ll dx, ll dy)
{
	vector<TRI> tar;
	for(int i=0; i<len; i++)
		for(auto j : pos[i])
			tar.push_back(TRI(i, j.x-dx*j.r, j.y-dy*j.r));
	tar.push_back(TRI(len, dx, dy));
	for(int i=0; i+1<tar.size(); i++)
		if(tar[i+1].r-tar[i].r < (tar[i+1]-tar[i]).len())
		{
			//if(test_case_33) cout<<i<<": "<<dx<<" "<<dy<<" "<<tar[i+1].r-tar[i].r<<" ? "<<tar[i+1].x<<" "<<tar[i].x<<" "<<tar[i+1].y<<" "<<tar[i].y<<endl;
			fuck("dx and dy not fit");
		}
	for(int i=0; i+1<tar.size(); i++) print_seq(tar[i+1]-tar[i]);
	putchar('\n');
}

void work()
{
	ll mndx = -len, mxdx = +len, mndy = -len, mxdy = +len;
	for(int i=0; i<len; i++)
	{
		if(pos[i].size() > 1)
		{
			for(int j=1; j<pos[i].size(); j++)
			{
				if((pos[i][j].x-pos[i][0].x) % (pos[i][j].r-pos[i][0].r)) fuck("can't transist 1");
				if((pos[i][j].y-pos[i][0].y) % (pos[i][j].r-pos[i][0].r)) fuck("can't transist 2");
				ll dx = (pos[i][j].x-pos[i][0].x)/(pos[i][j].r-pos[i][0].r);
				ll dy = (pos[i][j].y-pos[i][0].y)/(pos[i][j].r-pos[i][0].r);
				cmax(mndx, dx-dy);
				cmin(mxdx, dx-dy);
				cmax(mndy, dx+dy);
				cmin(mxdy, dx+dy);
			}
		}
	}
	if(mndx>mxdx || mndy>mxdy) fuck("mn > mx 1");
	else if(mndx==mxdx && mndy==mxdy) print_by_dxdy((mndx+mndy)/2, (mndy-mndx)/2);
	else
	{
		for(int i=0; i<len; i++)
		{
			if(pos[i].size())
			{
				int j = i+1;
				while(j<len && !pos[j].size()) j++;
				if(j == len)
				{
					TRI p = pos[i][0];
					ll c = j-i;
					ll lx = updiv(-c+(p.x-p.y), 1+p.r), rx = dndiv(c+(p.x-p.y), 1+p.r);
					cmax(mndx, lx);
					cmin(mxdx, rx);
					ll ly = updiv(-c+(p.x+p.y), 1+p.r), ry = dndiv(c+(p.x+p.y), 1+p.r);
					cmax(mndy, ly);
					cmin(mxdy, ry);
				}
				else
				{
					TRI p1 = pos[i][0], p2 = pos[j][0];
					ll c = j-i, d = (p1.x-p2.x), e = (p1.y-p2.y);
					if(p1.r == p2.r)
					{
						if((p1-p2).len() > c) fuck("can't transist 3");
					}
					else
					{
						if(p1.r > p2.r) swap(p1, p2), d = -d, e = -e;
						ll lx = updiv(-c-(d-e), p2.r-p1.r), rx = dndiv(c-(d-e), p2.r-p1.r);
						cmax(mndx, lx);
						cmin(mxdx, rx);
						ll ly = updiv(-c-(d+e), p2.r-p1.r), ry = dndiv(c-(d+e), p2.r-p1.r);
						cmax(mndy, ly);
						cmin(mxdy, ry);
					}
				}
			}
		}
		if(mndx>mxdx || mndy>mxdy) fuck("mn > mx 2");
		for(ll dx=mndx; dx<=mxdx; dx++)
			for(ll dy=mndy; dy<=mxdy; dy++)
			{
				if((dx+dy) & 1) continue;
				else if((dy-dx) & 1) continue;
				ll x = (dx+dy)/2, y = (dy-dx)/2;
				if((len&1) != ((x&1)^(y&1))) continue;
				else {print_by_dxdy(x, y); return;}
			}
		fuck("none answer found");
	}
}

int main()
{
	input();
	work();
	return 0;
}

/*
0 29 146
4 -4427 -4054
*/

#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define End puts("NO"),exit(0)

const int N=2e5+5;
const ll inf=2e18;
int n,l;

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}
struct Node {
	ll t,x,y,q;int p;
	inline void pre() {
		ll _x,_y;IN(t),IN(_x),IN(_y);
		if(((_x+_y)&1)!=(t&1)) End;
		q=t/l,p=t%l,x=(_x+_y+t)/2,y=(_y-_x+t)/2;
	}
}a[N];
inline bool cmp(Node a,Node b) {return a.p<b.p;}

int main() {
	IN(n),IN(l);
	for(int i=1;i<=n;++i) a[i].pre();
	sort(a+1,a+1+n,cmp),a[++n].q=-1,a[n].p=l;
	ll lx=-inf,rx=inf,ly=-inf,ry=inf;
	for(int i=1;i<=n;++i) {
		ll q=a[i].q-a[i-1].q,p=a[i].p-a[i-1].p,x=a[i].x-a[i-1].x,y=a[i].y-a[i-1].y;
		if(!q) {if((x-p>0||x<0)||(y-p>0||y<0)) End;}
		else if(q>0)
			lx=max(lx,(ll)ceil(1.0L*(x-p)/q)),rx=min(rx,(ll)floor(1.0L*x/q)),
			ly=max(ly,(ll)ceil(1.0L*(y-p)/q)),ry=min(ry,(ll)floor(1.0L*y/q));
		else if(q<0)
            q*=-1,x*=-1,y*=-1,
			lx=max(lx,(ll)ceil(1.0L*x/q)),rx=min(rx,(ll)floor(1.0L*(x+p)/q)),
			ly=max(ly,(ll)ceil(1.0L*y/q)),ry=min(ry,(ll)floor(1.0L*(y+p)/q));
	}
	if(lx>rx||ly>ry) End;
	for(int i=1;i<=n;++i) {
		int t=a[i].p-a[i-1].p,x=0,y=0;
		ll dx=(a[i].x-a[i].q*lx)-(a[i-1].x-a[i-1].q*lx);
		ll dy=(a[i].y-a[i].q*ly)-(a[i-1].y-a[i-1].q*ly);
		while(t--) {
			if(x<dx) ++x,(y<dy)?(putchar('U'),++y):putchar('R');
			else (y<dy)?(putchar('L'),++y):putchar('D');
		}
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define N 200010
#define L 2000010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
struct Po{ll x,y,t;}po[N];
struct shj{ll t,x,zh;}a[N];
int n,l;
bool an1[L],an2[L];
bool c1(const shj &a,const shj &b){return a.t<b.t;}
int main(){
	read(n);read(l);
	for (int i=1;i<=n;i++){read(po[i].t);read(po[i].x);read(po[i].y);}
	for (int i=1;i<=n;i++){
		a[i].t=po[i].t%l;a[i].x=po[i].x+po[i].y+po[i].t;
		if (a[i].x%2==1||a[i].x<0){puts("NO");return 0;}
		else a[i].x/=2;a[i].zh=po[i].t/l;
	}
	a[n+1]=(shj){0,0,0};a[n+2]=(shj){l,0,-1};
	sort(a+1,a+n+3,c1);
	ll nl=0,nr=l;
	for (int i=1;i<=n+1;i++){
		ll x=a[i+1].t-a[i].t,y=a[i+1].zh-a[i].zh,z=a[i+1].x-a[i].x;
		if (y>0){
			if ((z-x)%y==0)nl=max(nl,(z-x)/y);else nl=max(nl,(z-x)/y+1);
			nr=min(nr,z/y);
		}
		if (y<0){
			z=-z;y=-y;
			if (z%y==0)nl=max(nl,z/y);else nl=max(nl,z/y+1);
			nr=min(nr,(z+x)/y);
		}
	}
	if (nl>nr){puts("NO");return 0;}
	for (int i=1;i<=n+1;i++){
		ll su=a[i+1].x-a[i].x-(a[i+1].zh-a[i].zh)*nl;
		for (int j=a[i].t+1;j<=a[i+1].t;j++)if (su){an1[j]=1;su--;}else an1[j]=0;
	}
	for (int i=1;i<=n;i++){
		a[i].t=po[i].t%l;a[i].x=po[i].x-po[i].y+po[i].t;
		if (a[i].x%2==1||a[i].x<0){puts("NO");return 0;}
		else a[i].x/=2;a[i].zh=po[i].t/l;
	}
	a[n+1]=(shj){0,0,0};a[n+2]=(shj){l,0,-1};
	sort(a+1,a+n+3,c1);
	nl=0,nr=l;
	for (int i=1;i<=n+1;i++){
		ll x=a[i+1].t-a[i].t,y=a[i+1].zh-a[i].zh,z=a[i+1].x-a[i].x;
		if (y>0){
			if ((z-x)%y==0)nl=max(nl,(z-x)/y);else nl=max(nl,(z-x)/y+1);
			nr=min(nr,z/y);
		}
		if (y<0){
			z=-z;y=-y;
			if (z%y==0)nl=max(nl,z/y);else nl=max(nl,z/y+1);
			nr=min(nr,(z+x)/y);
		}
	}
	if (nl>nr){puts("NO");return 0;}
	for (int i=1;i<=n+1;i++){
		ll su=a[i+1].x-a[i].x-(a[i+1].zh-a[i].zh)*nl;
		for (int j=a[i].t+1;j<=a[i+1].t;j++){
			if (su){an2[j]=1;su--;}else an2[j]=0;
		}
	}
	for (int i=1;i<=l;i++)printf("%c","LDUR"[2*an1[i]+an2[i]]);
	puts("");
	return 0;
}

#include <bits/stdc++.h>
#define FOR(i, n) for (int i = 0; i < (n); ++i)
#define MAXN 200002
using namespace std;

typedef long long ll;
struct event { ll phase, rep; int i; } events[MAXN];
bool operator<(const event& a, const event& b) { return a.phase < b.phase; }

ll N, L, p_coord[MAXN], q_coord[MAXN];
vector<bool> p, q;

inline void add(const ll& phase, const ll& rep, const ll& p, const ll& q) {
  static int i = 0;
  events[i] = { phase, rep, i };
  p_coord[i] = p;
  q_coord[i] = q;
  ++i;
}

inline ll ceil_div(const ll& n, const ll& d) {
  ll q = n / d;
  return (q * d < n) ? (q + 1) : q;
}

inline ll floor_div(const ll& n, const ll& d) {
  ll q = n / d;
  return (q * d > n) ? (q - 1) : q;
}

bool solve_1D(const ll x[], vector<bool>& result) {
  ll minx = -L, maxx = L;
  FOR (i, N + 1) {
    event &a = events[i], &b = events[i + 1];
    ll dphase = b.phase - a.phase, drep = b.rep - a.rep, dx = x[b.i] - x[a.i];
    if (drep < 0) dx *= -1, drep *= -1;

    if (drep == 0) {
      if (abs(dx) > abs(dphase)) return false;
    } else {
      minx = max(minx, ceil_div(dx - abs(dphase), drep));
      maxx = min(maxx, floor_div(dx + abs(dphase), drep));
    }
  }

  if ((minx + L) & 1) ++minx;
  if ((maxx + L) & 1) --maxx;
  if (minx > maxx) return false;

  result.reserve(L);
  FOR (i, N + 1) {
    event &a = events[i], &b = events[i + 1];
    if (a.phase != b.phase) {
      int dx = (x[b.i] - x[a.i]) - minx * (b.rep - a.rep);
      int dt = b.phase - a.phase;
      for (; dx > 0; --dx, --dt) result.push_back(1);
      for (; dx < 0; ++dx, --dt) result.push_back(0);
      for (; dt > 0; dt -= 2)    result.push_back(1), result.push_back(0);
    }
  }

  return true;
}

inline void nope() {
  printf("NO\n");
  exit(0);
}

int main() {
  scanf("%I64d%I64d", &N, &L);
  FOR (i, N) {
    ll t, x, y;
    scanf("%I64d%I64d%I64d", &t, &x, &y);
    if ((t + x + y) & 1) nope();
    add(t % L, t / L, x + y, x - y);
  }
  add(0, 0, 0, 0);
  add(L, -1, 0, 0);
  sort(events, events + N + 2);

  if (!solve_1D(p_coord, p) || !solve_1D(q_coord, q)) nope();
  FOR (i, L) printf("%c", "LUDR"[(q[i] << 1) | p[i]]);
  printf("\n");

  return 0;
}

#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long llint;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

struct Position {
  llint t, x, q, p;
  friend bool operator < (const Position &a, const Position &b) {
    return a.q < b.q;
  }
};

int parity(llint x) {
  return abs(x) % 2;
}

llint ceil(llint a, llint b);
llint floor(llint a, llint b);

llint floor(llint a, llint b) {
  assert(b > 0);
  if (a < 0) return -ceil(-a, b);
  return a/b;
}

llint ceil(llint a, llint b) {
  assert(b > 0);
  if (a < 0) return -floor(-a, b);
  return (a+b-1) / b;
}

void no_solution() {
  puts("NO");
  exit(0);
}

void solve(vector<Position> &v, int m, vector<int> &ans) {
  sort(v.begin(), v.end());
  v.insert(v.begin(), {0, 0, 0, 0});
  v.push_back({-m, 0LL, m, -1});

  llint lo = -m, hi = +m;
  for (int i = 1; i < (int)v.size(); ++i) {
    llint d = v[i].q - v[i - 1].q;
    llint k = v[i].p - v[i - 1].p;
    llint x = v[i].x - v[i - 1].x;

    if (parity(x - k*(m%2)) != parity(d)) no_solution();

    if (k == 0) {
      if (abs(x) > d) no_solution();
      continue;
    }

    if (k > 0) {
      lo = max(lo, ceil(x-d, k));
      hi = min(hi, floor(x+d, k));
    } else {
      lo = max(lo, ceil(-d-x, -k));
      hi = min(hi, floor(d-x, -k));
    }
  }

  if (parity(lo) != parity(m)) lo++;
  if (parity(hi) != parity(m)) hi--;

  if (lo > hi) no_solution();

  llint bal = lo;

  for (int i = 1; i < (int)v.size(); ++i) {
    llint d = v[i].q - v[i - 1].q;
    llint k = v[i].p - v[i - 1].p;
    llint x = v[i].x - v[i - 1].x;

    llint sum = x - k * bal;
    assert(parity(sum) == parity(d));
    assert(abs(sum) <= d);

    while (sum) {
      if (sum > 0) ans.push_back(+1), sum--; else
	ans.push_back(-1), sum++;
      d--;
    }

    assert(d%2 == 0);
    while (d > 0) {
      ans.push_back(+1);
      ans.push_back(-1);
      d -= 2;
    }
  }

  assert((int)ans.size() == m);
}

int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);

  static vector<Position> px, py;
  REP(i, n) {
    llint t, x, y;
    scanf("%lld %lld %lld", &t, &x, &y);
    px.push_back({t, x + y, t % m, t / m});
    py.push_back({t, x - y, t % m, t / m});
  }

  static vector<int> ansx, ansy;
  solve(px, m, ansx);
  solve(py, m, ansy);

  REP(i, m) {
    int dx = (ansx[i] + ansy[i]) / 2;
    int dy = (ansx[i] - ansy[i]) / 2;

    if (dx == +1 && dy == 0) putchar('R'); else
      if (dx == -1 && dy == 0) putchar('L'); else
	if (dx == 0 && dy == -1) putchar('D'); else
	  if (dx == 0 && dy == +1) putchar('U'); else
	    assert(false);
  }
  putchar('\n');
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FO(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define fo(i,j,k) for(int i=(j),end_i=(k);i<=end_i;i++)
#define ff(i,j,k) for(int i=(j),end_i=(k);i< end_i;i++)
#define fd(i,j,k) for(int i=(j),end_i=(k);i>=end_i;i--)
#define DEBUG(x) cerr<<#x<<"="<<x<<endl
#define all(x) (x).begin(),(x).end()
#define cle(x) memset(x,0,sizeof(x))
#define lowbit(x) ((x)&-(x))
#define ll long long
#define ull unsigned ll
#define db double
#define lb long db
#define pb push_back
#define mp make_pair
#define fi first
#define se second
inline ll read()
{
	ll x=0; char ch=getchar(); bool f=0;
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
	return f?-x:x;
}
#define CASET fo(___,1,read())
const int N=200020;
const ll inf=8e18;
int n,l;
struct node{
	ll x,y,k,w;
	friend inline bool operator<(const node &A,const node &B)
	{
		return A.w<B.w;
	}
}q[N];
ll lx,rx,ly,ry,dx,dy,nx,ny;
int main()
{
	n=read(); l=read();
	ll X,Y,T,w,k;
	fo(i,1,n)
	{
		T=read(); X=read(); Y=read();
		if((X+Y+T)&1) return puts("NO")&0;
		q[i].x=(X+Y+T)/2;
		q[i].y=(Y-X+T)/2;
		q[i].k=T/l; q[i].w=T%l;
	}
	q[n+1].k=-1,q[n+1].w=l;
	sort(q+1,q+n+2);
	lx=ly=-inf;
	rx=ry=inf;
	fo(i,1,n+1)
	{
		w=q[i].w-q[i-1].w;
		k=q[i].k-q[i-1].k;
		X=q[i].x-q[i-1].x;
		Y=q[i].y-q[i-1].y;
		if(k==0)
		{
			if(X-w>0||X<0) return puts("NO")&0;
			if(Y-w>0||Y<0) return puts("NO")&0;
		}
		else if(k>0)
		{
			lx=max(lx,(ll)ceil((long db)(X-w)/k));
			ly=max(ly,(ll)ceil((long db)(Y-w)/k));
			rx=min(rx,(ll)floor((long db)X/k));
			ry=min(ry,(ll)floor((long db)Y/k));
		}
		else
		{
			lx=max(lx,(ll)ceil((long db)X/k));
			ly=max(ly,(ll)ceil((long db)Y/k));
			rx=min(rx,(ll)floor((long db)(X-w)/k));
			ry=min(ry,(ll)floor((long db)(Y-w)/k));
		}
	}
	//DEBUG(lx); DEBUG(rx);
	if(lx>rx||ly>ry) return puts("NO")&0;
	nx=lx; ny=ly;
	fo(i,0,n+1) q[i].x=q[i].x-q[i].k*nx,q[i].y=q[i].y-q[i].k*ny;
	fo(i,1,n+1)
	{
		dx=q[i].x-q[i-1].x,dy=q[i].y-q[i-1].y;
		X=Y=0; w=q[i].w-q[i-1].w;
		for(;w--;)
		{
			if(X<dx)
			{
				++X;
				if(Y<dy) ++Y,putchar('U');
				else putchar('R');
			}
			else
			{
				if(Y<dy) ++Y,putchar('L');
				else putchar('D');
			}

		}
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define EXIT(...) printf(__VA_ARGS__), exit(0)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 200000;

const int __buffsize = 100000;
char __buff[__buffsize];
char *__buffs, *__buffe;

#define getc() (__buffs == __buffe ? fread(__buff, 1, __buffsize, stdin), __buffe = __buff + __buffsize, *((__buffs = __buff)++): *(__buffs++))

template<typename T> inline T &Read(T &x)
{
	static char c;
	while (1)
	{
		c = getc();
		if (c == '-' || (c >= '0' && c <= '9')) break;
	}
	bool flag = c == '-';
	x = flag ? 0 : c - '0';
	while (1)
	{
		c = getc();
		if (c < '0' || c > '9') break;
		(x *= 10) += c - '0';
	}
	if (flag) x = -x;
	return x;
}

#undef getc

struct data
{
	int t;
	LL x, y, z;

	data() { }
	data(int _t, LL _x, LL _y, const LL &_z): t(_t), x(_x), y(_y), z(_z) { }

	friend bool operator<(const data &x, const data &y) { return x.t < y.t; }

};

data a[maxn + 5];

int n, l;
LL T[maxn + 5], X[maxn + 5], Y[maxn + 5];

inline LL Floor(LL a, LL b);
inline LL Ceil(LL a, LL b);

inline LL Floor(LL a, LL b)
{
	if (b < 0) a = -a, b = -b;
	if (a < 0) return -Ceil(-a, b);
	return a / b;
}

inline LL Ceil(LL a, LL b)
{
	if (b < 0) a = -a, b = -b;
	if (a < 0) return -Floor(-a, b);
	return (a + b - 1) / b;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	Read(n), Read(l);
	REP(i, 0, n)
	{
		Read(T[i]), Read(X[i]), Read(Y[i]);
		if ((T[i] ^ X[i] ^ Y[i]) & 1) EXIT("NO\n");
		a[i] = data(T[i] % l, X[i], Y[i], T[i] / l);
	}
	a[n++] = data(0, 0, 0, 0);
	a[n++] = data(l, 0, 0, -1);
	sort(a, a + n);
	LL Lx = LLONG_MIN, Rx = LLONG_MAX, Ly = LLONG_MIN, Ry = LLONG_MAX;
	REP(i, 1, n)
	{
		if (a[i].z == a[i - 1].z)
		{
			if (abs(a[i].x - a[i - 1].x) + abs(a[i].y - a[i - 1].y) > (a[i].t - a[i - 1].t)) EXIT("NO\n");
		}
		else
		{
			LL dx = a[i].x - a[i - 1].x, dy = a[i].y - a[i - 1].y;
			LL dz = a[i].z - a[i - 1].z;
			LL tmpx = dx - dy, tmpy = dx + dy;
			int dt = a[i].t - a[i - 1].t;
			LL lx = tmpx - dt, rx = tmpx + dt, ly = tmpy - dt, ry = tmpy + dt;
			if (dz < 0) swap(lx, rx), swap(ly, ry);
			lx = Ceil(lx, dz), rx = Floor(rx, dz), ly = Ceil(ly, dz), ry = Floor(ry, dz);
			chkmax(Lx, lx);
			chkmin(Rx, rx);
			chkmax(Ly, ly);
			chkmin(Ry, ry);
		}
	}
	if (Lx > Rx || Ly > Ry) EXIT("NO");
	bool flag = 0;
	LL ansx = 0, ansy = 0;
	for (LL i = Lx; i < Lx + 4; ++i)
		for(LL j = Ly; j < Ly + 4; ++j)
			if (i <= Rx && j <= Ry && !((i + j) & 1))
			{
				LL ux = (j + i) >> 1, uy = (j - i) >> 1;
				if (!((ux + uy + l) & 1))
				{
					flag = 1;
					ansx = ux, ansy = uy;
				}
			}
	if (!flag) EXIT("NO");
	REP(i, 0, n) a[i].x -= ansx * a[i].z, a[i].y -= ansy * a[i].z;
	a[n++] = data(l, ansx, ansy, 0);
	int curx = 0, cury = 0, curt = 0;
	REP(i, 0, n)
	{
		while (curx < a[i].x) putchar('R'), ++curx, ++curt;
		while (curx > a[i].x) putchar('L'), --curx, ++curt;
		while (cury < a[i].y) putchar('U'), ++cury, ++curt;
		while (cury > a[i].y) putchar('D'), --cury, ++curt;
		while (curt < a[i].t) putchar('L'), putchar('R'), curt += 2;
	}
	return 0;
}

#include <bits/stdc++.h>

inline long long read() {
    char c, _c; long long x; for (c = _c = getchar(); !isdigit(c); c = getchar()) { _c = c; }
    for (x = 0; isdigit(c); c = getchar()) { x = x * 10 + c - '0'; } return _c == '-' ? -x : x;
}

const int N = 2e6 + 5;

int n, m;
char ans[2][N];

struct Point {
    long long x, k, t;
} p[2][N];

bool operator <(const Point &u, const Point &v) {
    return u.t < v.t;
}

int main() {
    n = read(); m = read(); n++;
    for (int i = 1; i < n; i++) {
        long long t = read(), x = read(), y = read();
        if ((x + y + t) % 2 != 0) { printf("NO\n"); return 0; }
        p[0][i] = (Point) {x + y, t / m, t % m};
        p[1][i] = (Point) {x - y, t / m, t % m};
    }
    p[0][n] = (Point) {0, -1, m};
    p[1][n] = (Point) {0, -1, m};
    n++;
    for (int o = 0; o <= 1; o++) {
        std::sort(p[o], p[o] + n);
        long long l = -m, r = m;
        for (int i = 1; i < n; i++) {
            long long dx = p[o][i].x - p[o][i - 1].x;
            long long dk = p[o][i].k - p[o][i - 1].k;
            long long dt = p[o][i].t - p[o][i - 1].t;
            if (dk == 0) {
                if (std::abs(dx) > dt) { printf("NO\n"); return 0; }
                continue;
            }
            if (dk < 0) { dk = -dk; dx = -dx; }
            l = std::max(l, (long long) ceil(1.0L * (dx - dt) / dk));
            r = std::min(r, (long long) floor(1.0L * (dx + dt) / dk));
        }
        long long x = r + 1;
        for (; l <= r; l++) {
            if ((l + m) % 2 == 0) { x = l; break; }
        }
        if (x > r) { printf("NO\n"); return 0; }
        for (int i = 1; i < n; i++) {
            long long d = (p[o][i - 1].x - p[o][i - 1].k * x) - (p[o][i].x - p[o][i].k * x);
            for (int t = p[o][i - 1].t; t < p[o][i].t; t++) {
                if (d < 0) {
                    ans[o][t] = '+'; d++;
                } else {
                    ans[o][t] = '-'; d--;
                }
            }
            if (d != 0) { printf("NO\n"); return 0; }
        }
    }
    for (int i = 0; i < m; i++) {
        if (ans[0][i] == '+' && ans[1][i] == '-') { putchar('U'); }
        if (ans[0][i] == '-' && ans[1][i] == '-') { putchar('L'); }
        if (ans[0][i] == '-' && ans[1][i] == '+') { putchar('D'); }
        if (ans[0][i] == '+' && ans[1][i] == '+') { putchar('R'); }
    }
    return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int N = 200010;

int n, l;
pair<int, pair<ll, pair<ll, ll>>> p[N];

void gg() {
  puts("NO");
  exit(0);
}

ll ffrac(ll x, ll y) {
  if (x >= 0) return x / y;
  return -((-x + y - 1) / y);
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> n >> l;
  for (int i = 1; i <= n; ++i) {
    ll t, x, y;
    cin >> t >> x >> y;
    if ((t ^ x ^ y) & 1)
      gg();
    p[i] = make_pair(int(t % l), make_pair(-(t / l), make_pair(x + y, x - y)));
  }
  p[++n] = make_pair(0, make_pair(0LL, make_pair(0LL, 0LL)));
  p[++n] = make_pair(l, make_pair(1LL, make_pair(0LL, 0LL)));
  sort(p + 1, p + n + 1);
  ll lx = -2e18, rx = 2e18, ly = -2e18, ry = 2e18;
  for (int i = 1; i < n; ++i) {
    ll k = p[i].second.first - p[i + 1].second.first;
    ll dx = p[i].second.second.first - p[i + 1].second.second.first;
    ll dy = p[i].second.second.second - p[i + 1].second.second.second;
    int dist = p[i + 1].first - p[i].first;
    if (k < 0) {
      k = -k;
      dx = -dx;
      dy = -dy;
    }
    if (k == 0) {
      if (abs(dx) > dist || abs(dy) > dist)
        gg();
    } else {
      lx = max(lx, ffrac(-dx - dist + k - 1, k));
      rx = min(rx, ffrac(-dx + dist, k));
      ly = max(ly, ffrac(-dy - dist + k - 1, k));
      ry = min(ry, ffrac(-dy + dist, k));
    }
  }
  if (lx > rx || ly > ry) gg();
  ll ansx = (lx + ly) / 2, ansy = (lx - ly) / 2;
  for (int i = -2; i <= 2; ++i)
    for (int j = -2; j <= 2; ++j) {
      if (lx <= (ansx + ansy + i + j) && (ansx + ansy + i + j) <= rx &&
              ly <= (ansx - ansy + i - j) && (ansx - ansy + i - j) <= ry &&
              !((ansx ^ ansy ^ i ^ j ^ l) & 1)) {
        ansx += i;
        ansy += j;
        goto TAG;
      }
    }
  TAG:;
  for (int i = 1; i < n; ++i) {
    int d = p[i + 1].first - p[i].first;
    ll k = p[i].second.first - p[i + 1].second.first;
    ll dx = p[i].second.second.first - p[i + 1].second.second.first;
    ll dy = p[i].second.second.second - p[i + 1].second.second.second;
    k = -k; dx = -dx; dy = -dy;
    dx += k * (ansx + ansy);
    dy += k * (ansx - ansy);
    ll gx = (dx + dy) / 2, gy = (dx - dy) / 2;
    d -= abs(gx) + abs(gy);
    while (gx < 0) {
      putchar('L');
      ++gx;
    }
    while (gx > 0) {
      putchar('R');
      --gx;
    }
    while (gy < 0) {
      putchar('D');
      ++gy;
    }
    while (gy > 0) {
      putchar('U');
      --gy;
    }
    while (d) {
      putchar('L');
      putchar('R');
      d -= 2;
    }
  }

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}

#include <stdio.h>
#include <stdlib.h>
#define ll long long
struct SJd
{
	ll t,z;
	SJd(){}
	SJd(ll T,ll Z)
	{
		t=T;z=Z;
	}
};
int sgn(ll x)
{
	if(x>0)
		return 1;
	else if(x<0)
		return -1;
	return 0;
}
int cmp(const void*a,const void*b)
{
	return sgn(((SJd*)a)->t-((SJd*)b)->t);
}
bool bk[2000010];SJd zz[2000010],qd[200010];
struct SFc
{
	ll cs,xs;int i;
	SFc(){}
	SFc(int I,ll Cs,ll Xs)
	{
		i=I;cs=Cs;xs=Xs;
	}
};
int cmp2(const void*a,const void*b)
{
	return ((SFc*)a)->i-((SFc*)b)->i;
}
SFc fc[200010];ll xw[200010],xz[200010];
bool getans(int ss,int ans[2000010])
{
	for(int i=0;i<ss-1;i++)
	{
		ll cz=xz[i+1]-xz[i];
		if(cz<0||cz>xw[i+1]-xw[i])
			return false;
		for(int j=1;j<=cz;j++)
			ans[xw[i]+j]=1;
	}
	return true;
}
bool solve(int n,int l,SJd sz[200010],int ans[2000010])
{
	qsort(sz,n,sizeof(SJd),cmp);
	for(int i=0;i<l;i++)
		bk[i]=false;
	for(int i=0;i<n;i++)
	{
		sz[i].z+=sz[i].t;
		if(sz[i].z&1)
			return false;
		sz[i].z/=2;
	}
	ll yz;bool zd=false;
	bk[0]=true;zz[0]=SJd(0,0);
	for(int i=0;i<n;i++)
	{
		int t=sz[i].t%l;
		if(bk[t])
		{
			ll z=(sz[i].z-zz[t].z)/((sz[i].t-zz[t].t)/l);
			if(!zd)
				yz=z,zd=true;
			else if(z!=yz)
				return false;
		}
		bk[t]=true;zz[t]=sz[i];
	}
	int ss=0;
	for(int i=0;i<n;i++)
		fc[ss++]=SFc(sz[i].t%l,sz[i].z,-(sz[i].t/l));
	fc[ss++]=SFc(l,0,1);
	fc[ss++]=SFc(0,0,0);
	qsort(fc,ss,sizeof(SFc),cmp2);
	ll X;
	if(!zd)
	{
		ll L=0,R=l;
		for(int i=0;i<ss-1;i++)
		{
			if(fc[i+1].xs>fc[i].xs)
			{
				ll fz=-(fc[i+1].cs-fc[i].cs);
				if(fz>0)
				{
					ll fm=(fc[i+1].xs-fc[i].xs),ff=(fz+fm-1)/fm;
					if(ff>L)L=ff;
				}
				fz=(fc[i+1].i-fc[i].i)-(fc[i+1].cs-fc[i].cs);
				if(fz>=0)
				{
					ll fm=(fc[i+1].xs-fc[i].xs),ff=fz/fm;
					if(ff<R)R=ff;
				}
				else R=-1;
			}
			else if(fc[i+1].xs<fc[i].xs)
			{
				ll fz=(fc[i+1].cs-fc[i].cs);
				if(fz>=0)
				{
					ll fm=(fc[i].xs-fc[i+1].xs),ff=fz/fm;
					if(ff<R)R=ff;
				}
				else R=-1;
				fz=-((fc[i+1].i-fc[i].i)-(fc[i+1].cs-fc[i].cs));
				if(fz>0)
				{
					ll fm=(fc[i].xs-fc[i+1].xs),ff=(fz+fm-1)/fm;
					if(ff>L)L=ff;
				}
			}
		}
		if(L>R)return false;
		X=L;
	}
	else X=yz;
	for(int i=0;i<ss;i++)
	{
		xw[i]=fc[i].i;
		xz[i]=fc[i].xs*X+fc[i].cs;
	}
	return getans(ss,ans);
}
SJd zx[200010],zy[200010];int ax[2000010],ay[2000010];
char zf[2][2]={'L','D','U','R'};
int main()
{
	int n,l;
	scanf("%d%d",&n,&l);
	for(int i=0;i<n;i++)
	{
		ll t,x,y;
		scanf("%lld%lld%lld",&t,&x,&y);
		zx[i]=SJd(t,x+y);
		zy[i]=SJd(t,x-y);
	}
	if(solve(n,l,zx,ax)&&solve(n,l,zy,ay))
	{
		for(int i=1;i<=l;i++)
			printf("%c",zf[ax[i]][ay[i]]);
	}
	else printf("NO");
	return 0;
}

/********************************************************************************

	Code by a weak man who named CYJian, and he hopes the code can get more points.

	Algorithm:

 ********************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define ra read_alpha()
#define FILE(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline char read_alpha() { char c = ge; while(!isalpha(c) && c != EOF) c = ge; return c; }
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

const int MAXN = 200010;
const ll inf = (1ull << 63) - 1;

inline ll up(ll p, ll q) { return (ll)ceil(1.0L * p / q); }
inline ll dn(ll p, ll q) { return (ll)floor(1.0L * p / q); }

int n, m;

struct Node {
	ll x, y, k; int p;

	Node() {}
	Node(ll x, ll y, ll t):x(x), y(y) { k = t / m, p = t % m; }

	inline ll C(ll t, ll v) { return (x * t + y * (!t)) - v * k; }

	friend bool operator < (Node a, Node b) { return a.p < b.p; }
}a[MAXN];

int d[4][2000010];

int main() {
#ifndef ONLINE_JUDGE
	FILE("robot");
#endif
	n = ri, m = ri;
	ll lx = -inf, rx = inf;
	ll ly = -inf, ry = inf;
	for(int i = 1; i <= n; i++) {
		ll t = rl, x = rl, y = rl;
		ll tx = x + y + t;
		ll ty = y - x + t;
		if(tx < 0 || ty < 0 || (tx & 1) || (ty & 1))
			return puts("NO"), 0;
		a[i] = Node(tx >> 1, ty >> 1, t);
	} sort(a + 1, a + 1 + n), ++n, a[n].k = -1, a[n].p = m;
	for(int i = 1; i <= n; i++) {
		ll k = a[i].k - a[i - 1].k;
		ll p = a[i].p - a[i - 1].p;
		ll X = a[i].x - a[i - 1].x;
		ll Y = a[i].y - a[i - 1].y;
		if(!k) {
			if(X > p || X < 0 || Y > p || Y < 0) return puts("NO"), 0;
		} else if(k > 0) {
			chkmax(lx, up(X - p, k)), chkmin(rx, dn(X, k));
			chkmax(ly, up(Y - p, k)), chkmin(ry, dn(Y, k));
		} else {
			k = -k;
			chkmin(rx, dn(-X + p, k)), chkmax(lx, up(-X, k));
			chkmin(ry, dn(-Y + p, k)), chkmax(ly, up(-Y, k));
		}
	}
	if(rx < lx || ry < ly) return puts("NO"), 0;
	for(int i = 1, now = 0; i <= n; i++) {
		int lX = a[i].C(1, lx) - a[i - 1].C(1, lx);
		int lY = a[i].C(0, ly) - a[i - 1].C(0, ly);
		int rX = a[i].C(1, rx) - a[i - 1].C(1, rx);
		int rY = a[i].C(0, ry) - a[i - 1].C(0, ry);
		int t = a[i].p - a[i - 1].p; now += t;
		for(int j = 0; j < t; j++) {
			if(j < lX) d[0][now - j] = 1;
			if(j < rX) d[1][now - j] = 1;
			if(j < lY) d[2][now - j] = 1;
			if(j < rY) d[3][now - j] = 1;
		}
	}
	for(int i = 1; i <= m; i++)
		if(d[0][i] != d[1][i]) {
			if(d[0][i] > d[1][i])
				for(int j = i; j <= m; j++)
					d[0][j] = d[1][j];
			break;
		}
	for(int i = 1; i <= m; i++)
		if(d[2][i] != d[3][i]) {
			if(d[2][i] > d[3][i])
				for(int j = i; j <= m; j++)
					d[2][j] = d[3][j];
			break;
		}
	char s[] = "DLRU";
	for(int i = 1; i <= m; i++)
		putchar(s[d[0][i] << 1 | d[2][i]]);
	puts("");
	return 0;
}

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=200000+100,M=2000000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

struct node{ll x,y,t,k,w;}p[N];
bool cmp(node p,node q) {return p.w<q.w;}
int n,m,dx[M],dy[M];

bool solve(int *op)
{
    ll L=0,R=m;
    rep(i,2,n)
    {
        ll dx=p[i].x-p[i-1].x,dk=p[i].k-p[i-1].k,dw=p[i].w-p[i-1].w;
        if (dk==0)
        {
            if ((dx-dw>0) || (dx<0)) return 0;
        }
        else if (dk>0)
        {
            L=max(L,(ll)ceil((double)(dx-dw)/dk));
            R=min(R,(ll)floor((double)dx/dk));
        }
        else
        {
            L=max(L,(ll)ceil((double)dx/dk));
            R=min(R,(ll)floor((double)(dx-dw)/dk));
        }
        if (L>R) return 0;
    }
    int s=L;
    rep(i,2,n)
    {
        ll dx=(p[i].x-p[i].k*s)-(p[i-1].x-p[i-1].k*s),cnt=p[i].w-p[i-1].w;
        if ((dx<0) || (dx>cnt)) return 0;
        rep(j,1,cnt)
            if (j<=dx) op[j+p[i-1].w]=1;else op[j+p[i-1].w]=0;
    }
    return 1;
}

int main()
{
    n=read();m=read();
    rep(i,1,n)
    {
        p[i].t=readll();ll x=readll(),y=readll();
        if ((x+y+p[i].t)&1) {puts("NO");return 0;}
        p[i].k=p[i].t/m;p[i].w=p[i].t%m;
        p[i].x=(y+x+p[i].t)>>1;p[i].y=(y-x+p[i].t)>>1;
    }
    p[++n]=(node){0,0,0,0,0};
    p[++n]=(node){0,0,0,-1,m};
    sort(p+1,p+1+n,cmp);
    int ok=solve(dx);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,n) swap(p[i].x,p[i].y);
    ok=solve(dy);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,m)
    {
        if ((dx[i]==1) && (dy[i]==1)) putchar('U');
        else if ((dx[i]==0) && (dy[i]==0)) putchar('D');
        else if ((dx[i]==0) && (dy[i]==1)) putchar('L');
        else if ((dx[i]==1) && (dy[i]==0)) putchar('R');
    }
    return 0;
}

////

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<=32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
const int N=2e5+5;
int n,l;ll lx=-1e18,rx=1e18,ly=-1e18,ry=1e18;
struct did
{
	ll t,x,y,k;int w;
	in void init()
	{
		t=read();ll p=read(),q=read();
		if((t^p^q)&1) write("NO"),ot(),exit(0);
		k=t/l;w=t%l;x=(p+q+t)/2;y=(q-p+t)/2;
	}
	in bool operator<(did x)const{return w<x.w;}
}a[N];
int main()
{
	n=read(),l=read();for(int i=1;i<=n;i++) a[i].init();
	sort(a+1,a+n+1);a[++n].k=-1;a[n].w=l;
	for(int i=1;i<=n;i++)
	{
		ll k=a[i].k-a[i-1].k;int w=a[i].w-a[i-1].w;
		if(!k)
		{
			if(a[i].x-a[i-1].x-w>0||a[i].x-a[i-1].x<0) write("NO"),ot(),exit(0);
			if(a[i].y-a[i-1].y-w>0||a[i].y-a[i-1].y<0) write("NO"),ot(),exit(0);
		}
		else if(k>0)
		{
			lx=max(lx,(ll)ceil(1.0L*(a[i].x-a[i-1].x-w)/k));
			ly=max(ly,(ll)ceil(1.0L*(a[i].y-a[i-1].y-w)/k));
			rx=min(rx,(ll)floor(1.0L*(a[i].x-a[i-1].x)/k));
			ry=min(ry,(ll)floor(1.0L*(a[i].y-a[i-1].y)/k));
		}
		else
		{
			k*=-1;
			lx=max(lx,(ll)ceil(1.0L*(a[i-1].x-a[i].x)/k));
			ly=max(ly,(ll)ceil(1.0L*(a[i-1].y-a[i].y)/k));
			rx=min(rx,(ll)floor(1.0L*(a[i-1].x-a[i].x+w)/k));
			ry=min(ry,(ll)floor(1.0L*(a[i-1].y-a[i].y+w)/k));
		}
	}
	if(lx>rx||ly>ry) write("NO"),ot(),exit(0);
	for(int i=1;i<=n;i++)
	{
		int dx=(a[i].x-a[i].k*lx)-(a[i-1].x-a[i-1].k*lx);
		int dy=(a[i].y-a[i].k*ly)-(a[i-1].y-a[i-1].k*ly);
		int t=a[i].w-a[i-1].w,x=0,y=0;
		while(t--)
		{
			if(x<dx) x++,y<dy?(sr[++C]='U',y++):sr[++C]='R';
			else y<dy?(sr[++C]='L',y++):sr[++C]='D';
		}
	}
	return ot(),0;
}
//Author: disangan233

#include<bits/stdc++.h>
using namespace std;
namespace red{
#define int long long
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
	inline int read()
	{
		int x=0;char ch,f=1;
		for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
		if(ch=='-') f=0,ch=getchar();
		while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
		return f?x:-x;
	}
	const int N=3e5+10,M=2e6+10,inf=0x3f3f3f3f3f3f3f3f;
	int n,m;
	int sum,dk,db,dt,flag1,flag2,flagsum,maxsum,minsum;
	int ans[2][M<<1];
	struct node
	{
		int k,t,x,y,b;
		inline bool operator < (const node &other) const
		{
			return t<other.t;
		}
	}a[N];
	inline int getflag(int x)
	{
		x%=2;
		return x==-1?1:x;
	}
	inline void fail()
	{
		puts("NO");exit(0);
	}
	inline void main()
	{
		n=read(),m=read();
		for(int t,x,y,i=1;i<=n;++i)
		{
			t=read(),x=read(),y=read();
			a[i]=(node){0,t,x+y,y-x};
		}
		for(int i=1;i<=n;++i) a[i].k-=a[i].t/m,a[i].t%=m;
		a[++n]=(node){0,0,0,0},a[++n]=(node){1,m,0,0};
		sort(a+1,a+n+1);
		for(int cho=0;cho<2;++cho)
		{
			flagsum=-1,minsum=-m-1,maxsum=m+1;
			for(int i=1;i<=n;++i) a[i].b=cho?a[i].y:a[i].x;
			for(int i=1;i<n;++i)
			{
				dk=a[i+1].k-a[i].k;
				db=a[i+1].b-a[i].b;
				dt=a[i+1].t-a[i].t;
				flag1=getflag(dt-db);
				flag2=getflag(dk);
				if(flag1&&flag2)
				{
					if(!flagsum) fail();
					flagsum=1;
				}
				else if(!flag1&&flag2)
				{
					if(flagsum==1) fail();
					flagsum=0;
				}
				else if(flag1&&!flag2) fail();
				if(dk>0)
				{
					maxsum=min(maxsum,(int)floor((dt-db)/(long double)dk));
					minsum=max(minsum,(int)ceil((-dt-db)/(long double)dk));
				}
				else if(dk<0)
				{
					maxsum=min(maxsum,(int)floor((dt+db)/(long double)-dk));
					minsum=max(minsum,(int)ceil((-dt+db)/(long double)-dk));
				}
				else if(!(-dt<=db&&db<=dt)) fail();
				if(minsum>maxsum) fail();
			}
			sum=minsum;if(~flagsum&&getflag(sum)!=flagsum) ++sum;
			if(sum>maxsum) fail();
			for(int i=1;i<=n;++i) a[i].b=a[i].b+a[i].k*sum;
			for(int i=1;i<n;++i)
			{
				db=a[i+1].b-a[i].b;
				dt=a[i+1].t-a[i].t;
				if(db<0)
				{
					for(int j=a[i].t;j<a[i].t-db;++j)
						ans[cho][j]=-1;
				}
				else if(db>0)
				{
					for(int j=a[i].t;j<a[i].t+db;++j)
						ans[cho][j]=1;
				}
				for(int j=a[i].t+abs(db);j<a[i+1].t;++j)
					ans[cho][j]=j&1?1:-1;
			}
		}
		for(int i=0;i<m;++i)
		{
			if(ans[0][i]== 1&&ans[1][i]== 1) putchar('U');
			if(ans[0][i]==-1&&ans[1][i]==-1) putchar('D');
			if(ans[0][i]== 1&&ans[1][i]==-1) putchar('R');
			if(ans[0][i]==-1&&ans[1][i]== 1) putchar('L');
		}
		puts("");
	}
}
signed main()
{
	red::main();
	return 0;
}

#include<bits/stdc++.h>
#define int64 long long
#define sqr(x) (x)*(x)
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,x,y) for(int i=(x);i<=(y);++i)
#define VI vector<int>
#define VI64 vector<int64>
#define VS vector<string>
#define PII pair<int,int>
#define PDD pair<double,double>
#define VPII vector< PII >
#define SZ(x) ((int)(x).size())
#define N 410000
#define maxL 2110000
using namespace std;
const double pi=acos(-1);
struct Eve{
	int t;
	int64 x,s;
	void mk(int t_,int64 x_,int64 s_){
		t=t_;
		x=x_;
		s=s_;
	}
}a[N];
int ansX[maxL],ansY[maxL],n,L;
int64 T[N],X[N],Y[N];
bool cmp(const Eve &a,const Eve &b){
	return a.t<b.t;
}
void Fail(){
	printf("NO\n");
	exit(0);
}
void work(int64 T[],int64 X[],int ans[]){
	int tot=0;
	rep(i,1,n)
		a[++tot].mk((T[i]-1)%L+1,X[i],-((T[i]-1)/L));
	a[++tot].mk(L,0,1);
	a[++tot].mk(0,0,0);
	sort(a+1,a+tot+1,cmp);
	int64 L=-1ll<<60,R=1ll<<60;
	bool even[2]={1,1};
	rep(i,1,tot-1){
		int64 dx=a[i+1].x-a[i].x,sx=a[i+1].s-a[i].s,d=a[i+1].t-a[i].t;
		int64 high=d-dx,low=-d-dx;
		if(sx&1){
			if(high&1)even[0]=0;
			else even[1]=0;
		}else if(high&1)Fail();

		if(sx<0){
			sx*=-1;
			low*=-1;
			high*=-1;
			swap(low,high);
		}
		if(sx==0){
			if(0>high || 0<low)Fail();
			continue;
		}
		if(high>=0)R=min(R,high/sx);
		else R=min(R,-((-high+sx-1)/sx));

		if(low>=0)L=max(L,(low+sx-1)/sx);
		else L=max(L,-((-low)/sx));
	}
	if(!even[0] && !even[1])Fail();
	while(!even[L&1])L++;
	if(L>R)Fail();
	rep(i,2,tot){
		int64 dx=a[i].s*L+a[i].x-a[i-1].s*L-a[i-1].x;
		rep(j,a[i-1].t+1,a[i].t){
			if(dx>=0)dx--,ans[j]=1;
			else dx++,ans[j]=-1;
		}
		assert(dx==0);
	}
}
int main(){
	scanf("%d%d",&n,&L);
	rep(i,1,n){
		scanf("%I64d%I64d%I64d",&T[i],&X[i],&Y[i]);
		X[i]+=Y[i];
		Y[i]=Y[i]-(X[i]-Y[i]);
	}
	work(T,X,ansX);
	work(T,Y,ansY);
	rep(i,1,L){
		int x=ansX[i],y=ansY[i];
		if(x==1 && y==1)printf("U");
		if(x==1 && y==-1)printf("R");
		if(x==-1 && y==-1)printf("D");
		if(x==-1 && y==1)printf("L");
	}
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#define fo(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int N=2100000;
ll ans[N],a[N],b[N],t[N];
int n,m;
const ll unknow=-658684647668547ll;
bool ok(ll x,ll y,ll len)
{
	if (labs(x-y)>len) return 0;
	if (((x-y+len)%2+2)%2) return 0;
	return 1;
}
const int up=35454,down=566876;
int num[N];
ll tim[N],val[N];
int check(ll now,ll *x,ll *ans)
{
	fo(i,1,m) ans[i]=unknow;
	ans[m]=now;
	ans[0]=0;
	fo(i,1,n)
	{
		ll rem=x[i]-t[i]/m*ans[m];
		if (ans[t[i]%m]==unknow) ans[t[i]%m]=rem; else
		if (ans[t[i]%m]!=rem)
		{
			if (ans[t[i]%m]<rem) return up;
		}
	}
	for(int i=0;i<m;)
	{
		int j=i+1;
		while (ans[j]==unknow) j++;
		if (i+1==j)
		{
			if (labs(ans[i]-ans[j])!=1)	return 0;
		} else
		{
			fo(k,i+1,j-1)
			{
				ans[k]=ans[k-1]+1;
				if (ok(ans[k],ans[j],j-k)) continue;
				ans[k]=ans[k-1]-1;
				if (ok(ans[k],ans[j],j-k)) continue;
				return 0;
			}
		}
		i=j;
	}
	return 1;
}
void get(ll *x,ll *ans)
{
	ll mi=-1e18,mx=1e18;
	fo(i,1,n)
	if (t[i]/m)
	{
		ll l=(x[i]-m)/(t[i]/m)-1,r=(x[i]+m)/(t[i]/m)+1;
		mi=max(mi,l);
		mx=min(mx,r);
	}
	if (mi==-1e18)
	{
		if (check(unknow,x,ans)==1) return;
		printf("NO");
		exit(0);
	}
	memset(num,0,sizeof num);
	memset(tim,0,sizeof tim);
	fo(i,1,n)
	{
		num[t[i]%m]++;
		if (num[t[i]%m]==2)
		{
			ll dis=(t[i]-tim[t[i]%m])/m;
			if (check((x[i]-val[t[i]%m])/dis,x,ans)!=1)
			{
				printf("NO");
				exit(0);
			}
			return;
		} else tim[t[i]%m]=t[i],val[t[i]%m]=x[i];
	}
	mi=-1e18,mx=1e18;
	ans[0]=0;
	if (tim[0])
	{
		if (check(val[0]/(tim[0]/m),x,ans)==1) return;
		printf("NO");
		exit(0);
	}
	int i;
	for(i=0;i<m;)
	{
		int j=i+1;
		while (j<m && tim[j]==0) j++;
		if (j>m) break;
		if (tim[i]!=tim[j])
		{
			ll x=tim[i]/m,y=tim[j]/m;
			if (tim[i]<tim[j])
			{
				mi=max(mi,(val[j]-val[i]-(j-i))/(y-x));
				mx=min(mx,(val[j]-val[i]+(j-i))/(y-x));
			} else
			{
				mi=max(mi,(val[i]-val[j]-(j-i))/(x-y));
				mx=min(mx,(val[i]-val[j]+(j-i))/(x-y));
			}
		}
		i=j;
		ll dis=m-i;
		mi=max(mi,(val[i]-dis)/(tim[i]/m+1));
		mx=min(mx,(val[i]+dis)/(tim[i]/m+1));
	}
	fo(i,-2,4)
	if (check(mi+i,x,ans)==1) return;
	printf("NO");
	exit(0);
}
ll x[N],y[N];
int main()
{
	scanf("%d%d",&n,&m);
	fo(i,1,n)
	{
		ll xx,yy;
		scanf("%I64d%I64d%I64d",&t[i],&xx,&yy);
		x[i]=xx+yy;
		y[i]=xx-yy;
	}
	get(x,a);
	get(y,b);
	fo(i,1,m)
	{
		int xx=a[i]-a[i-1],yy=b[i]-b[i-1];
		int x=(xx+yy)/2,y=(xx-yy)/2;
		if (y==1) printf("U"); else
		if (x==-1) printf("L"); else
		if (y==-1) printf("D"); else
		printf("R");
	}
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<bitset>
#include<deque>
#define Fail puts("NO"),exit(0);
#define eps 1e-15
#define maxn 2000010
#define maxm 200010
#define mod 1000000007
#define inf 1000000007
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,L;
struct P{
    ll t,x,y;
}p[maxn];
struct X{
    ll t,y,pre;
    int x;
}a[maxn];
int resx[maxn],resy[maxn];
bool cmp(X a,X b)
{
    return a.x<b.x;
}
int check(int sum)
{
    for(int i=1;i<=n;i++)  a[i].pre=a[i].y-a[i].t*sum;
    a[n+1].pre=sum;
    int book=0;
    for(int i=0;i<=n;i++)
    {
        if(a[i+1].x-a[i].x>=abs(a[i].pre-a[i+1].pre))  continue;
        if(a[i].t==a[i+1].t)  Fail
        int op1=(a[i].pre>a[i+1].pre),op2=(a[i].t>a[i+1].t);
        if(op1^op2)
        {
            if(book==1)  Fail
            book=-1;
        }
        else{
            if(book==-1)   Fail
            book=1;
        }
    }
    return book;
}
int ans[maxn],flag;
void solve()
{
    sort(a+1,a+n+1,cmp);a[n+1].t=0;a[n+1].x=L;
    int book=-1;
    for(int i=0;i<n;i++)
    {
        int x1=((a[i].t+a[i+1].t)&1),x2=((a[i].x+a[i+1].x+a[i].y+a[i+1].y)&1);
        if(x1&&x2)   book=1;
        if(x1&&!x2)  book=0;
        if(x1)
        {
            if(x2!=-1&&x2!=book)  Fail
            else                  book=x2;
        }
        if(!x1&&x2)  Fail
    }
    if(book!=-1)
    {
        int op=(((a[n].t&book)+a[n].y)&1);
        if(((a[n].x+L)&1)!=((book+op)&1))  Fail
    }
    //if(flag)  cout<<book<<endl;
    int pos=inf;
    if(a[n].x==L)
    {
        if(a[n].y%(a[n].t+1))  Fail
        pos=a[n].y/(a[n].t+1);
    }
    else{
        int l=-L,r=L;
        while(l<=r)
        {
            int mid=(l+r)/2,tmp;
            if(book!=-1)  tmp=mid*2+book;
            else          tmp=mid;
            if(tmp>L)
            {
                r=mid-1;
                continue;
            }
            if(tmp<-L)
            {
                l=mid+1;
                continue;
            }
            int op=check(tmp);
            if(!op)
            {
                pos=tmp;
                break;
            }
            if(op==-1)  r=mid-1;
            else        l=mid+1;
        }
    }
    //if(flag)  cout<<pos<<endl;
    if(pos==inf)  Fail
    if(check(pos)!=0)  Fail
    a[n+1].pre=pos;
    for(int i=0;i<=n;i++)
    {
        int c1=(a[i+1].x-a[i].x+a[i+1].pre-a[i].pre)/2;
        int c2=a[i+1].x-a[i].x-c1;
        for(int j=a[i].x+1;j<=a[i].x+c1;j++)  ans[j]=1;
        for(int j=a[i].x+c1+1;j<=a[i].x+c1+c2;j++)  ans[j]=-1;
    }
}
int main()
{
    n=read();L=read();
    for(int i=1;i<=n;i++)  p[i].t=read(),p[i].x=read(),p[i].y=read();
    if(p[1].t==67&&n==200000&&L==2000000)  flag=1;
    for(int i=1;i<=n;i++)  p[i].x=p[i].x+p[i].y,p[i].y=2*p[i].y-p[i].x;
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].x;
    solve();
    for(int i=1;i<=L;i++)  resx[i]=ans[i];
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].y;
    solve();
    for(int i=1;i<=L;i++)  resy[i]=ans[i];
    for(int i=1;i<=L;i++)  resy[i]=(resx[i]+resy[i])/2,resx[i]-=resy[i];
    for(int i=1;i<=L;i++)
    {
        if(resx[i]==1)  printf("R");
        else if(resx[i]==-1) printf("L");
        else if(resy[i]==1)  printf("U");
        else if(resy[i]==-1) printf("D");
        else cout<<"@"<<endl;
    }
    puts("");
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){x+y,y-x,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
		rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0L*(x-r)/k)); rx = min(rx,(LL)floor(1.0L*(x+r)/k)); ly = max(ly,(LL)ceil(1.0L*(y-r)/k)); ry = min(ry,(LL)floor(1.0L*(y+r)/k));}
			else {lx = max(lx,(LL)ceil(1.0L*(x+r)/k)); rx = min(rx,(LL)floor(1.0L*(x-r)/k)); ly = max(ly,(LL)ceil(1.0L*(y+r)/k)); ry = min(ry,(LL)floor(1.0L*(y-r)/k));}
		} if (lx > rx || ly > ry) {puts("NO"); return;}
		rep(i,1,n) {
			int x = p[i].x-p[i-1].x-(p[i].k-p[i-1].k)*lx,y = p[i].y-p[i-1].y-(p[i].k-p[i-1].k)*ly;
			if (i == 2 && n == 1001 && m == 2000000 && p[1].k == 0 && p[1].r == 1 && p[1].x == 1 && p[1].y == 1) printf("%lld %lld\n",x,y);
			rep(j,p[i-1].r+1,p[i].r) {if (x > 0) {--x; if (y > 0) {--y; putchar('U');} else {++y; putchar('R');}} else {++x; if (y > 0) {--y; putchar('L');} else {++y; putchar('D');}}}
		}
	}
}
int main() {qiqi::main(); return 0;}

//
//  main.cpp
//  Codeforces Round #300 G
//
//  Created by Scholar on 6/16/15.
//  Copyright (c) 2015 Scholar. All rights reserved.
//

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int Maxn=2e5+1000,Maxl=2e6+1000;
//const int Maxn=2e3+100,Maxl=2e4+100;
ll n,l;ll t[Maxn],x[Maxn],y[Maxn];
struct triple{
    ll tmodl,x,tdivl;
    triple(ll a,ll b,ll c){
        tmodl=a;x=b;tdivl=c;
    }
    bool operator<(const triple&a)const{
        return tmodl<a.tmodl;
    }
};
ll fl(ll x,ll y){
    if(x>=0)return x/y;
    return x/y-(x%y?1:0);
}
ll cl(ll x,ll y){
    if(x>=0)return (x+y-1)/y;
    return x/y;
}
vector<int> work(ll*x){
    ll i;ll lb=0,rb=l;vector<triple>s;vector<int>ans;
    for(i=1;i<=n;i++)s.push_back(triple(t[i]%l,x[i],(ll)floor(1.0*t[i]/l)));
    s.push_back(triple(0,0,0));
    s.push_back(triple(l,0,-1));
    sort(s.begin(),s.end());
    for(i=1;i<s.size();i++){
        ll deltax=s[i].x-s[i-1].x,deltatdl=s[i-1].tdivl-s[i].tdivl,deltatml=s[i].tmodl-s[i-1].tmodl;
        ll left=-deltax,right=deltatml-deltax;
        if(deltatdl!=0){
            if(deltatdl<0){
                deltatdl=-deltatdl;
                swap(left,right);
                left=-left;
                right=-right;
            }
            lb=max(lb,fl(left,deltatdl)),rb=min(rb,cl(right,deltatdl));
        }
        else if(left>0||right<0)return vector<int>();
    }
    if(lb>rb)return vector<int>();
    int tmp=0;
    for(i=0;i<s.size();i++){
        while(tmp<s[i].x-lb*s[i].tdivl)ans.push_back(1),tmp++;
        while(ans.size()<s[i].tmodl)ans.push_back(0);
    }
    return ans;
}
int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(0);
    int i;
    cin>>n>>l;
    for(i=1;i<=n;i++)cin>>t[i]>>x[i]>>y[i];
    for(i=1;i<=n;i++){
        ll tmpx=x[i],tmpy=y[i];
        ll tmpxx=tmpx+tmpy+t[i],tmpyy=tmpx-tmpy+t[i];
        if(tmpxx%2||tmpyy%2){
            cout<<"NO"<<endl;
            return 0;
        }
        x[i]=(tmpxx)>>1,y[i]=(tmpyy)>>1;
    }
    vector<int>ans1=work(x);vector<int>ans2=work(y);char ans[Maxl];
    if(ans1.empty()||ans2.empty()){
        cout<<"NO"<<endl;
        return 0;
    }
    for(i=0;i<l;i++){
        if(ans1[i]==1&&ans2[i]==1)ans[i]='R';
        if(ans1[i]==1&&ans2[i]==0)ans[i]='U';
        if(ans1[i]==0&&ans2[i]==1)ans[i]='D';
        if(ans1[i]==0&&ans2[i]==0)ans[i]='L';
    }
    for(i=0;i<l;i++)cout<<ans[i];
    cout<<endl;
    return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
int tt;
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (int)ceil(l - eps));
	R = min(R, (int)floor(r + eps));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if((pos[ty][i] - ord[to].b) % (ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			vis[m - 1] = 1;
			ord[m - 1] = (Node){0, tem};
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		//if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
	}
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		if(i == 2) tt = y;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
#define endl '\n'

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

struct A {
    ll t, x, y;
};
main() {
    INT(n);
    LL(l);
    map<ll, vector<A>> mp;
    bool flag = true;
    rep(i, n) {
        LL(t, x, y);
        mp[t % l].push_back(A{t, x, y});
        if(((abs(x) + abs(y)) ^ t) & 1) { flag = false; }
    }
    if(!flag) {
        cout << "NO\n";
        return 0;
    }
    struct rect {
        ll a, b, c, d;
        rect(ll a, ll b, ll c, ll d) : a(a), b(b), c(c), d(d) {}
    };
    auto merge = [](rect &x, rect y) {
        chmax(x.a, y.a);
        chmax(x.b, y.b);
        chmin(x.c, y.c);
        chmin(x.d, y.d);
    };
    rect r(-l, -l, l, l);
    ll px = 0, py = 0, k = 0;
    ll pre = 0;
    // y * a >= x となる a
    auto Ceil = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y >= x)
                if(chmin(d, (piv + i) * y - x)) res = piv + i;
        }
        return res;
    };
    auto Floor = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y <= x)
                if(chmin(d, x - (piv + i) * y)) res = piv + i;
        }
        return res;
    };
    // 前回は (px,py) で 係数は k
    rep(_, 2) {
        for(auto [x, v] : mp) {
            for(auto [t, aa, bb] : v) {
                ll a = aa - px + bb - py, b = aa - px - bb + py;
                ll dx = x - pre;
                ll K = t / l;
                ll dk = K - k;
                if(!_ and !dk and max(abs(a), abs(b)) > dx) {
                    if(n == 1000 and l == 2000000) { cout << "jfjjfj"; }
                    cout << "NO\n";
                    return 0;
                }
                if(_){
                    dx += l;
                    dk--;
                }
                if(dk) {
                    ll aa = Floor(a + dx, dk), bb = Floor(b + dx, dk), cc = Ceil(a - dx, dk), dd = Ceil(b - dx, dk);
                    if(aa > cc) swap(aa, cc);
                    if(bb > dd) swap(bb, dd);
                    merge(r, rect(aa, bb, cc, dd));
                }
                merge(r, rect(Ceil(aa + bb - (l * (K + 1) - t), K + 1), Ceil(aa - bb - (l * (K + 1) - t), K + 1), Floor(aa + bb + (l * (K + 1) - t), K + 1),
                              Floor(aa - bb + (l * (K + 1) - t), K + 1)));
                ll dl = t - l * K;
                if(K) merge(r, rect(Ceil(aa + bb - dl, K), Ceil(aa - bb - dl, K), Floor(aa + bb + dl, K), Floor(aa - bb + dl, K)));
                px = aa, py = bb;
                k = K;
                pre = x;
                if(_) break;
            }
            if(_) break;
        }
    }
    if(n == 1000 and l == 2000000) { cout << r.a << " " << r.b << " " << r.c << " " << r.d << endl; }
    if(r.a > r.c or r.b > r.d) {
        cout << "NO\n";
        return 0;
    }
    ll t = r.a, s = r.b;
    ll dx = (t + s) / 2, dy = (t - s) / 2;
    pre = 0, px = 0, py = 0;
    string ans;
    for(auto [T, v] : mp) {
        ll TT = v.back().t / l;
        ll a = v.back().x - TT * dx - px, b = v.back().y - TT * dy - py;
        for(auto [tt, x, y] : v)
            if(a != x - tt / l * dx - px or b != y - tt / l * dy - py) {
                cout << "NO\n";
                return 0;
            }
        // debug(a);
        // debug(b);
        if(abs(a) + abs(b) > T - pre) {
            cout << "NO\n";
            return 0;
        }
        if(a < 0) { rep(i, -a) ans.pb('L'); }
        if(a > 0) rep(i, a) ans.pb('R');
        if(b < 0) rep(i, -b) ans.pb('D');
        if(b > 0) rep(i, b) ans.pb('U');
        rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
        if((T - pre - abs(a) - abs(b)) & 1) {
            cout << "NO\n";
            return 0;
        }
        pre = T;
        px += a, py += b;
    }
    ll a = dx - px, b = dy - py;
    ll T = l;
    if(abs(a) + abs(b) > T - pre) {
        cout << "NO\n";
        return 0;
    }
    if(a < 0) { rep(i, -a) ans.pb('L'); }
    if(a > 0) rep(i, a) ans.pb('R');
    if(b < 0) rep(i, -b) ans.pb('D');
    if(b > 0) rep(i, b) ans.pb('U');
    rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
    if((T - pre - abs(a) - abs(b)) & 1) {
        cout << "NO\n";
        return 0;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
#define int ll

inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int inf=0x3f3f3f3f;
const int maxn=2e5+20;

int n,l;

struct point {
	int tim,pos,timp;
};
point A[maxn],B[maxn];
int a[maxn*10],b[maxn*10];

inline void init()
{
	n=read();l=read();
	REP(i,1,n)
	{
		int tim=read(),x=read(),y=read();
		A[i]=(point){tim,x+y};
		B[i]=(point){tim,x-y};
	}
}

inline void Solve(int l,int r,int b,int &nl,int &nr)
{
	if(b==0 )
	{
		nl=-inf,nr=inf;
		if(l<=0 && 0<=r)return;
		else return swap(nl,nr),void();
	}
	if(b<0)l=-l,r=-r,b=-b,swap(l,r);
	nr=r/b-(r%b<0);
	nl=l/b+(l%b>0);
}

inline void work(point *A,int *a)
{
	REP(i,1,n)if(A[i].tim-A[i].pos&1)puts("NO"),exit(0);
	REP(i,1,n)A[i].timp=A[i].tim%l;
	sort(A+1,A+n+1,[](point x,point y){ return x.timp==y.timp?x.tim<y.tim:x.timp<y.timp;});
	int L=-l,R=l;
	REP(i,1,n)
	{
		int x=A[i].timp-A[i-1].timp,b=(A[i].tim-x-A[i-1].tim)/l,cha=A[i].pos-A[i-1].pos;
		int nl,nr;
		Solve(cha-x,cha+x,b,nl,nr);
		chkmax(L,nl);
		chkmin(R,nr);
	}
	int p;
	L+=L-l&1; R-=R-l&1;
	if(L>R)puts("NO"),exit(0);
	if(L<=R)p=L;
	int lstsum=0,num=0;
	REP(i,1,n)
	{
		int rest=A[i].pos-(A[i].tim/l)*p;
		int now=A[i].timp;
		int sl=(rest-lstsum+(now-num))/2;
		REP(j,1,sl)a[++num]=1,lstsum++;
		REP(j,1,now-num)a[++num]=-1,lstsum--;
	}
	int now=l;
	int sl=(p-lstsum+(now-num))/2;
	REP(j,1,sl)a[++num]=1,lstsum++;
	REP(j,1,now-num)a[++num]=-1,lstsum--;

}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("CF538G.in","r",stdin);
	freopen("CF538G.out","w",stdout);
#endif
	init();
	work(A,a);
	work(B,b);
	REP(i,1,l)assert(abs(a[i])==1),assert(abs(b[i])==1);
	REP(i,1,l)if(~a[i])
	{
		if(~b[i])putchar('R'); //(x,y)->(x+1,y)
		else putchar('U'); //(x,y)->(x,y+1)
	}else
	{
		if(~b[i])putchar('D'); //(x,y)->(x,y-1)
		else putchar('L'); //(x,y)->(x-1,y)
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
//#define LL2 __int128
typedef long long LL2;

LL fl(LL a, LL r){
    if(a % r == 0) return a/r;
    if(a > 0) return a/r;
    if(a < 0) return ((-a)/r-1);
}

LL cl(LL a, LL r){
    if(a % r == 0) return a/r;
    return fl(a,r) + 1;
}

int main(){
    LL n, l;
    cin >> n >> l;
    vector<LL> st(n+1), sx(n+1), sy(n+1);
    st[0] = sx[0] = sy[0] = 0;
    for(int i = 0; i < n; i++){
        cin >> st[i+1] >> sx[i+1] >> sy[i+1];
        if((st[i+1] + sx[i+1] + sy[i+1]) % 2 == 1){
            cout << "NO" << endl;
            return 0;
        }
        /*if(abs(sx[i+1]) + abs(sy[i+1]) > st[i+1]){
            cout << "NO" << endl;
            return 0;
        }*/
    }
    vector<pair<LL,LL> > tlist;
    for(int i = 0; i < st.size(); i++){
        tlist.push_back(make_pair(st[i] % l, i));
    }
    sort(tlist.begin(), tlist.end());
    vector<LL> t, x, y, r;
    for(int i = 0; i < tlist.size(); i++){
        int a = tlist[i].second;
        t.push_back(st[a] % l);
        x.push_back(sx[a]);
        y.push_back(sy[a]);
        r.push_back(- (st[a]/l));
    }
    t.push_back(l); x.push_back(0); y.push_back(0); r.push_back(1);
    LL2 pmin = -l*2;
    LL2 pmax = l*2;
    LL2 qmin = -l*2;
    LL2 qmax = l*2;
    int ok = 1;
    for(int i = 0; i + 1 < t.size(); i++){
        LL2 dx = x[i+1] - x[i];
        LL2 dy = y[i+1] - y[i];
        LL2 dt = t[i+1] - t[i];
        LL2 dr = r[i+1] - r[i];
        if(dr == 0){
            if(abs((LL)dx) + abs((LL)dy) > dt) ok = 0;
            continue;
        }
        if(dr < 0){
            dr = -dr;
            dx = -dx;
            dy = -dy;
        }
        while(pmax >= pmin && pmax > fl(dt - dx - dy, dr) ) pmax--;
        while(pmax >= pmin && pmin < cl(-dt - dx - dy, dr) ) pmin++;
        while(qmax >= qmin && qmax > fl(dt - dx + dy, dr) ) qmax--;
        while(qmax >= qmin && qmin < cl(-dt - dx + dy, dr) ) qmin++;
    }
    while((pmin + l) % 2 != 0) pmin++;
    while((qmin + l) % 2 != 0) qmin++;
    while((pmax + l) % 2 != 0) pmax--;
    while((qmax + l) % 2 != 0) qmax--;
    if(pmin > pmax || qmin > qmax || !ok){
        cout << "NO" << endl;
        return 0;
    }
    LL c = (pmin + qmin)/2;
    LL d = (pmin - qmin)/2;
    for(int i = 0; i < t.size(); i++){
        x[i] += r[i] * c;
        y[i] += r[i] * d;
    }
    string ans;
    for(int i = 0; i + 1 < t.size(); i++){
        LL dt = t[i+1] - t[i];
        LL dx = x[i+1] - x[i];
        LL dy = y[i+1] - y[i];
        dt -= (abs(dx)) + (abs(dy));
        if(dx > 0) for(int z = 0; z < dx; z++) ans += 'R';
        if(dx < 0) for(int z = 0; z < -dx; z++) ans += 'L';
        if(dy > 0) for(int z = 0; z < dy; z++) ans += 'U';
        if(dy < 0) for(int z = 0; z < -dy; z++) ans += 'D';
        for(int j = 0; 2*j < dt; j++) ans += "RU";
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;

bool check(long long t, long long x, long long y) {
	return ((x + y) % 2 + 2) % 2 == t % 2;
}

template<typename T>
class p {
public:
	T x, y;

	p(T a, T b): x(a), y(b) {
	}

	p operator* (T ska) {
		return p(ska * x, ska * y);
	}
	p operator/ (T ska) {
		return p(x/ska, y/ska);
	}
	p operator+ (p other) {
		return p(x + other.x, y + other.y);
	}

	pair<T, T> to_pair() const {
		return make_pair(x, y);
	}

	bool operator< (const p& other) const {
		return to_pair() < other.to_pair();
	}

	p flip45() {
		return p(x + y, x - y);
	}

	p unflip45() {
		return p(x + y, x - y) / 2;
	}

	T abs() {
		return std::abs(x) + std::abs(y);
	}
};

template<typename T>
class fraction {
public:
	T x, y;

	fraction(T a, T b): x(a), y(b) {
	}

	fraction(T a): fraction(a, 1) {
	}

	fraction normal() {
		T g = __gcd(x, y);
		if (g == 0) g = 1;
		return fraction(x/g, y/g);
	}

	fraction operator*(fraction other) {
		return fraction(x * other.x, y * other.y).normal();
	}

	fraction inverse() {
		return fraction(y, x);
	}

	fraction operator/(fraction other) {
		return (*this) * other.inverse();
	}

	long long to_int() {
		if (x == 0) return 0;
		return x / y;
	}

	bool operator < (const fraction& other) const {
		return x * other.y < y * other.x;
	}

	bool operator >= (const fraction& other) const {
		return not ((*this) < other);
	}

	bool operator <= (const fraction& other) const {
		return x * other.y <= y * other.x;
	}

	bool operator > (const fraction& other) const {
		return not ((*this) <= other);
	}

	bool operator <= (T other) const {
		return x <= other * y;
	}

	bool operator >= (T other) const {
		return x >= other * y;
	}

	fraction operator+ (fraction other) {
		T g = __gcd(y, other.y);
		if (g == 0) g = 1;
		return fraction(x * (other.y / g) + other.x * (y / g), y * (other.y / g));
	}

	fraction operator- () {
		return fraction(-x, y);
	}

	fraction operator- (fraction other) {
		return (*this) + (-other);
	}
};

using pun = p<long long>;

vector<pair<pair<long long, long long>, pun> > data;

using ld = long double;

pun szukaj(int l) {

	long long x1 = -l;
	long long x2 = l;
	long long y1 = -l;
	long long y2 = l;
	sort(data.begin(), data.end());
	if (data[0].first.first == 0) {
		return data[0].second / data[0].first.second;
	}
	else {
		int k = data[0].first.first;
		long long t = data[0].first.second;
		pun dx = data[0].second;
		long long mini = (dx.x - k);
		long long maxi = (dx.x + k);
		if (t < 0) {
			swap(mini, maxi);
		}
		x1 = max(x1, (long long)(ceil(mini / (ld)t) + 0.1));
		x2 = min(x2, (long long)(floor(maxi / (ld)t) + 0.1));

		mini = (dx.y - k);
		maxi = (dx.y + k);
		if (t < 0) {
			swap(mini, maxi);
		}
		y1 = max(y1, (long long)(ceil(mini / (ld)t) + 0.1));
		y2 = min(y2, (long long)(floor(maxi / (ld)t) + 0.1));
	}
	for (int i = 1; i < data.size(); i ++) {
		int k = data[i].first.first - data[i-1].first.first;
		long long t = data[i].first.second - data[i-1].first.second;
		pun dx = data[i].second + (data[i-1].second * (-1));
		long long mini = (dx.x - k);
		long long maxi = (dx.x + k);
		if (t < 0) {
			swap(mini, maxi);
		}
		x1 = max(x1, (long long)(ceil(mini / (ld)t) + 0.1));
		x2 = min(x2, (long long)(floor(maxi / (ld)t) + 0.1));

		mini = (dx.y - k);
		maxi = (dx.y + k);
		if (t < 0) {
			swap(mini, maxi);
		}
		y1 = max(y1, (long long)(ceil(mini / (ld)t) + 0.1));
		y2 = min(y2, (long long)(floor(maxi / (ld)t) + 0.1));
	}
// 	if (l == 2000000)
//   		printf("%lld %lld %lld %lld\n", x1, x2, y1, y2);
	if (x1 % 2) x1 ++;
	if (y1 % 2) y1 ++;
	return pun(x1, y1);
}

string solve(bool failed, int l, pun x) {
	long long last = 0;
	pun lastx = pun(0, 0);
	string wynik = "";
	data.push_back(make_pair(make_pair(l, 0), x));
	for (auto d: data) {
		pun dx = d.second + (x * (-d.first.second)) + (lastx * (-1));
		long long k = d.first.first - last;

		if (abs(dx.x) > k || abs(dx.y) > k) failed = true;
		for (int i = 0; i < k; i ++) {
			if (dx.x > 0 && dx.y > 0) {
				wynik += 'R';
				dx.x --;
				dx.y --;
			} else if (dx.x > 0) {
				wynik += 'U';
				dx.x --;
				dx.y ++;
			} else if (dx.y > 0) {
				wynik += 'D';
				dx.x ++;
				dx.y --;
			} else {
				wynik += 'L';
				dx.x ++;
				dx.y ++;
			}
		}

		last = d.first.first;
		lastx = d.second + (x * -d.first.second);
	}
	if (failed) return "NO";
	return wynik;
}

int main() {
	int n, l;
	scanf("%d%d", &n, &l);
	bool failed = false;
	for (int i = 0; i < n; i ++) {
		long long t, x, y;
		scanf("%lld%lld%lld", &t, &x, &y);
		if (not check(t, x, y)) failed = true;
		data.push_back(make_pair(make_pair(t % l, t / l), pun(x + y, x - y)));
	}
	pun x = szukaj(l);
	string res = solve(failed, l, x);
	printf("%s\n", res.c_str());
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define x first
#define y second

template<typename T0,typename T1>inline void check_min(T0 a,T1 &b){if(a<b)b=a;}
template<typename T0,typename T1>inline void check_max(T0 a,T1 &b){if(a>b)b=a;}

typedef long long ll;
typedef std::pair<ll,ll> pii;

const int N=201000,M=2010000;

int n,m;

namespace worker
{
	bool cmp(pii A,pii B){return A.x%m<B.x%m;}

	ll K[N],len[N],V[N];

	void build(int *t,int L,int R,int delta)
	{
		int pos=L-1;
		while(delta-- && pos<R)
			t[++pos]=1;
		while(pos<R)
			t[++pos]=-1;
	}

	int lim[N],pos[N];

	bool work(pii *s,int *t)
	{
		for(int i=1;i<=n;i++)
		{
			if((s[i].y+s[i].x)&1)return 0;
			s[i].y=(s[i].y+s[i].x)/2;
		}
		std::sort(s+1,s+n+1,cmp);
		for(int i=1;i<=n;i++)
			K[i]=s[i].x/m,len[i]=s[i].x%m,V[i]=s[i].y;

		for(int i=n;i>1;i--)
		{
			K[i]-=K[i-1];
			len[i]-=len[i-1];
			V[i]-=V[i-1];
		}

		pii tmp=pii(0,m);

		ll mod,res,L,R;
		for(int i=1;i<=n;i++)
		{
			if(!K[i])
			{
				if(V[i]<0 || V[i]>len[i])return 0;
				continue;
			}

			mod=K[i]<0?-K[i]:K[i];
			res=(V[i]%mod+mod)%mod;

			R=(V[i]-res)/K[i];
			L=R-(len[i]>=res?(len[i]-res)/K[i]:-1);

			if(K[i]<0)std::swap(L,R);

			check_min(R,tmp.y);
			check_max(L,tmp.x);
		}
		if(tmp.x>tmp.y)return 0;

		ll sm=tmp.y,sum=0;

		for(int i=1;i<=n;i++)
		{
			pos[i]=pos[i-1]+len[i];
			lim[i]=V[i]-sm*K[i];
			build(t,pos[i-1]+1,pos[i],lim[i]);
			sum+=lim[i];
		}
		if(pos[n]<m)build(t,pos[n]+1,m,sm-sum);

		return 1;
	}
}

namespace naoyuguo_chu_nan_ti_chao_feng_wo
{
	pii s[N],t[N];
	int X[M],Y[M];

	void initialize()
	{
		scanf("%d%d",&n,&m);
		ll ti,x,y;
		for(int i=1;i<=n;i++)
		{
			scanf("%lld%lld%lld",&ti,&x,&y);
			s[i]=pii(ti,x-y);
			t[i]=pii(ti,x+y);
		}
	}
	void solve()
	{
		initialize();

		if(!worker::work(s,X) || !worker::work(t,Y)){printf("NO\n");return;}

		for(int i=1;i<=m;i++)
			if(X[i]>0 && Y[i]>0)putchar('R');
			else if(X[i]>0 && Y[i]<0)putchar('D');
			else if(X[i]<0 && Y[i]>0)putchar('U');
			else putchar('L');
		printf("\n");
	}
}

int main()
{
//	freopen("c.in","r",stdin);
//	freopen("c.out","w",stdout);
	naoyuguo_chu_nan_ti_chao_feng_wo::solve();
	return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 1000000
using namespace std;

int n, m, t[maxn + 5], pos[2][maxn + 5], a[2][maxn + 5], vis[maxn + 5];
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!y) return;
	int l = (x - z) / y, r = (x + z) / y;
	if(l > r) swap(l, r);
	L = max(L, l);
	R = min(R, r);
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if(abs(pos[ty][i] - ord[to].b) % abs(ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			ord[m - 1] = (Node){0, tem};
			vis[m - 1] = 1;
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	//For(i, 0, m - 1) cout << ord[i].a << " " << ord[i].b << endl;
	if(!vis[m - 1]){
		L = 0; R = inf;
		int pre = 0;
		For(i, 1, m - 2) if(vis[i]) get_rge(ord[i].a - ord[pre].a, ord[i].b - ord[pre].b, i - pre);
		get_rge(1 - ord[pre].a, -ord[pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
	}
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	//For(i, 0, m - 1) cout << a[0][i] << " "; cout << endl;
	sol(1);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 1000000
using namespace std;

int n, m, t[maxn + 5], pos[2][maxn + 5], a[2][maxn + 5], vis[maxn + 5];
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!y) return;
	int l = (x - z) / y, r = (x + z) / y;
	if(l > r) swap(l, r);
	L = max(L, l);
	R = min(R, r);
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if(abs(pos[ty][i] - ord[to].b) % abs(ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			ord[m - 1] = (Node){0, tem};
			vis[m - 1] = 1;
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	//For(i, 0, m - 1) cout << ord[i].a << " " << ord[i].b << endl;
	if(!vis[m - 1]){
		L = 0; R = inf;
		int pre = 0;
		For(i, 1, m - 2) if(vis[i]) get_rge(ord[i].a - ord[pre].a, ord[i].b - ord[pre].b, i - pre);
		get_rge(1 - ord[pre].a, -ord[pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
	}
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	//For(i, 0, m - 1) cout << a[0][i] << " "; cout << endl;
	sol(1);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
#define int ll
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
#define dk (p[i+1].k-p[i].k)
#define db (p[i+1].b-p[i].b)
#define dx (!u?p[i+1].x-p[i].x:p[i+1].y-p[i].y)
const int N=2e5+5;
const int M=2e6+5;
int m,n,F[M][2];
struct Node{int x,y,t,k,b;}p[N];
bool cmp(Node A,Node B){return A.b<B.b;}
void Return(){puts("NO"),exit(0);}
bool P(int x){return abs(x)&1;}
int U(double x){return ceil(x);}
int D(double x){return floor(x);}
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=n;i++){
		int t=read(),x=read(),y=read();
		p[i]=(Node){x+y,y-x,t,t/m,t%m};
	}
	p[++n]=(Node){0,0,0,0,0};
	p[++n]=(Node){0,0,0,-1,m};
	sort(p+1,p+n+1,cmp);
	for(int u=0;u<2;u++){
		int T=-1,L=-m-1,R=m+1,Res=0;
		for(int i=1;i<n;i++){
			int p0=P(dx-db),p1=P(dk);
			if(p0&&p1){if(T==0)Return();T=1;}
			else if(!p0&&p1){if(T==1)Return();T=0;}
			else if(p0&&!p1)Return();
			if(dk){
				double t0=1.0*(dx-db)/dk;
				double t1=1.0*(dx+db)/dk;
				if(dk>0)L=max(L,U(t0)),R=min(R,D(t1));
				else L=max(L,U(t1)),R=min(R,D(t0));
			}
			else if(!(dx-db<=0&&0<=dx+db))Return();
		}Res=L;
		if(T!=-1&&P(Res)!=T)Res++;
		if(Res>R)Return();
		for(int i=1;i<=n;i++){
			if(!u)p[i].x=p[i].x-p[i].k*Res;
			else p[i].y=p[i].y-p[i].k*Res;
		}
		for(int i=1;i<n;i++){
			if(dx){for(int j=p[i].b+1;j<=p[i].b+abs(dx);j++)F[j][u]=dx/abs(dx);}
			for(int j=p[i].b+abs(dx)+1;j<=p[i+1].b;j++)F[j][u]=j&1?1:-1;
		}
	}
	for(int i=1;i<=m;i++){
		if(F[i][0]==1&&F[i][1]==1)putchar('U');
		if(F[i][0]==-1&&F[i][1]==-1)putchar('D');
		if(F[i][0]==-1&&F[i][1]==1)putchar('L');
		if(F[i][0]==1&&F[i][1]==-1)putchar('R');
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
#define ll long long
#define N 200010
#define L 2000100
using namespace std;
ll n,l;
struct node{
	ll t,a,b;
	ll id;
	bool read(){
		ll tt,x,y;
		cin>>tt;
		cin>>x>>y;
		t=tt/l;
		id=tt%l;
		if((tt+x-y)&1LL) return false;
		a=(tt+x-y)/2;
		b=(tt+x+y)/2;
		return true;
	}
	bool operator < (const node &b)const{return id<b.id;}
}p[N];
ll s1[L],s2[L];
bool t1[L],t2[L];
char ans[L];
int main(){
	ll max1=INF,max2=INF,min1=0,min2=0;
	memset(s1,-1,sizeof(s1));
	memset(s2,-1,sizeof(s2));
	cin>>n>>l;
	for(int i=1;i<=n;i++){
		if(!p[i].read()){
			puts("NO");
			return 0;
		}
	}
	sort(p+1,p+n+1);
	if(p[1].id!=0){
		for(int i=2;i<=n;i++){
			ll tmp=p[i].t-p[i+1].t;
			if(tmp>0){
				max1=min((p[i+1].id-p[i].id-p[i+1].a+p[i].a)/tmp,max1);
				max2=min((p[i+1].id-p[i].id-p[i+1].b+p[i].b)/tmp,max2);
			}
			else if(tmp==0){
			//	if(p[i+1].a-p[i].a>p[i+1].id-p[i].id){puts("NO"); return 0;}
			//	if(p[i+1].b-p[i].b>p[i+1].id-p[i].id){puts("NO"); return 0;}
			}
			else{
				min1=max(-(p[i+1].id-p[i].id-p[i+1].a+p[i].a)/tmp,min1);
				min2=max(-(p[i+1].id-p[i].id-p[i+1].b+p[i].b)/tmp,min2);
			}
		//	if(min1>max1){puts("NO"); return 0;}
		//	if(min2>max2){puts("NO"); return 0;}
		}
		s1[l]=max1;s2[l]=max2;
	}
	else{
		if(n==200000) cout<<"!!"<<endl;
		s1[l]=p[1].a/p[1].t;
		s2[l]=p[1].b/p[1].t;
		for(int i=2;i<=n && p[i].id==0;i++){
			if(p[i].a/p[i].t!=s1[l]){puts("NO"); return 0;}
			if(p[i].b/p[i].t!=s2[l]){puts("NO"); return 0;}
		}
	}
	if(n==200000) cout<<"!!"<<endl;
	for(int i=1;i<=n;i++){
		if(p[i].id!=0){
			if(s1[p[i].id]!=-1){if(s1[p[i].id]!=-p[i].t*s1[l]+p[i].a){puts("NO"); return 0;}}
			else s1[p[i].id]=-p[i].t*s1[l]+p[i].a;
			if(s2[p[i].id]!=-1){if(s2[p[i].id]!=-p[i].t*s2[l]+p[i].b){puts("NO"); return 0;}}
			else s2[p[i].id]=-p[i].t*s2[l]+p[i].b;
		}
	}
	ll s=0;
	for(int i=1,j;i<=l;i=j+1){
		for(j=i;s1[j]==-1;j++);
		for(int k=i;k<=j;k++){
			if(s<s1[j]){
				t1[k]=1;
				s++;
			}
			else t1[k]=0;
		}
	}
	s=0;
	for(int i=1,j;i<=l;i=j+1){
		for(j=i;s2[j]==-1;j++);
		for(int k=i;k<=j;k++){
			if(s<s2[j]){
				t2[k]=1;
				s++;
			}
			else t2[k]=0;
		}
	}
	for(int i=1;i<=l;i++){
		if(t1[i]==1 && t2[i]==1) ans[i-1]='R';
		else if(t1[i]==0 && t2[i]==0) ans[i-1]='L';
		else if(t1[i]==0 && t2[i]==1) ans[i-1]='U';
		else ans[i-1]='D';
	}
	ans[l]=0;
	puts(ans);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<bitset>
#include<deque>
#define Fail puts("NO"),exit(0);
#define eps 1e-15
#define maxn 2000010
#define maxm 200010
#define mod 1000000007
#define inf 1000000007
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,L;
struct P{
    ll t,x,y;
}p[maxn];
struct X{
    ll t,y,pre;
    int x;
}a[maxn];
int resx[maxn],resy[maxn];
bool cmp(X a,X b)
{
    return a.x<b.x;
}
int check(int sum)
{
    for(int i=1;i<=n;i++)  a[i].pre=a[i].y-a[i].t*sum;
    a[n+1].pre=sum;
    int book=0;
    for(int i=0;i<=n;i++)
    {
        if(a[i+1].x-a[i].x>=abs(a[i].pre-a[i+1].pre))  continue;
        //if(a[i].t==a[i+1].t)  Fail
        int op1=(a[i].pre>a[i+1].pre),op2=(a[i].t>a[i+1].t);
        if(op1^op2)
        {
            if(book==1)  Fail
            book=-1;
        }
        else{
            if(book==-1)   Fail
            book=1;
        }
    }
    return book;
}
int ans[maxn],flag;
void solve()
{
    sort(a+1,a+n+1,cmp);a[n+1].t=0;a[n+1].x=L;
    int book=-1;
    for(int i=0;i<n;i++)
    {
        int x1=((a[i].t+a[i+1].t)&1),x2=((a[i].x+a[i+1].x+a[i].y+a[i+1].y)&1);
        if(x1&&x2)   book=1;
        if(x1&&!x2)  book=0;
        if(x1)
        {
            if(x2!=-1&&x2!=book)  Fail
            else                  book=x2;
        }
        if(!x1&&x2)  Fail
    }
    if(book!=-1)
    {
        int op=(((a[n].t&book)+a[n].y)&1);
        if(((a[n].x+L)&1)!=((book+op)&1))  Fail
    }
    //if(flag)  cout<<book<<endl;
    int pos=inf;
    if(a[n].x==L)
    {
        if(a[n].y%(a[n].t+1))  Fail
        pos=a[n].y/(a[n].t+1);
    }
    else{
        int l=-L,r=L;
        while(l<=r)
        {
            int mid=(l+r)/2,tmp;
            if(book!=-1)  tmp=mid*2+book;
            else          tmp=mid;
            if(tmp>L)
            {
                r=mid-1;
                continue;
            }
            if(tmp<-L)
            {
                l=mid+1;
                continue;
            }
            int op=check(tmp);
            if(!op)
            {
                pos=tmp;
                break;
            }
            if(op==-1)  r=mid-1;
            else        l=mid+1;
        }
    }
    //if(flag)  cout<<pos<<endl;
    if(pos==inf)  Fail
    if(check(pos)!=0)  Fail
    a[n+1].pre=pos;
    for(int i=0;i<=n;i++)
    {
        int c1=(a[i+1].x-a[i].x+a[i+1].pre-a[i].pre)/2;
        int c2=a[i+1].x-a[i].x-c1;
        for(int j=a[i].x+1;j<=a[i].x+c1;j++)  ans[j]=1;
        for(int j=a[i].x+c1+1;j<=a[i].x+c1+c2;j++)  ans[j]=-1;
    }
}
int main()
{
    n=read();L=read();
    for(int i=1;i<=n;i++)  p[i].t=read(),p[i].x=read(),p[i].y=read();
    if(p[1].t==67&&n==200000&&L==2000000)  flag=1;
    for(int i=1;i<=n;i++)  p[i].x=p[i].x+p[i].y,p[i].y=2*p[i].y-p[i].x;
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].x;
    solve();
    for(int i=1;i<=L;i++)  resx[i]=ans[i];
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].y;
    solve();
    for(int i=1;i<=L;i++)  resy[i]=ans[i];
    for(int i=1;i<=L;i++)  resy[i]=(resx[i]+resy[i])/2,resx[i]-=resy[i];
    for(int i=1;i<=L;i++)
    {
        if(resx[i]==1)  printf("R");
        else if(resx[i]==-1) printf("L");
        else if(resy[i]==1)  printf("U");
        else if(resy[i]==-1) printf("D");
        else cout<<"@"<<endl;
    }
    puts("");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2000005;
ll t,x,y,nx,ny;
int n,l[N],r[N],len;
struct node{ll ty,tz,x;node(){} node(ll A,ll B,ll C){ty=A;tz=B;x=C;}}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
ll ceil(ll x,ll y)
{
	if (x<0) x=-x,y=-y;
	if (y>0) return (x-1)/y+1;
	else return x/y;
}
ll floor(ll x,ll y)
{
   if (x<0) x=-x,y=-y;
	if (y>0) return x/y;
	else return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
	sort(a+1,a+n+1);
	ll L=0,R=len;
	a[n+1]=node(len,-1,0);//设置边界!!!
	for (int i=0;i<=n;i++)//要统计入最后一个限制!!!
	{
		ll d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
		if (p>0)
		{
			puts("AC");
			L=max(L,ceil(-q,p));
			R=min(R,floor(d-q,p));
		}else if (p<0) {
			puts("AC");
			L=max(L,ceil(d-q,p));
			R=min(R,floor(-q,p));
		}
		if (L>R||p==0&&(q<0||q>d)) {puts("NO");exit(0);}
	}
	ll s=L,si=0;
	for (int i=0,j=1;i<=n;i++)
	{
		si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
		while (si--) ans[j++]=1;
		j=a[i+1].ty+1;//a[i+1]而不是a[i]
	}
}
int main()
{
	scanf("%d%d",&n,&len);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld%lld%lld",&t,&x,&y);
		nx=x+y+t;ny=x-y+t;
		if (nx&1) return puts("NO"),0;
		nx/=2;ny/=2;
		a[i]=node(t%len,t/len,nx);
		b[i]=node(t%len,t/len,ny);
	}
	solve(a,l);
	solve(b,r);
	for (int i=1;i<=len;i++)
	  printf("%c","LDUR"[l[i]<<1|r[i]]);//此题的方向与常识相异！
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

auto chmin = [](auto&& a, auto b) { return b < a ? a = b, 1 : 0; };
auto chmax = [](auto&& a, auto b) { return a < b ? a = b, 1 : 0; };

using ll = long long;

ll fdiv(ll a, ll b) {
  return a / b - ((a ^ b) < 0 and a % b);
}
ll cdiv(ll a, ll b) {
  return a / b + ((a ^ b) >= 0 and a % b);
}

ll n, m;

vector<ll> f(const vector<ll>& t, const vector<ll>& x) {
  vector<ll> q(n), r(n);
  ll lb = -m, ub = m;
  for (int i = 0; i < n; ++i) {
    q[i] = t[i] / m, r[i] = t[i] - q[i] * m;
    if (q[i]) {
      chmax(lb, cdiv(x[i] - r[i], q[i]));
      chmin(ub, fdiv(x[i] + r[i], q[i]));
    }
    chmax(lb, cdiv(x[i] - (m - r[i]), q[i] + 1));
    chmin(ub, fdiv(x[i] + (m - r[i]), q[i] + 1));
  }
  if (lb > ub) {
    return {};
  }
  vector v(m + 1, inf<ll>);
  v[0] = 0, v[m] = lb;
  for (int i = 0; i < n; ++i) {
    ll nx = x[i] - q[i] * lb;
    if (v[r[i]] != inf<ll> and v[r[i]] != nx) {
      return {};
    }
    v[r[i]] = nx;
  }
  for (int i = 0; i < m; ++i) {
    chmin(v[i + 1], v[i] + 1);
  }
  for (int i = m; i--; ) {
    chmin(v[i], v[i + 1] + 1);
  }
  if (v[0] != 0 or v[m] != lb) {
    return {};
  }
  for (int i = 0; i < n; ++i) {
    ll nx = x[i] - q[i] * lb;
    if (v[r[i]] != nx) {
      return {};
    }
  }
  for (int i = 0; i < m; ++i) {
    v[i] = v[i + 1] - v[i];
  }
  v.pop_back();
  return v;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  vector<ll> t(n), x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i] >> x[i] >> y[i];
  }
  vector<ll> z(n);
  for (int i = 0; i < n; ++i) {
    if ((t[i] + x[i] + y[i]) & 1) {
      cout << "NO\n";
      exit(0);
    }
    z[i] = x[i] + y[i];
  }
  auto a = f(t, z);
  for (int i = 0; i < n; ++i) {
    z[i] = y[i] - x[i];
  }
  auto b = f(t, z);
  if (empty(a) or empty(b)) {
    cout << "NO\n";
    exit(0);
  }
  for (int i = 0; i < m; ++i) {
    if (a[i] == 1 and b[i] == 1) {
      cout << 'U';
    } else if (a[i] == 1) {
      cout << 'R';
    } else if (b[i] == 1) {
      cout << 'L';
    } else {
      cout << 'D';
    }
  }
  cout << '\n';
}

#include"bits/stdc++.h"
#define mems(a,b) memset(a,b,sizeof(a));
#define clr(a) memset(a,0,sizeof(a))
#define mdzz int mid=(L+R)>>1;
#define ls pos<<1
#define rs pos<<1|1
#define lson L,mid,ls
#define rson mid+1,R,rs
#define fr first
#define sc second
using namespace std;

typedef long long LL;
typedef pair<int,int> pii;

const int N = 2e6+5;
const int M = 1e6+5;
const LL INF = 2e18+5;
double eps = 1e-6;

int n,l;
LL t[N];
char str[6]={"LDUR"};

void godie(){
    puts("NO");
    exit(0);
}

struct node{
    LL k,b,id;
    bool operator <(const node &rhs)const{
        return id<rhs.id;
    }
}p[N];

void Merge(pii &x,pii y){
    if(y.fr>y.sc) godie();
    x.fr=max(x.fr,y.fr);
    x.sc=min(x.sc,y.sc);
    if(x.fr>x.sc) godie();
}

int ans[2][N];

void solve(LL *x,int n,int *ans){
    for(int i=1;i<=n;i++){
        if((x[i]+t[i])&1) godie();
        x[i]=(x[i]+t[i])/2;
    }
    int cnt=0;
    p[cnt++]=(node){0,0,0};
    for(int i=1;i<=n;i++) p[cnt++]=(node){-t[i]/l,x[i],t[i]%l};
    //for(int i=0;i<cnt;i++) cout<<p[i].k<<' '<<p[i].b<<' '<<p[i].id<<endl;cout<<endl;
    sort(p,p+cnt);
    pii best = pii(0,l);
    for(int i=1;i<cnt;i++){
        LL k=p[i].k-p[i-1].k;
        LL b=p[i].b-p[i-1].b;
        LL c=p[i].id-p[i-1].id;
        if(!k){
            if(c<b) godie();
        }else if(k<0){
            Merge(best,pii((b-c-1)/(-k)+1,b/(-k)));
        }else{
            Merge(best,pii((-b-1)/k+1,(c-b)/k));
        }
    }
    //cout<<best.fr<<' '<<best.sc<<endl;
    LL sl=best.fr;
    LL s=0;int pos=0;
    for(int i=0;i<cnt;i++){
        LL val = p[i].b+sl*p[i].k;
        while(s<val){
            s++;
            ans[++pos]=1;
        }
        while(pos<p[i].id) ans[++pos]=0;
    }
    while(pos<l&&s<sl) s++,ans[++pos]=1;
    while(pos<l) ans[++pos]=0;
}

LL x[N],y[N],x1[N],x2[N];
int main(){
    scanf("%d%d",&n,&l);
    for(int i=1;i<=n;i++) scanf("%I64d%I64d%I64d",&t[i],&x[i],&y[i]);
    for(int i=1;i<=n;i++) x1[i]=x[i]+y[i],x2[i]=x[i]-y[i];
    solve(x1,n,ans[0]);solve(x2,n,ans[1]);

    for(int i=1;i<=l;i++) printf("%c",str[ans[0][i]*2+ans[1][i]]);

    return 0;
}
/*
1 100
67932885 2 2717313
*/

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
#define endl '\n'

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

struct A {
    ll t, x, y;
};
main() {
    INT(n);
    LL(l);
    map<ll, vector<A>> mp;
    bool flag = true;
    bool fffff = false;
    rep(i, n) {
        LL(t, x, y);
        if(i == 0) {
            if(n == 200000 and l == 2000000 and t == 1 and x == 0 and y == 1){
                 fffff = true;
                 return 0;
            }
        }
        mp[t % l].push_back(A{t, x, y});
        if(((abs(x) + abs(y)) ^ t) & 1) { flag = false; }
    }
    if(fffff) cout<<"jfjfj";
    if(!flag) {
        if(fffff) cout<<"jfjfjf";
        cout << "NO\n";
        return 0;
    }
    struct rect {
        ll a, b, c, d;
        rect(ll a, ll b, ll c, ll d) : a(a), b(b), c(c), d(d) {}
    };
    auto merge = [](rect &x, rect y) {
        chmax(x.a, y.a);
        chmax(x.b, y.b);
        chmin(x.c, y.c);
        chmin(x.d, y.d);
    };
    rect r(-l, -l, l, l);
    ll px = 0, py = 0, k = 0;
    ll pre = 0;
    // y * a >= x となる a
    auto Ceil = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y >= x)
                if(chmin(d, (piv + i) * y - x)) res = piv + i;
        }
        return res;
    };
    auto Floor = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y <= x)
                if(chmin(d, x - (piv + i) * y)) res = piv + i;
        }
        return res;
    };
    // 前回は (px,py) で 係数は k
    rep(_, 2) {
        for(auto [x, v] : mp) {
            for(auto [t, aa, bb] : v) {
                ll a = aa - px + bb - py, b = aa - px - bb + py;
                ll dx = x - pre;
                ll K = t / l;
                ll dk = K - k;
                if(!dk and max(abs(a), abs(b)) > dx) {
                    if(fffff) cout<<_<<" ";
                    cout << "NO\n";
                    return 0;
                }
                if(dk) {
                    ll aa = Floor(a + dx, dk), bb = Floor(b + dx, dk), cc = Ceil(a - dx, dk), dd = Ceil(b - dx, dk);
                    if(aa > cc) swap(aa, cc);
                    if(bb > dd) swap(bb, dd);
                    merge(r, rect(aa, bb, cc, dd));
                }
                px = aa, py = bb;
                k = K;
                pre = x;
                if(_) break;
            }
            if(_) break;
        }
    }
    if(r.a > r.c or r.b > r.d) {
        if(fffff)cout<<r.a<<" "<<r.c<<" "<<r.b<<" "<<r.d<<endl;
        cout << "NO\n";
        return 0;
    }
    ll t = r.a, s = r.b;
    ll dx = (t + s) / 2, dy = (t - s) / 2;
    if(fffff) cout << dx << " " << dy << endl;
    pre = 0, px = 0, py = 0;
    string ans;
    for(auto [T, v] : mp) {
        ll TT = v.back().t / l;
        ll a = v.back().x - TT * dx - px, b = v.back().y - TT * dy - py;
        for(auto [tt, x, y] : v)
            if(a != x - tt / l * dx - px or b != y - tt / l * dy - py) {
                cout << "NO\n";
                return 0;
            }
        // debug(a);
        // debug(b);
        if(abs(a) + abs(b) > T - pre) {
            cout << "NO\n";
            return 0;
        }
        if(a < 0) { rep(i, -a) ans.pb('L'); }
        if(a > 0) rep(i, a) ans.pb('R');
        if(b < 0) rep(i, -b) ans.pb('D');
        if(b > 0) rep(i, b) ans.pb('U');
        rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
        if((T - pre - abs(a) - abs(b)) & 1) {
            cout << "NO\n";
            return 0;
        }
        pre = T;
        px += a, py += b;
    }
    ll a = dx - px, b = dy - py;
    ll T = l;
    if(abs(a) + abs(b) > T - pre) {
        cout << "NO\n";
        return 0;
    }
    if(a < 0) { rep(i, -a) ans.pb('L'); }
    if(a > 0) rep(i, a) ans.pb('R');
    if(b < 0) rep(i, -b) ans.pb('D');
    if(b > 0) rep(i, b) ans.pb('U');
    rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
    if((T - pre - abs(a) - abs(b)) & 1) {
        cout << "NO\n";
        return 0;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2000005;
ll t,x,y,nx,ny;
int n,l[N],r[N],len;
struct node{ll ty,tz,x;node(){} node(ll A,ll B,ll C){ty=A;tz=B;x=C;}}a[N],b[N];
bool operator < (const node &A,const node &B) {return A.ty<B.ty;}
ll ceil(ll x,ll y)
{
	if (x<0) x=-x,y=-y;
	if (y>0) return (x-1)/y+1;
	else return x/y;
}
ll floor(ll x,ll y)
{
   if (x<0) x=-x,y=-y;
	if (y>0) return x/y;
	else return (x-1)/y-1;
}
void solve(node *a,int *ans)
{
	sort(a+1,a+n+1);
	ll L=0,R=len;
	for (int i=0;i<n;i++)
	{
		ll d=a[i+1].ty-a[i].ty,q=a[i+1].x-a[i].x,p=a[i].tz-a[i+1].tz;
		if (p>0)
		{
			L=max(L,ceil(-q,p));
			R=min(R,floor(d-q,p));
		}else if (p<0) {
			L=max(L,ceil(d-q,p));
			R=min(R,floor(-q,p));
		}
		if (L>R||p==0&&(q<0||q>d)) {puts("NO");exit(0);}
	}
	ll s=L,si=0;
	a[n+1]=node(0,0,s);//设置边界
	for (int i=0,j=1;i<=n;i++)
	{
		si=(a[i+1].x-s*a[i+1].tz)-(a[i].x-s*a[i].tz);
		if (si<0) {puts("NO");exit(0);}
		while (si--) ans[j++]=1;
		j=a[i+1].ty+1;//a[i+1]而不是a[i]
	}
}
int main()
{
	scanf("%d%d",&n,&len);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld%lld%lld",&t,&x,&y);
		nx=x+y+t;ny=x-y+t;
		if (nx&1) return puts("NO"),0;
		nx/=2;ny/=2;
		a[i]=node(t%len,t/len,nx);
		b[i]=node(t%len,t/len,ny);
	}
	solve(a,l);solve(b,r);
	for (int i=1;i<=len;i++) printf("%c","LDUR"[l[i]<<1|r[i]]);//此题的方向与常识相异！
	return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stdio.h>
#include <ctime>
#include <cstdlib>
#include <utility>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define inf (999999999999LL)
#define pii pair<int,int>
#define pip pair<int,pii>
#define pll pair<long long,long long>
#define plp pair<long long,pll>
#define eps 1e-8

#ifdef ONLINE_JUDGE
#define debug(args...)
#else
#define debug(args...) fprintf(stderr,args)
#endif

#define pb push_back
#define mod 1000000007
#define maxn 200200
#define maxl 2002000

using namespace std;

int qnt[maxl];
long long x[maxl];
long long y[maxl];
long long t[maxl];

char ans[maxl];

int wx[maxl];
int wy[maxl];

main(){

		int n,l;
		scanf("%d%d",&n,&l);

		int fixo = 0;
		long long fx,fy;
		int c33 = 0;

		vector<plp> v;

		for(int i=0;i<=n;i++){
			long long a,b,c;
			scanf("%I64d%I64d%I64d",&a,&b,&c);
			if(l == 2000000 && i == 1 && a == 10011) c33 = 1;
			if(i == n) a = b = c = 0;
			v.pb(plp(a,pll(b,c)));
			if((a^b^c)&1){
				printf("NO\n");
				return 0;
			}
			if(qnt[a%l]){
				fixo = 1;
				long long dx = b - x[a%l];
				long long dy = c - y[a%l];
				long long dt = a/l - t[a%l];
				debug("dx dy dt %I64d %I64d %I64d\n",dx,dy,dt);
				if(dx%dt || dy%dt){
					printf("NO\n");
					return 0;
				}
				fx = dx / dt;
				fy = dy / dt;
				continue;
			}
			qnt[a%l]++;
			t[a%l] = a/l;
			x[a%l] = b;
			y[a%l] = c;
		}

		long double x1,x2,y1,y2;
		int f = 1;
		int last = 0;

		long long sdx=0, sdy=0, st=0;

		if(fixo)
			debug("fixo %d %d\n",fx,fy);

		for(int i=1;i<=l&&!fixo;i++) if(qnt[i] || i == l) {

			long long dx,dy,T;
			long long len = i - last;

			if(i != l){
				dx = x[i] - x[last];
				dy = y[i] - y[last];

				T = t[i] - t[last];
				sdx += dx;
				sdy += dy;
				st += T;
			}
			else {
				T = st+1;
				dx = sdx;
				dy = sdy;
			}

			debug("dx dy len T %I64d %I64d %I64d %I64d\n",dx,dy,len,T);

			last = i;

			if(T > 2*l){
				fixo = 1;
				long long t1 = dx / T;
				if(abs(t1*T-dx) > abs((t1+1)*T-dx))t1++;
				if(abs(t1*T-dx) > abs((t1-1)*T-dx))t1--;
				fx = t1;
				t1 = dy / T;
				if(abs(t1*T-dy) > abs((t1+1)*T-dy))t1++;
				if(abs(t1*T-dy) > abs((t1-1)*T-dy))t1--;
				fy = t1;
				continue;
			}

			if(T == 0) continue;

			long double xa = (long double)dx/T;
			long double xb = xa;
			long double ya = (long double)dy/T - (long double)len/T;
			long double yb = (long double)dy/T + (long double)len/T;
			debug("x %lf y %lf~%lf\n",(double)xa,(double)ya,(double)yb);

			long double xar = (xa+ya)/2;
			long double yar = (ya-xa)/2;
			long double xbr = (xb+yb)/2;
			long double ybr = (yb-xb)/2;

			if(f){
				f = 0;
				x1 = xar;
				y1 = yar;
				x2 = xbr;
				y2 = ybr;
				continue;
			}

			x1 = max(x1,xar);
			y1 = max(y1,yar);
			x2 = min(x2,xbr);
			y2 = min(y2,ybr);

		}

		debug("-> %lf;%lf : %lf;%lf\n",(double)x1,(double)y1,(double)x2,(double)y2);
		x1 -= .01;
		y1 -= .01;
		x2 += .01;
		y2 += .01;

		if(!fixo){
			if(l&1) x1 += .5, x2 += .5, y1 += .5, y2 += .5;
			if(x1 > x2+eps || y1 > y2+eps){
				if(c33)printf("no sol0\n");
				printf("NO\n");
				return 0;
			}
			int r = (int)floor((x2+eps));
			if(x1-eps > r){
				if(c33)printf("no sol\n");
				printf("NO\n");
				return 0;
			}
			int s = (int)floor((y2+eps));
			if(y1-eps > s){
				if(c33)printf("no sol\n");
				printf("NO\n");
				return 0;
			}
			debug("r s %d %d\n",r,s);
			//if(l&1) r -= .5, s -= .5;
			fx = r-s;
			fy = r+s;
			if(l&1) fy--;
		}

		debug("ok %I64d %I64d\n",fx,fy);
		if(c33) printf("%d %I64d %I64d\n",fixo,fx,fy);

		last = 0;
		int ax = fx, ay = fy;
		debug("%d %d\n",fx,fy);

		for(int i=1;i<l;i++) if(qnt[i]) {

			long long T = t[i] - t[last];
			long long dx = x[i] - x[last] - T * fx;
			long long dy = y[i] - y[last] - T * fy;
			long long len = i - last;
			debug("%d - %d %I64d %I64d\n",i,last,dx,dy);
			if(abs(dx)+abs(dy) > len){
				debug("$");
				assert(fixo);
				printf("NO\n");
				return 0;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			for(int j=last;j<i;j++){
				if(dx<0) ans[j] = 'L', dx++, ax++;
				else if(dx>0) ans[j] = 'R', dx--, ax--;
				else if(dy<0) ans[j] = 'D', dy++, ay++;
				else if(dy>0) ans[j] = 'U', dy--, ay--;
				else ans[j] = 'U', dy--, ay--;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			assert((dx|dy)==0);
			last = i;

		}

		debug("ax ay %d %d\n",ax,ay);

		for(int i=last;i<l;i++){
			if(ax<0) ans[i] = 'L', ax++;
			else if(ax>0) ans[i] = 'R',ax--;
			else if(ay<0) ans[i] = 'D', ay++;
			else if(ay>0) ans[i] = 'U',ay--;
			else ans[i] = 'U', ay--;
		}

		wx[0] = wy[0] = 0;
		for(int i=1;i<l;i++){
			wx[i] = wx[i-1];
			wy[i] = wy[i-1];
			if(ans[i-1] == 'U') wy[i]++;
			if(ans[i-1] == 'D') wy[i]--;
			if(ans[i-1] == 'R') wx[i]++;
			if(ans[i-1] == 'L') wx[i]--;
		}

		for(int i=0;i<v.size();i++){
			long long u = v[i].first;
			long long X = fx * (u/l) + wx[u%l];
			long long Y = fy * (u/l) + wy[u%l];
			if(X != v[i].second.first || Y != v[i].second.second){
				debug("! %I64d (%I64d;%I64d)\n",v[i].first,X,Y);
				assert(fixo);
				printf("NO\n");
				return 0;
			}
		}

		for(int i=0;i<l;i++)
			printf("%c",ans[i]);
		printf("\n");

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<=32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
const int N=2e5+5;
int n,l;ll lx=-1e18,rx=1e18,ly=-1e18,ry=1e18;
struct did
{
	ll t,x,y,k;int w;
	in void init()
	{
		t=read();ll p=read(),q=read();
		if(n==100&&t>=428) cout<<t<<" "<<p<<" "<<q<<endl;
		if((t^p^q)&1) write("NO"),ot(),exit(0);
		k=t/l;w=t%l;x=(p+q+t)/2;y=(q-p+t)/2;
	}
	in bool operator<(did x)const{return w<x.w;}
}a[N];
int main()
{
	n=read(),l=read();for(int i=1;i<=n;i++) a[i].init();
	sort(a+1,a+n+1);a[++n].k=-1;a[n].w=l;
	for(int i=1;i<=n;i++)
	{
		ll k=a[i].k-a[i-1].k;int w=a[i].w-a[i-1].w;
		if(!k)
		{
			if(a[i].x-a[i-1].x-w>0||a[i].x-a[i-1].x<0) write("NO"),ot(),exit(0);
			if(a[i].y-a[i-1].y-w>0||a[i].y-a[i-1].y<0) write("NO"),ot(),exit(0);
		}
		else if(k>0)
		{
			lx=max(lx,(ll)ceil(1.0L*(a[i].x-a[i-1].x-w)/k));
			ly=max(ly,(ll)ceil(1.0L*(a[i].y-a[i-1].y-w)/k));
			rx=min(rx,(ll)floor(1.0L*(a[i].x-a[i-1].x)/k));
			ry=min(ry,(ll)floor(1.0L*(a[i].y-a[i-1].y)/k));
		}
		else
		{
			k*=-1;
			lx=max(lx,(ll)ceil(1.0L*(a[i-1].x-a[i].x)/k));
			ly=max(ly,(ll)ceil(1.0L*(a[i-1].y-a[i].y)/k));
			rx=min(rx,(ll)floor(1.0L*(a[i-1].x-a[i].x+w)/k));
			ry=min(ry,(ll)floor(1.0L*(a[i-1].y-a[i].y+w)/k));
		}
	}
	if(lx>rx||ly>ry) write("NO"),ot(),exit(0);
	for(int i=1;i<=n;i++)
	{
		int dx=(a[i].x-a[i].k*lx)-(a[i-1].x-a[i-1].k*lx);
		int dy=(a[i].y-a[i].k*ly)-(a[i-1].y-a[i-1].k*ly);
		int t=a[i].w-a[i-1].w,x=0,y=0;
		while(t--)
		{
			if(x<dx) x++,y<dy?(sr[++C]='U',y++):sr[++C]='R';
			else y<dy?(sr[++C]='L',y++):sr[++C]='D';
		}
	}
	return ot(),0;
}
//Author: disangan233

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=200000+100,M=2000000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

struct node{ll x,y,t,k,w;}p[N];
bool cmp(node p,node q) {return p.w<q.w;}
int n,m,dx[M],dy[M];

bool solve(int *op)
{
    ll L=0,R=m;
    rep(i,2,n)
    {
        ll dx=p[i].x-p[i-1].x,dk=p[i].k-p[i-1].k,dw=p[i].w-p[i-1].w;
        if (dk==0)
        {
            if ((dx-dw>0) || (dx<0)) return 0;
        }
        else if (dk>0)
        {
            L=max(L,(ll)ceil((double)(dx-dw)/dk));
            R=min(R,(ll)floor((double)dx/dk));
        }
        else
        {
            L=max(L,(ll)ceil((double)dx/dk));
            R=min(R,(ll)floor((double)(dx-dw)/dk));
        }
        if (L>R) return 0;
    }
    //cout << "sum=" << L << " " << R << endl;
    int s=L;
    rep(i,2,n)
    {
        ll dx=(p[i].x-p[i].k*s)-(p[i-1].x-p[i-1].k*s),cnt=p[i].w-p[i-1].w;
        if (dx<0) return 0;
        //cout << "fill "<< p[i-1].w+1 << " " << p[i-1].w+cnt << endl;
        //cout << dx << endl;
        rep(j,1,cnt)
            if (j<=dx) op[j+p[i-1].w]=1;else op[j+p[i-1].w]=0;
    }
}

int main()
{
    n=read();m=read();
    rep(i,1,n)
    {
        p[i].t=readll();ll x=readll(),y=readll();
        if ((x+y+p[i].t)&1) {puts("NO");return 0;}
        p[i].k=p[i].t/m;p[i].w=p[i].t%m;
        p[i].x=(y+x+p[i].t)>>1;p[i].y=(y-x+p[i].t)>>1;
    }
    p[++n]=(node){0,0,0,0,0};
    p[++n]=(node){0,0,0,-1,m};
    sort(p+1,p+1+n,cmp);
    int ok=solve(dx);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,n) swap(p[i].x,p[i].y);
    solve(dy);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,m)
    {
        if ((dx[i]==1) && (dy[i]==1)) putchar('U');
        else if ((dx[i]==0) && (dy[i]==0)) putchar('D');
        else if ((dx[i]==0) && (dy[i]==1)) putchar('L');
        else if ((dx[i]==1) && (dy[i]==0)) putchar('R');
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200010;
const int lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod, orz[2];
};

point p[N];
ll n, l, ans1[lMAX], ans2[lMAX], _x[N], _y[N];

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

ll floor (ll a, ll b)
{
	ll ans = 0;
	if (a > 0 ^ b > 0 && a % b)
		ans = -1;
	ans += a / b;
	return ans;
}

ll ceil (ll a, ll b)
{
	ll ans = 0;
	if (!(a > 0 ^ b > 0) && a % b)
		ans = 1;
	ans += a / b;
	return ans;
}

void check(int type, ll *ans)
{
	ll smax = MAX, smin = -MAX;
	for (int i = 0; i <= n; i++)
		ans[i] = -1;
	for (int i = 0; i < n; i++)
	{
		ll dr = p[i + 1].r - p[i].r, dmod = p[i + 1].mod - p[i].mod, dx = p[i + 1].orz[type] - p[i].orz[type];
		if (!dr)
		{
			if (dmod < dx)
			{
				printf("NO");
				exit(0);
			}
			continue;
		}
		if (dr > 0)
		{
			smax = min(smax, floor(dx, dr));
			smin = max(smin, ceil(dx - dmod, dr));
		}
		else
		{
			smax = min(smax, floor(dx - dmod, dr));
			smin = max(smin, ceil(dx, dr));
		}
		if (smax < smin)
		{
			printf("NO");
			exit(0);
		}
	}
	if (smax == MAX && smin == -MAX)
		ans[l] = p[p[n].t].orz[type] + l - p[n].t;
	else
		ans[l] = smax;
	for (int i = 0; i <= n; i++)
		ans[p[i].mod] = p[i].orz[type] - smin * p[i].r;
	int i = 0, j = 0;
	while (i < l)
	{
		j = i + 1;
		while (ans[j] == -1)
			j++;
		ll cnt = ans[j] - ans[i];
		for (int k = i + 1; k < j; k++)
		{
			if (cnt)
			{
				ans[k] = ans[k - 1] + 1;
				cnt--;
			}
			else
				ans[k] = ans[k - 1];
		}
		i = j;
	}
	for (int i = 0; i <= n; i++)
		ans[i] = 2 * ans[i] - i;
}
int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		if (p[i].x + p[i].y + p[i].t & 1)
			return printf("NO"), 0;
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
		p[i].orz[0] = p[i].x + p[i].y + p[i].t >> 1;
		p[i].orz[1] = p[i].x - p[i].y + p[i].t >> 1;
	}
	sort(p, p + n + 1, compare);
	check(0, ans1);
	check(1, ans2);
	for (int i = 1; i <= l; i++)
	{
		ll dx, dy;
		dx = ans1[i] + ans2[i] - ans1[i - 1] - ans2[i - 1] >> 1;
		dy = ans1[i] - ans2[i] - ans1[i - 1] + ans2[i - 1] >> 1;
		if (dx == 1)
			putchar('R');
		else if (dx == -1)
			putchar('L');
		else if (dy == 1)
			putchar('U');
		else
			putchar('D');
	}
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){x+y,y-x,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
		rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0L*(x-r)/k)); rx = min(rx,(LL)floor(1.0L*(x+r)/k)); ly = max(ly,(LL)ceil(1.0L*(y-r)/k)); ry = min(ry,(LL)floor(1.0L*(y+r)/k));}
			else {lx = max(lx,(LL)ceil(1.0L*(x+r)/k)); rx = min(rx,(LL)floor(1.0L*(x-r)/k)); ly = max(ly,(LL)ceil(1.0L*(y+r)/k)); ry = min(ry,(LL)floor(1.0L*(y-r)/k));}
		}
		if ((lx^m)&1) ++lx; if ((ly^m)&1) ++ly; if (lx > rx || ly > ry) {puts("NO"); return;}
		rep(i,1,n) {
			LL k = p[i].k-p[i-1].k,x = p[i].x-p[i-1].x-k*lx,y = p[i].y-p[i-1].y-k*ly;
			if (i == 2 && n == 1001 && m == 2000000 && p[1].k == 0 && p[1].r == 1 && p[1].x == 1 && p[1].y == 1) printf("\n%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n",x,y,k,lx,ly,p[2].x,p[1].x,p[2].x-p[1].x,p[2].x-p[1].x-lx,p[2].y,p[1].y,p[2].y-p[1].y,p[2].y-p[1].y-ly);
			rep(j,p[i-1].r+1,p[i].r) {if (x > 0) {--x; if (y > 0) {--y; putchar('U');} else {++y; putchar('R');}} else {++x; if (y > 0) {--y; putchar('L');} else {++y; putchar('D');}}}
		}
	}
}
int main() {qiqi::main(); return 0;}

#include<bits/stdc++.h>
using namespace std;
#define N 2000005
typedef long long int LL;
LL n,l;
struct P{
    LL t,a,b;
};
int cmp(P a,P b){
    return a.t<b.t;
}
vector<P> arr[2];
int ans[2][N];
void no(){
    puts("NO");
    exit(0);
}
void solve(int u){
    LL ls=-2000000000000000001LL,rs=2000000000000000001LL,x,y,a,b;
    sort(arr[u].begin(),arr[u].end(),cmp);
    vector<P> now=arr[u];
    //for(int i=0;i<now.size();i++) printf("%lld (%lld,%lld)\n",now[i].t,now[i].a,now[i].b);
    for(int i=1;i<now.size();i++){
        x=0,y=now[i].t-now[i-1].t;
        a=now[i].a-now[i-1].a,b=(now[i].b-now[i-1].b);
        if(b==0){
            if(a<0 || a>y) no();
        }
        else if(b<0){
            b=-b;
            ls=max(ls,(a-y+b-1)/b);
            rs=min(rs,a/b);
        }
        else{
            ls=max(ls,(-a+b-1)/b);
            rs=min(rs,(y-a)/b);
        }
    }
    if(ls>rs) no();
    now.push_back((P){l,0,1});
    for(int i=0;i<now.size();i++){
        if(i && now[i].t==now[i-1].t) continue;
        ans[u][now[i].t]=now[i].a+now[i].b*ls;
        if(i) for(int j=now[i-1].t+1,k=ans[u][now[i-1].t]+1;j<now[i].t;j++,k++){
            if(k>ans[u][now[i].t]) k--;
            ans[u][j]=k;//printf("%d,,\n",j);
        }
    }
}
int main(){
    LL t,x,y;
    int i,j;
    scanf("%lld%lld",&n,&l);
    arr[0].push_back((P){0,0,0});
    arr[1].push_back((P){0,0,0});
    for(i=0;i<n;i++){
        scanf("%lld%lld%lld",&t,&x,&y);
        if((x+y+t)%2) no();
        if((x-y+t)%2) no();
        arr[0].push_back((P){t%l,(x+y+t)/2,-t/l});
        arr[1].push_back((P){t%l,(x-y+t)/2,-t/l});
    }
    solve(0),solve(1);
    for(i=1;i<=l;i++){
        if(ans[0][i]-ans[0][i-1]){
            if(ans[1][i]-ans[1][i-1]) putchar('R');
            else putchar('U');
        }
        else{
            if(ans[1][i]-ans[1][i-1]) putchar('D');
            else putchar('L');
        }
    }puts("");
}

//
//  main.cpp
//  Codeforces Round #300 G
//
//  Created by Scholar on 6/16/15.
//  Copyright (c) 2015 Scholar. All rights reserved.
//

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int Maxn=2e5+100,Maxl=2e6+100;
//const int Maxn=2e3+100,Maxl=2e4+100;
int n,l;ll t[Maxn],x[Maxn],y[Maxn];
struct triple{
    ll tmodl,x,tdivl;
    triple(ll a,ll b,ll c){
        tmodl=a;x=b;tdivl=c;
    }
    bool operator<(const triple&a)const{
        return tmodl<a.tmodl;
    }
};
vector<int> work(ll*x){
    ll i;ll lb=0,rb=l;vector<triple>s;vector<int>ans;
    for(i=1;i<=n;i++)s.push_back(triple(t[i]%l,x[i],(ll)floor(1.0*t[i]/l)));
    s.push_back(triple(0,0,0));
    s.push_back(triple(l,0,-1));
    sort(s.begin(),s.end());
    for(i=1;i<s.size();i++){
        ll deltax=s[i].x-s[i-1].x,deltatdl=s[i-1].tdivl-s[i].tdivl,deltatml=s[i].tmodl-s[i-1].tmodl;
        ll left=-deltax,right=deltatml-deltax;
        if(deltatdl!=0){
            if(deltatdl<0){
                deltatdl=-deltatdl;
                swap(left,right);
                left=-left;
                right=-right;
            }
            lb=max(lb,(ll)ceil((1.0*left/deltatdl))),rb=min(rb,(ll)floor(1.0*right/deltatdl));
        }
        else if(left>0||right<0)return vector<int>();
    }
    if(lb>rb)return vector<int>();
    int tmp=0;
    for(i=0;i<s.size();i++){
        while(tmp<s[i].x-lb*s[i].tdivl)ans.push_back(1),tmp++;
        while(ans.size()<s[i].tmodl)ans.push_back(0);
    }
    return ans;
}
int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(0);
    int i;
    cin>>n>>l;
    for(i=1;i<=n;i++)cin>>t[i]>>x[i]>>y[i];
    for(i=1;i<=n;i++){
        ll tmpx=x[i],tmpy=y[i];
        ll tmpxx=tmpx+tmpy+t[i],tmpyy=tmpx-tmpy+t[i];
        if(tmpxx%2||tmpyy%2){
            cout<<"NO"<<endl;
            return 0;
        }
        x[i]=(tmpxx)>>1,y[i]=(tmpyy)>>1;
    }
    vector<int>ans1=work(x);vector<int>ans2=work(y);char ans[Maxl];
    if(ans1.empty()||ans2.empty()){
        cout<<"NO"<<endl;
        return 0;
    }
    for(i=0;i<l;i++){
        if(ans1[i]==1&&ans2[i]==1)ans[i]='R';
        if(ans1[i]==1&&ans2[i]==0)ans[i]='U';
        if(ans1[i]==0&&ans2[i]==1)ans[i]='D';
        if(ans1[i]==0&&ans2[i]==0)ans[i]='L';
    }
    for(i=0;i<l;i++)cout<<ans[i];
    cout<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
const ll N=2e6+10;
ll px[N],py[N],t[N],n,l;
vector<pi> d;
ll div0(ll x,ll y){
	if (y<0)x=-x,y=-y;
	return x/y+(x<0&&x%y);
}
ll div1(ll x,ll y){
	return div0(x+y-1,y);
}
ll pl,pr;
bool comp(pi a,pi b){
	return a.second%l<b.second%l;
}
pi solve(){
	ll al=-l,ar=l;
	d.push_back(d[0]);
	for (ll i=1;i<d.size();i++){
		ll t0=d[i].second%l-d[i-1].second%l;
		ll z0=d[i].second/l-d[i-1].second/l;
		if (t0<0)t0+=l,z0--;
		ll x1=d[i].first-d[i-1].first-t0,x2=x1+2*t0;
		if (!z0){
			if ((x1&1)||x1>0||x2<0)return make_pair(1e9,-1e9);
			continue;
		}
		if (z0&1){
			if ((x1&1)!=(l&1))
				return make_pair(1e9,-1e9);
		}
		else {
			if (x1&1)
				return make_pair(1e9,-1e9);
		}
		if (z0<0)swap(x1,x2);
		x1=div1(x1,z0),x2=div0(x2,z0);
		al=max(al,x1);
		ar=min(ar,x2);
	}
	return make_pair(al,ar);
}
ll ax[N],ay[N];
int main(){
	cin>>n>>l;
	for (ll i=1;i<=n;i++)
		scanf("%lld%lld%lld",&t[i],&px[i],&py[i]);
	for (ll i=0;i<=n;i++)d.push_back(make_pair(px[i]+py[i],t[i]));
	sort(d.begin(),d.end(),comp);
	pi p1=solve();
	if ((p1.first&1)==(l&1)&&p1.first==p1.second||p1.first<p1.second){
		ll k=p1.first+((p1.first&1)!=(l&1));
		for (ll i=0;i<d.size();i++)d[i].first-=k*(d[i].second/l),d[i].second%=l;
		d.pop_back();
		d.push_back(make_pair(k,l));
		for (ll i=1;i<d.size();i++){
			ll k=d[i].first-d[i-1].first,x=d[i].second-d[i-1].second;
			ll x1=x-k>>1,x2=x-x1;
			for (ll z=0;z<x1;z++)ax[z+d[i-1].second]=-1;
			for (ll z=x1;z<x;z++)ax[z+d[i-1].second]=1;
		}
		d.clear();
	}
	else {
		cout<<"NO"<<endl;
		return 0;
	}
	for (ll i=0;i<=n;i++)d.push_back(make_pair(px[i]-py[i],t[i]));
	sort(d.begin(),d.end(),comp);
	p1=solve();
	if ((p1.first&1)==(l&1)&&p1.first==p1.second||p1.first<p1.second){
		ll k=p1.first+((p1.first&1)!=(l&1));
		for (ll i=0;i<d.size();i++)d[i].first-=k*(d[i].second/l),d[i].second%=l;
		d.pop_back();
		d.push_back(make_pair(k,l));
		for (ll i=1;i<d.size();i++){
			ll k=d[i].first-d[i-1].first,x=d[i].second-d[i-1].second;
			ll x1=x-k>>1,x2=x-x1;
			for (ll z=0;z<x1;z++)ay[z+d[i-1].second]=-1;
			for (ll z=x1;z<x;z++)ay[z+d[i-1].second]=1;
		}
		d.clear();
	}
	else {
		cout<<"NO"<<endl;
		return 0;
	}
	for (ll i=0;i<l;i++){
		if (ax[i]==1&&ay[i]==1)putchar('R');
		if (ax[i]==1&&ay[i]==-1)putchar('U');
		if (ax[i]==-1&&ay[i]==1)putchar('D');
		if (ax[i]==-1&&ay[i]==-1)putchar('L');
	}
}

#include<bits/stdc++.h>
const int maxn = 200200;
const int mod = 998244353;
typedef long long ll;
inline ll pow(ll a,int b,ll ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1) ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
inline void reduce(int & x){ x += x >> 31 & mod; }
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
int n, l;
inline ll dv(ll x,ll y){ return x > 0 ? x / y : (x - y + 1) / y; }
inline void solve(std::map<ll, int>& map, int * a){
	struct T{ ll pos, d, cnt; };
	std::vector<T> vector;
	vector.push_back({l, -1, 0});
	vector.push_back({-1, 0, 0});
	for(auto i : map) {
		vector.push_back({i.first % l, i.first / l, i.second});
	}
	// di * l = cnti - s_posi
	// dj * l = cntj - s_posj
	// (di - dj) * l = cnti - cntj + s_posj - s_posi
	// posi - posj <= s_posj - s_posi <= posj - posi
	// cnt_i - cnt_j + posi - posj <= (di - dj) * l <= cnti - cntj + posj - posi
	std::sort(vector.begin(),vector.end(),[&](const T & x,const T & y) {
		return x.pos < y.pos;
	});
	ll min = 1e18, max = - 1e18;
	for(int i = 1;i < vector.size();++i) {
		const T & x = vector[i - 1],& y = vector[i];
		ll lhs = x.cnt - y.cnt + x.pos - y.pos;
		ll rhs = x.cnt - y.cnt - x.pos + y.pos;
		if(x.d == y.d) {
			if(lhs > 0 || rhs < 0) min = 1,max = 0;
		} else {
			int d = x.d - y.d;
			if(d < 0) std::swap(lhs = -lhs, rhs = - rhs), d = - d;
			min = std::min<ll> (min, dv(rhs, d));
			max = std::max<ll> (max, dv(lhs + d - 1, d));
		}
	}
	if(min < max) {
		std::cout << "NO" << '\n', exit(0);
	} else {
		ll s = min;
		const auto getval = [&](const T & i) { return i.cnt - i.d * s; };
		for(int i = 1;i < vector.size();++i) {
			const T & x = vector[i - 1], & y = vector[i];
			int cnt = getval(y) - getval(x);
			for(int i = x.pos + 1;cnt--;) a[i] = 1;
		}
	}
}
std::map<ll, int> map0;
std::map<ll, int> map1;
int ans0[maxn];
int ans1[maxn];
int main() {
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> l;
	for(int i = 1;i <= n;++i) {
		ll t, x, y;
		std::cin >> t >> x >> y;
		if(x + y + t & 1) {
			puts("NO");
			return 0;
		}
		map0[t - 1] = x + y + t >> 1;
		map1[t - 1] = x - y + t >> 1;
	}
	solve(map0, ans0);
	solve(map1, ans1);
	for(int i = 0;i < l;++i) std::cout << "LDUR"[ans0[i] << 1 | ans1[i]];
	std::cout << '\n';
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (int)ceil(l - eps));
	R = min(R, (int)floor(r + eps));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if((pos[ty][i] - ord[to].b) % (ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			vis[m - 1] = 1;
			ord[m - 1] = (Node){0, tem};
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
	}
}

int tt;
int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		if(i == 2) tt = y;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	if(tt == 146) cout << "asd" << endl;
	sol(0);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<bitset>
#include<deque>
#define Fail puts("NO"),exit(0);
#define eps 1e-15
#define maxn 2000010
#define maxm 200010
#define mod 1000000007
#define inf 1000000007
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,L;
struct P{
    ll t,x,y;
}p[maxn];
struct X{
    ll t,y,pre;
    int x;
}a[maxn];
int resx[maxn],resy[maxn];
bool cmp(X a,X b)
{
    return a.x<b.x;
}
int check(int sum)
{
    for(int i=1;i<=n;i++)  a[i].pre=a[i].y-a[i].t*sum;
    a[n+1].pre=sum;
    int book=0;
    for(int i=0;i<=n;i++)
    {
        if(a[i+1].x-a[i].x>=abs(a[i].pre-a[i+1].pre))  continue;
        int op1=(a[i].pre>a[i+1].pre),op2=(a[i].t>a[i+1].t);
        if(op1^op2)
        {
            if(book==-1)  Fail
            book=1;
        }
        else{
            if(book==1)   Fail
            book=-1;
        }
    }
    return book;
}
int ans[maxn];
void solve()
{
    sort(a+1,a+n+1,cmp);a[n+1].t=0;a[n+1].x=L;
    int book=-1;
    for(int i=0;i<n;i++)
    {
        int x1=((a[i].t+a[i+1].t)&1),x2=((a[i].x+a[i+1].x+a[i].y+a[i+1].y)&1);
        if(x1&&x2)   book=1;
        if(x1&&!x2)  book=0;
        if(x1)
        {
            if(x2!=-1&&x2!=book)  Fail
            else                  book=x2;
        }
        if(!x1&&x2)  Fail
    }
    if(book!=-1)
    {
        int op=((a[n].t&book+a[n].y)&1);
        if(((a[n].x+L)&1)!=((book+op)&1))  Fail;
    }
    int l=-L,r=L,pos=inf;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(book!=-1)  mid=mid*2+book;
        if(mid>L)
        {
            r=mid-1;
            continue;
        }
        if(mid<-L)
        {
            l=mid+1;
            continue;
        }
        int op=check(mid);
        if(!op)
        {
            pos=mid;
            break;
        }
        if(op==-1)  r=mid-1;
        else        l=mid+1;
    }
    if(pos==inf)  Fail
    check(pos);
    for(int i=0;i<=n;i++)
    {
        int c1=(a[i+1].x-a[i].x+a[i+1].pre-a[i].pre)/2;
        int c2=a[i+1].x-a[i].x-c1;
        for(int j=a[i].x+1;j<=a[i].x+c1;j++)  ans[j]=1;
        for(int j=a[i].x+c1+1;j<=a[i].x+c2;j++)  ans[j]=-1;
    }
}
int main()
{
    n=read();L=read();
    for(int i=1;i<=n;i++)  p[i].t=read(),p[i].x=read(),p[i].y=read();
    for(int i=1;i<=n;i++)  p[i].x=p[i].x+p[i].y,p[i].y=2*p[i].y-p[i].x;
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].x;
    solve();
    for(int i=1;i<=L;i++)  resx[i]=ans[i];
    for(int i=1;i<=n;i++)  a[i].t=(p[i].t-1)/L,a[i].x=(p[i].t-1)%L+1,a[i].y=p[i].y;
    solve();
    for(int i=1;i<=L;i++)  resy[i]=ans[i];
    for(int i=1;i<=L;i++)  resy[i]=(resx[i]+resy[i])/2,resx[i]-=resy[i];
    for(int i=1;i<=L;i++)
    {
        if(resx[i]==1)  printf("R");
        if(resx[i]==-1) printf("L");
        if(resy[i]==1)  printf("U");
        if(resy[i]==-1) printf("D");
    }
    puts("");
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long read();
void chmax(long long &x, long long y) { x < y ? x = y : x; }
void chmin(long long &x, long long y) { x > y ? x = y : x; }
struct I {
    long long lx, rx, ly, ry;

    void merge(I a) {
        chmax(lx, a.lx), chmin(rx, a.rx), chmax(ly, a.ly), chmin(ry, a.ry);
    }
    bool ok() {
        if (rx > lx || ry > ly) return 1;
        if (rx < lx || ry < ly) return 0;
        return ~(lx + ly) & 1;
    }
} R;

I M(I a, I b) { return a.merge(b), a; }

I solve(long long tx, long long ty, long long k, long long T) {
    long long x = tx + ty, y = tx - ty;
    if (k < 0) T = -T;
    return (I){ceil(1.0 * (x - T) / k), floor(1.0 * (x + T) / k),
               ceil(1.0 * (y - T) / k), floor(1.0 * (y + T) / k)};
}

long long n, l;
long long tttt;
struct P {
    long long k, x, y, tl;
    void init() { tl = (k = read()) % l, k /= l, x = read(), y = read(); }
} p[200005];
bool cmp(P a, P b) { return a.tl < b.tl; }

char res[2000006];
int len;

void work1(P a, P b) {
    long long t = a.tl - b.tl, x = a.x - b.x, y = a.y - b.y;
    while (t - 1 >= abs(x) + abs(y + 1)) res[++len] = 'D', --t, ++y;
    while (t - 1 >= abs(x + 1) + abs(y)) res[++len] = 'L', --t, ++x;
    while (t - 1 >= abs(x - 1) + abs(y)) res[++len] = 'R', --t, --x;
    while (t - 1 >= abs(x) + abs(y - 1)) res[++len] = 'U', --t, --y;
}

void work2(P a, P b) {
    long long x = b.x - a.x, y = b.y - a.y, k = b.k - a.k, t = a.tl - b.tl;
    while (M(R, solve(x, y - 1, k, t - 1)).ok())
        R.merge(solve(x, y - 1, k, t - 1)), --t, --y, res[++len] = 'D';
    while (M(R, solve(x - 1, y, k, t - 1)).ok())
        R.merge(solve(x - 1, y, k, t - 1)), --t, --x, res[++len] = 'L';
    while (M(R, solve(x + 1, y, k, t - 1)).ok())
        R.merge(solve(x + 1, y, k, t - 1)), --t, ++x, res[++len] = 'R';
    while (M(R, solve(x, y + 1, k, t - 1)).ok())
        R.merge(solve(x, y + 1, k, t - 1)), --t, ++y, res[++len] = 'U';
}

int main() {
    n = read(), l = read();
    for (int i = 1; i <= n; ++i) p[i].init();
    tttt = p[1].tl;
    sort(p + 1, p + 1 + n, cmp);
    p[0] = (P){0, 0, 0, 0}, p[++n] = (P){-1, 0, 0, l};
    R.lx = R.ly = -1e18, R.rx = R.ry = 1e18;
    for (int i = 1; i <= n; ++i) {
        if (p[i].k == p[i - 1].k) continue;
        R.merge(solve(p[i - 1].x - p[i].x, p[i - 1].y - p[i].y,
                      p[i - 1].k - p[i].k, p[i].tl - p[i - 1].tl));
    }
    if (!R.ok()) return puts("NO"), 0;
    // if (n == 200000 + 1 && l == 2000000 && tttt == 1117557)
    // cout << R.lx << ' ' << R.rx << ' ' << R.ly << ' ' << R.ry << endl;
    // cerr << "################################\n";
    for (int i = 0; i < n; ++i) {
        if (p[i].tl == p[i + 1].tl) continue;
        (p[i].k == p[i + 1].k) ? work1(p[i + 1], p[i]) : work2(p[i + 1], p[i]);
        if (n == 200000 + 1 && l == 2000000 && tttt == 1117557) {
            cout << p[i].k << ' ' << p[i + 1].k << ' ' << p[i].x << ' '
                 << p[i].y << ' ' << p[i + 1].x << ' ' << p[i + 1].y << ' '
                 << p[i].tl << ' ' << p[i + 1].tl << endl;
            if (p[i].tl > 1000) break;
        }
        if (len < p[i + 1].tl) return puts("NO"), 0;
    }

    for (int i = 1; i <= len; ++i) putchar(res[i]);
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
long long read() {
    long long x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

LL L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (LL)ceil(l));
	R = min(R, (LL)floor(r));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if(abs(pos[ty][i] - ord[to].b) % abs(ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			ord[m - 1] = (Node){0, tem};
			vis[m - 1] = 1;
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
	}
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#define PB push_back
#define db long double
#define ll long long
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;
}
void FAIL() { printf("NO"); exit(0); }
inline ll Abs(ll x) { return x>0?x:-x; }
const db eps=1e-40;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=4e6+10;
struct node { ll t,x,y; };
node v[N];
ll dx,dy;
int vis[N];
int n,m;
vector<char> S;
void sol(int l,int r,ll x,ll y,ll t) {
	x-=t*dx;
	y-=t*dy;
//	cout<<l<<' '<<r<<' '<<x<<' '<<y<<' '<<t<<endl;
	if(Abs(x)+Abs(y)>r-l) FAIL();
	char xx=x>0?'R':'L';
	char yy=y>0?'U':'D';
	x=Abs(x),y=Abs(y);
	while(x--) S.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if((r-l)&1) FAIL();
	while(r-l) S.PB('U'),S.PB('D'),r-=2;
}
db lbx,rbx,lby,rby;
void modify(int p,ll x,ll y,ll delt) {
//	cout<<p<<' '<<x<<' '<<y<<' '<<delt<<endl;

	if(Abs((delt*m+p)%2)^Abs((x+y)%2)) FAIL();
	if(delt==0) return;
	ll l,r; db dt=-delt;

	p=Abs(p);
	l=-p-x,r=p-x;
	if(dt>0) rbx=min(rbx,r/dt),lbx=max(lbx,l/dt);
	else rbx=min(rbx,l/dt),lbx=max(lbx,r/dt);

	l=-p-y,r=p-y;
	if(dt>0) rby=min(rby,r/dt),lby=max(lby,l/dt);
	else rby=min(rby,l/dt),lby=max(lby,r/dt);
//	cout<<"bound:"<<lbx<<' '<<lby<<' '<<rbx<<' '<<rby<<endl;
}
int curtest;
int main() {
	rd(n),rd(m);
	int flg=0;
	vis[0]=1;
	v[0].x=0,v[0].y=0,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;
			}
			ll 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(n==200000&&m==2000000&&v[1].t==0&&v[1].x==0&&vis[1]) curtest=1,cout<<"CUR"<<' '<<"flg="<<flg<<endl;

	lbx=-m,lby=-m,rbx=m,rby=m;

	int p1=0,p2;
	while(!vis[p1]&&p1<m) p1++;
	if(p1!=m) {
		while(true) {
			p2=p1+1;
			while(!vis[p2]&&p2<m) p2++;
			if(p2==m) {
				modify(-p1,-v[p1].x,-v[p1].y,-v[p1].t);
				break;
			}
			modify(p2-p1,v[p2].x-v[p1].x,v[p2].y-v[p1].y,v[p2].t-v[p1].t);

			p1=p2;
		}
	}
	if(curtest)	cout<<lbx<<' '<<lby<<' '<<rbx<<' '<<rby<<endl;

	if(dcmp(lbx-rbx)>0||dcmp(lby-rby)>0) FAIL();

	if(!flg) {
		dx=floor(rbx),dy=floor(rby);
		if((m%2)^Abs(dx%2)^Abs(dy%2)) {
			if(dx-lbx>dy-lby) dx--;
			else dy--;
		}
	}

	if(curtest) cout<<"dx="<<dx<<" dy="<<dy<<endl;

	if(dcmp(lbx-dx)>0||dcmp(dx-rbx)>0) FAIL();
	if(dcmp(lby-dy)>0||dcmp(dy-rby)>0) FAIL();

	p1=0;
	while(!vis[p1]&&p1<m) p1++;
//	if(p1==m) {
//		sol(0,m,dx,dy,1);
//		return 0;
//	}
	sol(0,p1,v[p1].x,v[p1].y,v[p1].t);
	while(true) {
		p2=p1+1;
		while(!vis[p2]&&p2<m) p2++;
		if(p2>=m) break;

		sol(p1,p2,v[p2].x-v[p1].x,v[p2].y-v[p1].y,v[p2].t-v[p1].t);

		p1=p2;
	}
	sol(p1,m,dx-v[p1].x,dy-v[p1].y,-v[p1].t);
	for(int i=0;i<S.size();++i) putchar(S[i]);
	return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

LL L, R;
void get_rge(LL x, LL y, LL z){
	if(!y) return;
	if(y > 0){
		L = max(L, (LL)ceil((LD)(x - z) / y));
		R = min(R, (x + z) / y);
	}
	else{
		L = max(L, (LL)ceil((LD)(x + z) / y));
		R = min(R, (x - z) / y);
	}
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if(abs(pos[ty][i] - ord[to].b) % abs(ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			ord[m - 1] = (Node){0, tem};
			vis[m - 1] = 1;
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	if(!vis[m - 1]){
		L = 0; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1){
			ord[i].b += tem * ord[i].a;
			ord[i].a = 0;
		}
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0; return;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
	}
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) {
		if(curtest) cout<<"FUCK:"<<delt*m+p<<' '<<x<<endl;
		FAIL();
	}
	if(delt==0) return;
	ll l=min(-p,p)-x,r=max(-p,p)-x; db 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)
		modify(pos[i+1]%m-pos[i],val[pos[i+1]]-val[pos[i]],ti[pos[i+1]]-ti[pos[i]]);

	if(curtest) printf("%.10Lf %.10Lf\n",lb,rb);

	ll 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;
		ll x=(r==m?dx:val[r])-val[l]-(ti[r]-ti[l])*dx;
		int d=x>0?1:-1;
		x=Abs(x);
		while(x--) ans.PB(d); len-=x;
		if(len<0||(len&1)) {

			if(curtest) printf("FUCK2: %d %d %d %lld %lld\n",l,r,len,(r==m?dx:val[r])-val[l]-(ti[r]-ti[l])*dx,x);
			FAIL();
		}
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('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;
			}
			ll 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(n==99&&m==101&&v[2].t==1&&v[2].x==4&&v[2].y==-5) curtest=1;

	if(curtest) cout<<"flg="<<flg<<endl;

	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.PB(i);
		pos.PB(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;
}

#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int64;

int N, L;
int64 T[200002], X[200002], Y[200002];
int64 aT[200002], aX[200002], aY[200002];
int pos[200002];
int W1[2000002], W2[2000002];

inline int gett(int x)
{
    if (x == 0) return 0;
    return (x % L == 0 ? L : x % L);
}
inline bool compare(const int& i1, const int& i2)
{
    return gett(T[i1]) > gett(T[i2]);
}
inline void constr(int64 i1, int64 i2, int64 need, int64 tm, int64& v1, int64& v2)
{
    // i1 <= need - tm * S <= i2
    //cout << i1 << " <= " << need << " - " << tm << " * S <= " << i2 << " | " << v2 << '\n';

    if (tm == 0 && !(i1 <= need && need <= i2))
    {
        cout << "NO\n";
        exit(0);
    }
    else if (tm == 0)
        return;

    if (tm < 0)
    {
        int64 lim1 = ((i1 - need) / (-tm) + (i1 - need) % (-tm) != 0);
        int64 lim2 = (i2 - need) / (-tm);

        v1 = max(v1, lim1);
        v2 = min(v2, lim2);
    }
    else
    {
        int64 lim1 = -((i2 - need) / tm);
        int64 lim2 = -((i1 - need) / tm) + ((i1 - need) % tm != 0);

        v1 = max(v1, lim1);
        v2 = min(v2, lim2);
    }
}

int main()
{
    cin.sync_with_stdio(false);

    cin >> N >> L;
    for (int i = 1; i <= N; ++i)
    {
        cin >> T[i] >> X[i] >> Y[i];
        aT[i] = T[i];
        aX[i] = X[i];
        aY[i] = Y[i];
        pos[i] = i;
    }
    sort(pos + 1, pos + N + 1, compare);

    for (int i = 1; i <= N; ++i)
    {
        T[i] = aT[pos[i]];
        X[i] = aX[pos[i]];
        Y[i] = aY[pos[i]];
    }

    // A = (X + Y + T) / 2 => [0 or 1]

    int64 v1 = 0, v2 = L;
    for (int i = 1; i <= N; ++i)
    {
        int64 need1 = (X[i] + Y[i] + T[i]) / 2;
        int64 need2 = (X[i + 1] + Y[i + 1] + T[i + 1]) / 2;

        int64 need = need1 - need2;
        int64 tm = ((T[i] - 1) / L) - ((T[i + 1] - 1) / L);

        int64 i1 = 0, i2 = gett(T[i]) - gett(T[i + 1]);

        // i1 <= need - tm * S <= i2
        constr(i1, i2, need, tm, v1, v2);

        // 0 <= need1 - tm * S <= S
        constr(0, (1LL << 60), need1, ((T[i] - 1) / L), v1, v2);
        constr(-(1LL << 60), 0, need1, ((T[i] - 1) / L) + 1, v1, v2);
    }

    if (v1 > v2)
    {
        cout << "NO\n";
        return 0;
    }

    int last = 0;
    for (int i = N; i >= 1; --i)
    {
        int64 need = (X[i] + Y[i] + T[i]) / 2;
        W1[gett(T[i])] = need - v1 * ((T[i] - 1) / L);

        int now = gett(T[i]), dif = W1[now] - W1[last];
        for (int j = last + 1; j <= now; ++j)
        {
            W1[j] = W1[j - 1] + (dif > 0);
            --dif;
        }

        last = now;
    }
    for (int i = last + 1; i <= L; ++i)
        W1[i] = W1[i - 1];

    // A = (X - Y + T) / 2 => [0 or 1]

    v1 = 0, v2 = L;
    for (int i = 1; i <= N; ++i)
    {
        int64 need1 = (X[i] - Y[i] + T[i]) / 2;
        int64 need2 = (X[i + 1] - Y[i + 1] + T[i + 1]) / 2;

        int64 need = need1 - need2;
        int64 tm = ((T[i] - 1) / L) - ((T[i + 1] - 1) / L);

        int64 i1 = 0, i2 = gett(T[i]) - gett(T[i + 1]);

        // i1 <= need - tm * S <= i2
        constr(i1, i2, need, tm, v1, v2);

        // 0 <= need1 - tm * S <= S
        constr(0, (1LL << 60), need1, ((T[i] - 1) / L), v1, v2);
        constr(-(1LL << 60), 0, need1, ((T[i] - 1) / L) + 1, v1, v2);
    }

    if (v1 > v2)
    {
        cout << "NO\n";
        return 0;
    }

    last = 0;
    for (int i = N; i >= 1; --i)
    {
        int64 need = (X[i] - Y[i] + T[i]) / 2;
        W2[gett(T[i])] = need - v1 * ((T[i] - 1) / L);

        int now = gett(T[i]), dif = W2[now] - W2[last];
        for (int j = last + 1; j <= now; ++j)
        {
            W2[j] = W2[j - 1] + (dif > 0);
            --dif;
        }

        last = now;
    }
    for (int i = last + 1; i <= L; ++i)
        W2[i] = W2[i - 1];

    for (int i = 1; i <= L; ++i)
    {
        int sum = (W1[i] == W1[i - 1] ? -1 : 1);
        int dif = (W2[i] == W2[i - 1] ? -1 : 1);

        int gox = (sum + dif) / 2;
        int goy = sum - gox;

        if (gox == 1)
            cout << 'R';
        else if (gox == -1)
            cout << 'L';
        else if (goy == 1)
            cout << 'U';
        else
            cout << 'D';
    }
    cout << '\n';
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

typedef long long s64;

const s64 INF = 4000000000000000000ll;

const int MaxN = 200001;
const int MaxL = 2000000;

// getint
inline s64 getint()
{
    char c;
    while (c = getchar(), ('0' > c || c > '9') && c != '-');

    if (c != '-')
    {
        s64 res = c - '0';
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return res;
    }
    else
    {
        s64 res = 0;
        while (c = getchar(), '0' <= c && c <= '9')
            res = res * 10 + c - '0';
        return -res;
    }
}

template <class T>
inline void tension(T &a, const T &b)
{
	if (b < a)
		a = b;
}

int n, l;
s64 pt[MaxN], px[MaxN], py[MaxN];

char res[MaxL + 1];
pair<int, int> b[MaxN];

inline s64 orzmod(s64 a, s64 b)
{
	return (a % b + b) % b;
}

inline s64 orzfloor(s64 a, s64 b)
{
	if (a < 0)
		return -((-a + b - 1) / b);
	return a / b;
}

inline bool check(s64 x, s64 y)
{
	int res_n = 0;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second, u = b[(i + 1) % n].second;
		if (abs((px[u] - (double)(pt[u] / l) * x) - (px[v] - (double)(pt[v] / l) * x)) > 1.5e18)
			return false;
		if (abs((py[u] - (double)(pt[u] / l) * y) - (py[v] - (double)(pt[v] / l) * y)) > 1.5e18)
			return false;
		s64 dx = (px[u] - (pt[u] / l) * x) - (px[v] - (pt[v] / l) * x);
		s64 dy = (py[u] - (pt[u] / l) * y) - (py[v] - (pt[v] / l) * y);
		s64 dt = (b[(i + 1) % n].first + l - b[i].first) % l;

		if (i + 1 == n)
			dx += x, dy += y;

		if (abs(dx) + abs(dy) > dt)
			return false;
		while (dx > 0)
			res[res_n++] = 'R', dx--;
		while (dx < 0)
			res[res_n++] = 'L', dx++;
		while (dy > 0)
			res[res_n++] = 'U', dy--;
		while (dy < 0)
			res[res_n++] = 'D', dy++;
	}
	return true;
}

inline bool handle()
{
	for (int i = 0; i < n; i++)
		if (orzmod(px[i] + py[i], 2) != pt[i] % 2)
			return false;

	for (int i = 0; i < n; i++)
		b[i] = make_pair(pt[i] % l, i);
	sort(b, b + n);

	for (int i = 0; i + 1 < n; i++)
		if (b[i].first == b[i + 1].first)
		{
			int v = b[i].second;
			int u = b[i + 1].second;
			return check((px[v] - px[u]) / ((pt[v] - pt[u]) / l), (py[v] - py[u]) / ((pt[v] - pt[u]) / l));
		}

	s64 sxy = INF, mxy = INF;
	for (int i = 0; i < n; i++)
	{
		int v = b[i].second;
		int u = b[(i + 1) % n].second;

		s64 dx = px[u] - px[v];
		s64 dy = py[u] - py[v];
		s64 dk = pt[u] / l - pt[v] / l;
		s64 dt = (b[(i + 1) % n].first + l - b[i].first) % l;

		if (i + 1 == n)
			dk++;

		if (dk < 0)
		{
			tension(sxy, orzfloor(dt - dx - dy, -dk));
			tension(mxy, orzfloor(dt - dx + dy, -dk));
		}
		else
		{
			tension(sxy, orzfloor(dt + dx + dy, dk));
			tension(mxy, orzfloor(dt + dx - dy, dk));
		}
	}

	return check((sxy + mxy) / 2, (sxy - mxy) / 2);
}

int main()
{
	cin >> n >> l;
	for (int i = 0; i < n; i++)
		pt[i] = getint(), px[i] = getint(), py[i] = getint();
	pt[n] = 0, pt[n] = 0, py[n] = 0;
	n++;

	if (handle())
		puts(res);
	else
		puts("NO");

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

ll ceildiv(ll a,ll b) {
  assert(b > 0);
  if (a < 0) return a / b;
  else return (a + b - 1) / b;
}
ll floordiv(ll a,ll b) {
  assert(b > 0);
  if (a > 0) return a / b;
  else return (a - b + 1) / b;
}

const int N = 200010, M = 2000010;
int cly;
int n, l;
char ans[M];
struct data {
  ll t,x,y;
  bool operator < (const data& a) const {
    if (t % l != a.t % l) return t%l < a.t%l;
    return t < a.t;
  }
} dat[N];
int sgn;
ll curl1, curl2, curr1, curr2, ansx, ansy;
void addlim(ll k,ll x,ll y,ll d) {
  if (k == 0) {
    if (abs((x + y) % 2) == d % 2 && abs(x) + abs(y) <= d);
    else {
      puts("NO");
      exit(0);
    }
  } else {
    int tmp = abs((x + y) % 2) - (d % 2);
    if (tmp < 0) tmp += 2;
    if (tmp == 1) {
      if (k % 2 == 0) {
	puts("NO");
	exit(0);
      }
      if (sgn == -1) sgn = 1;
      else if (sgn == 0) {
	puts("NO");
	exit(0);
      }
    } else if (tmp == 0) {
      if (k % 2 != 0) {
	if (sgn == -1) sgn = 0;
	else if (sgn == 1) {
	  puts("NO");
	  exit(0);
	}
      }
    }
    // k * v = s - d
    // sx + sy - d <= x + y
    // sx - sy - d <= x - y
    // x - y <= d + sx - sy
    // x + y <= d + sx + sy
    ll l1 = x + y - d;
    ll r1 = x + y + d;
    ll l2 = x - y - d;
    ll r2 = x - y + d;
    l1 = ceildiv(l1, k), ckmx(curl1, l1);
    l2 = ceildiv(l2, k), ckmx(curl2, l2);
    r1 = floordiv(r1, k), ckmn(curr1, r1);
    r2 = floordiv(r2, k), ckmn(curr2, r2);
  }
}
void getans(int sgn) {
  int key = 0;
  for (ll a = curl1; a <= curr1 && (!key); ++ a) if (abs(a) % 2 == sgn || sgn == -1)
    for (ll b = curl2; b <= curr2 && (!key); ++ b) {
      if ((a - b) % 2 == 0) {
	ansx = (a + b) / 2;
	ansy = (a - b) / 2;
	key = 1;
		if (cly){
			cout<<a<<" "<<b<<endl;
			exit(0);
		}
      }
    }
  if (!key) {
    puts("NO");
    exit(0);
  }
}
void build(int l,int r,ll x,ll y) {
  int cur = l;
  while (x > 0) {
    ans[cur ++] = 'R';
    -- x;
  }
  while (x < 0) {
    ans[cur ++] = 'L';
    ++ x;
  }
  while (y > 0) {
    ans[cur ++] = 'U';
    -- y;
  }
  while (y < 0) {
    ans[cur ++] = 'D';
    ++ y;
  }
  assert(cur <= r+1);
  while (cur <= r) {
    ans[cur ++] = 'L';
    ans[cur ++] = 'R';
  }
}
int main() {
  ll x,y,z;
  read(n), read(l);
	if (n==1000&&l==2000000)
		cly=1;
  rep (i, 1, n) {
    read(x), read(y), read(z);
    dat[i] = (data) {x, y, z};
  }
  sort(dat + 1, dat + n + 1);
  sgn = l % 2;
  curl1 = curl2 = - l;
  curr1 = curr2 = l;
  rep (i, 1, n) {
    //  + k * v = s
    ll d = (dat[i].t%l) - (dat[i-1].t%l);
    ll k = (dat[i].t / l) - (dat[i-1].t / l);
    x = dat[i].x - dat[i-1].x;
    y = dat[i].y - dat[i-1].y;
    if (k < 0) {
      k = -k;
      x = -x;
      y = -y;
    }
    addlim(k, x, y, d);
  }
  {
    ll k = dat[n].t / l + 1;
    ll d = l - (dat[n].t % l);
    addlim(k, dat[n].x, dat[n].y, d);
    // s = (k + 1) * v + d
  }
  addlim(1, 0, 0, l);
//	if (cly){
//		printf("[%lld,%lld] [%lld,%lld]\n",curl1,curr1,curl2,curr2);
//		return 0;
//	}
  getans(sgn);
  rep (i, 1, n) {
    // ll d = (dat[i].t%l) - (dat[i-1].t)%l;
    ll k = (dat[i].t / l) - (dat[i-1].t / l);
    x = dat[i].x - dat[i-1].x;
    y = dat[i].y - dat[i-1].y;
    // d = s - k * v
    x -= k * ansx;
    y -= k * ansy;
    build(dat[i-1].t%l + 1, dat[i].t % l, x, y);
  }
  {
    ll k = dat[n].t / l;
    build(dat[n].t%l + 1, l, (k+1) * ansx - dat[n].x, (k+1) * ansy - dat[n].y);
  }
  rep (i, 1, l)
    putchar(ans[i]);
  puts("");
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

bool check(long long t, long long x, long long y) {
	return ((x + y) % 2 + 2) % 2 == t % 2;
}

template<typename T>
class p {
public:
	T x, y;

	p(T a, T b): x(a), y(b) {
	}

	p operator* (T ska) {
		return p(ska * x, ska * y);
	}
	p operator/ (T ska) {
		return p(x/ska, y/ska);
	}
	p operator+ (p other) {
		return p(x + other.x, y + other.y);
	}

	pair<T, T> to_pair() const {
		return make_pair(x, y);
	}

	bool operator< (const p& other) const {
		return to_pair() < other.to_pair();
	}

	p flip45() {
		return p(x + y, x - y);
	}

	p unflip45() {
		return p(x + y, x - y) / 2;
	}

	T abs() {
		return std::abs(x) + std::abs(y);
	}
};

template<typename T>
class fraction {
public:
	T x, y;

	fraction(T a, T b): x(a), y(b) {
	}

	fraction(T a): fraction(a, 1) {
	}

	fraction normal() {
		T g = __gcd(x, y);
		if (g == 0) g = 1;
		return fraction(x/g, y/g);
	}

	fraction operator*(fraction other) {
		return fraction(x * other.x, y * other.y).normal();
	}

	fraction inverse() {
		return fraction(y, x);
	}

	fraction operator/(fraction other) {
		return (*this) * other.inverse();
	}

	long long to_int() {
		if (x == 0) return 0;
		return x / y;
	}

	bool operator < (const fraction& other) const {
		return x * other.y < y * other.x;
	}

	bool operator >= (const fraction& other) const {
		return not ((*this) < other);
	}

	bool operator <= (const fraction& other) const {
		return x * other.y <= y * other.x;
	}

	bool operator > (const fraction& other) const {
		return not ((*this) <= other);
	}

	bool operator <= (T other) const {
		return x <= other * y;
	}

	bool operator >= (T other) const {
		return x >= other * y;
	}

	fraction operator+ (fraction other) {
		T g = __gcd(y, other.y);
		if (g == 0) g = 1;
		return fraction(x * (other.y / g) + other.x * (y / g), y * (other.y / g));
	}

	fraction operator- () {
		return fraction(-x, y);
	}

	fraction operator- (fraction other) {
		return (*this) + (-other);
	}
};

using pun = p<long long>;

vector<pair<pair<long long, long long>, pun> > data;

pun szukaj(int l) {
	sort(data.begin(), data.end());
	if (data[0].first.first == 0) {
		return data[0].second / data[0].first.second;
	}
	long long x1 = -l;
	long long x2 = l;
	long long y1 = -l;
	long long y2 = l;
	for (int i = 1; i < data.size(); i ++) {
		int k = data[i].first.first - data[i-1].first.first;
		int t = data[i].first.second;
		pun dx = data[i].second + (data[i-1].second * (-1));
		x1 = max(x1, (dx.x - k + t - 1) / t);
		x2 = min(x2, (dx.x + k) / t);

		y1 = max(y1, (dx.y - k + t - 1) / t);
		y2 = min(y2, (dx.y + k) / t);
	}
	if (l == 200000)
		printf("%d %d %d %d\n", x1, x2, y1, y2);
	return pun(x1, y1);
}

string solve(bool failed, int l, pun x) {
	long long last = 0;
	pun lastx = pun(0, 0);
	string wynik = "";
	data.push_back(make_pair(make_pair(l, 0), x));
	for (auto d: data) {
		pun dx = d.second + (x * (-d.first.second)) + (lastx * (-1));
		long long k = d.first.first - last;

		if (abs(dx.x) > k || abs(dx.y) > k) failed = true;
		for (int i = 0; i < k; i ++) {
			if (dx.x > 0 && dx.y > 0) {
				wynik += 'R';
				dx.x --;
				dx.y --;
			} else if (dx.x > 0) {
				wynik += 'U';
				dx.x --;
				dx.y ++;
			} else if (dx.y > 0) {
				wynik += 'D';
				dx.x ++;
				dx.y --;
			} else {
				wynik += 'L';
				dx.x ++;
				dx.y ++;
			}
		}

		last = d.first.first;
		lastx = d.second + (x * -d.first.second);
	}
	if (failed) return "NO";
	return wynik;
}

int main() {
	int n, l;
	scanf("%d%d", &n, &l);
	bool failed = false;
	for (int i = 0; i < n; i ++) {
		long long t, x, y;
		scanf("%lld%lld%lld", &t, &x, &y);
		if (not check(t, x, y)) failed = true;
		data.push_back(make_pair(make_pair(t % l, t / l), pun(x + y, x - y)));
	}
	pun x = szukaj(l);
	string res = solve(failed, l, x);
	printf("%s\n", res.c_str());
}

#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=2000006;
const LL INF=4.5e18;
void NO(){
	puts("NO");
	exit(0);
}
void ckmin(LL &a,LL b){
	if (a>b)
		a=b;
}
void ckmax(LL &a,LL b){
	if (a<b)
		a=b;
}
int n,L;
struct Node{
	LL t,x,y,p;
}a[N];
bool cmp(Node a,Node b){
	return a.p<b.p;
}
LL U(LL a,LL b){
	return a>=0?(a+b-1)/b:a/b;
}
LL D(LL a,LL b){
	return a>=0?a/b:(a-b+1)/b;
}
char res[N];
int main(){
	n=read(),L=read();
	For(i,1,n){
		a[i].t=read(),a[i].x=read(),a[i].y=read();
		a[i].p=a[i].t%L;
		if ((a[i].x+a[i].y+a[i].t)%2!=0)
			NO();
	}
	++n,a[n].t=a[n].x=a[n].y=a[n].p=0;
	++n,a[n]=a[n-1],a[n].p=L;
	sort(a+1,a+n+1,cmp);
	LL minp=-L,maxp=L,minm=-L,maxm=L;
	For(i,1,n-1){
		LL dx=a[i+1].x-a[i].x,dy=a[i+1].y-a[i].y;
		LL k=((a[i+1].t-a[i+1].p)-(a[i].t-a[i].p))/L;
		LL t=a[i+1].p-a[i].p;
		if (k<0)
			k=-k,dx=-dx,dy=-dy;
		if (k!=0){
			ckmax(minp,U(dx+dy-t,k));
			ckmin(maxp,D(dx+dy+t,k));
			ckmax(minm,U(dx-dy-t,k));
			ckmin(maxm,D(dx-dy+t,k));
		}
		else {
			if (t<abs(dx)+abs(dy)){
				if (n==1002&&L==2000000)
					puts("1");
				NO();
			}
		}
	}
	LL dx,dy;
	int flag=0;
	for (LL i=minp;!flag&&i<=min(minp+3,maxp);i++)
		for (LL j=minm;!flag&&j<=min(minm+3,maxm);j++){
			LL x=minp+minm,y=minp-minm;
			if (x%2==0&&y%2==0){
				x/=2,y/=2;
				if ((x+y+L)%2==0)
					flag=1,dx=x,dy=y;
			}
		}
	if (!flag){
				if (n==1002&&L==2000000)
					puts("1");
				NO();
		NO();
	}
	For(i,1,n){
		LL k=(a[i].t-a[i].p)/L;
		a[i].x-=k*dx,a[i].y-=k*dy;
	}
	For(i,1,n-1){
		int t0=a[i].p,t1=a[i+1].p;
		LL x=a[i+1].x-a[i].x,y=a[i+1].y-a[i].y;
		assert(t1-t0>=abs(x)+abs(y));
		while (x>0)
			res[t0++]='R',x--;
		while (x<0)
			res[t0++]='L',x++;
		while (y>0)
			res[t0++]='U',y--;
		while (y<0)
			res[t0++]='D',y++;
		while (t0<t1)
			res[t0++]='L',res[t0++]='R';
		assert(t0==t1);
	}
	puts(res);
	return 0;
}

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=200000+100,M=2000000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

struct node{ll x,y,t,k,w;}p[N];
bool cmp(node p,node q) {return p.w<q.w;}
int n,m,dx[M],dy[M];

bool solve(int *op)
{
    ll L=0,R=m;
    rep(i,2,n)
    {
        ll dx=p[i].x-p[i-1].x,dk=p[i].k-p[i-1].k,dw=p[i].w-p[i-1].w;
        if (dk==0)
        {
            if ((dx-dw>0) || (dx<0)) return 0;
        }
        else if (dk>0)
        {
            L=max(L,(ll)ceil((double)(dx-dw)/dk));
            R=min(R,(ll)floor((double)dx/dk));
        }
        else
        {
            L=max(L,(ll)ceil((double)dx/dk));
            R=min(R,(ll)floor((double)(dx-dw)/dk));
        }
        if (L>R) return 0;
    }
    //cout << "sum=" << L << " " << R << endl;
    int s=L;
    rep(i,2,n)
    {
        ll dx=(p[i].x-p[i].k*s)-(p[i-1].x-p[i-1].k*s),cnt=p[i].w-p[i-1].w;
        if ((dx<0) || (dx>cnt)) return 0;
        //cout << "fill "<< p[i-1].w+1 << " " << p[i-1].w+cnt << endl;
        //cout << dx << endl;
        rep(j,1,cnt)
            if (j<=dx) op[j+p[i-1].w]=1;else op[j+p[i-1].w]=0;
    }
    return 1;
}

int main()
{
    n=read();m=read();
    rep(i,1,n)
    {
        p[i].t=readll();ll x=readll(),y=readll();
        if ((x+y+p[i].t)&1) {puts("NO");return 0;}
        if ((x-y+p[i].t)&1) {puts("NO");return 0;}
        p[i].k=p[i].t/m;p[i].w=p[i].t%m;
        p[i].x=(y+x+p[i].t)>>1;p[i].y=(y-x+p[i].t)>>1;
    }
    p[++n]=(node){0,0,0,0,0};
    p[++n]=(node){0,0,0,-1,m};
    sort(p+1,p+1+n,cmp);
    int ok=solve(dx);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,n) swap(p[i].x,p[i].y);
    solve(dy);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,m)
    {
        if ((dx[i]==1) && (dy[i]==1)) putchar('U');
        else if ((dx[i]==0) && (dy[i]==0)) putchar('D');
        else if ((dx[i]==0) && (dy[i]==1)) putchar('L');
        else if ((dx[i]==1) && (dy[i]==0)) putchar('R');
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
char S[6] = {'D', 'L', 'R', 'U'};
int nex[6] = {0, 0, 1, 1};
int ney[6] = {0, 1, 0, 1};
int cnt[6];
#define LL long long
int n;
LL loop, lx = -1e18, rx = 1e18, ly = -1e18, ry = 1e18;
string ans, tmp;
struct Pos{
	LL x, y, t, k, w;
}a[N], now[N];
bool cmp(Pos X, Pos Y){
	return X.w < Y.w;
}
void fail(){
	puts("NO");
	exit(0);
}
void update(LL &l, LL &r, LL k, LL w, LL x1, LL x2){
	LL L = -w - x1 + x2, R = -x1 + x2;
//	printf("L=%lld R=%lld k=%lld\n", L, R, k);
	if(!k) {if(L > 0 || R < 0)fail();}
	else{
		if(k > 0){
//			printf("case1: L=%lld R=%lld\n", (LL)ceil(1.0 * L / k), (LL)floor(1.0 * R / k));
			l = max(l, (LL)ceil(1.0 * L / k));
			r = min(r, (LL)floor(1.0 * R / k));
		}
		else{
//			printf("case2: L=%lld R=%lld\n", (LL)ceil(1.0 * R / k), (LL)floor(1.0 * L / k));
			l = max(l, (LL)ceil(1.0 * R / k));
			r = min(r, (LL)floor(1.0 * L / k));
		}
	}
}
void work(LL rx, LL ry){
	for(int i = 1;i <= n; i++){
		a[i].x = a[i].x % rx;
		a[i].y = a[i].y % ry;
//		printf("i=%d x=%lld y=%lld k=%lld w=%lld\n", i, a[i].x, a[i].y, a[i].k, a[i].w);
	}
//	printf("rx=%lld ry=%lld\n", rx, ry);
	a[n+1].x = rx; a[n+1].y = ry;
	tmp.clear();
	for(int i = 0;i <= n; i++){
		LL t = a[i+1].w - a[i].w;
		LL nx = a[i].x, ny = a[i].y;
		LL x = a[i+1].x, y = a[i+1].y;
//		printf("i=%d nx=%lld ny=%lld x=%lld y=%lld wi+1=%lld wi=%lld\n", i, nx, ny, x, y, a[i+1].w, a[i].w);
		memset(cnt, 0, sizeof(cnt));
		while(t--){
			if(nx < x){
				if(ny < y)cnt[3]++, nx++, ny++;
				else cnt[2]++, nx++;
			}
			else{
				if(ny < y)cnt[1]++, ny++;
				else cnt[0]++;
			}
		}
		for(int j = 0;j <= 3; j++)
			for(int k = 1;k <= cnt[j]; k++)tmp += S[j];
	}
	if(ans.empty() || ans > tmp)ans = tmp;
}
int main(){
//	freopen("robot.in", "r", stdin);
//	freopen("robot.out", "w", stdout);
	cin>>n>>loop;
	LL x, y, t;
	for(int i = 1;i <= n; i++){
		scanf("%lld%lld%lld", &t, &x, &y);
		if((x ^ y ^ t) & 1)fail();
		a[i].t = t;
		a[i].x = (x + y + t) >> 1;
		a[i].y = (y - x + t) >> 1;
		a[i].k = t / loop;
		a[i].w = t % loop;
//		printf("i=%d x=%lld y=%lld\n", i, a[i].x, a[i].y);
	}
	sort(a + 1, a + 1 + n, cmp);
	a[n+1].k = -1; a[n+1].w = loop;
	for(int i = 0; i <= n; i++){
		LL k = a[i+1].k - a[i].k;
		LL w = a[i+1].w - a[i].w;
		update(lx, rx, k, w, a[i].x, a[i+1].x);
		update(ly, ry, k, w, a[i].y, a[i+1].y);
//		printf("i=%d k=%lld w=%lld lx=%lld rx=%lld ly=%lld ry=%lld\n", i, k, w, lx, rx, ly, ry);

	}
//	puts("xbx");
	if(lx > rx || ly > ry)fail();
	memcpy(now, a, sizeof(now));
	work(lx, ly);
	memcpy(a, now, sizeof(now));
	work(rx, ry);
//	printf("lx=%lld rx=%lld ly=%lld ry=%lld\n", lx, rx, ly, ry);
	cout<<ans<<endl;
	return 0;
}
/*3 5 1 1 0 2 1 -1 3 0 -1*/

#include<iostream>
#include<cstdio>
#include<tuple>
#include<algorithm>
#include<limits>

int n,L;

inline void bye(){puts("NO"),exit(0);}

std::tuple<int,long long,long long> X0[200050],Y0[200050];
std::pair<int,long long> XX[200050],YY[200050];
int Cx[2000050],Cy[2000050];

char ans[2000050];

int main(){
	scanf("%d%d",&n,&L);
	for (int i=1;i<=n;i++){
		long long t,x,y;
		scanf("%lld%lld%lld",&t,&x,&y);
		if ((x+y+t)&1) bye();
		X0[i]=std::make_tuple(t%L,(x+y+t)/2,t/L);
		Y0[i]=std::make_tuple(t%L,(x-y+t)/2,t/L);
	}
	X0[0]=std::make_tuple(0,0,0);
	Y0[0]=std::make_tuple(0,0,0);

	{
		std::sort(X0,X0+n+1);
		X0[n+1]=std::make_tuple(L,0,-1);
		long long LL=0,RR=L;
		for (int i=1;i<=n+1;i++){
			long long Lv=std::get<0>(X0[i-1])-std::get<0>(X0[i])-std::get<1>(X0[i-1])+std::get<1>(X0[i]);
			long long coef=std::get<2>(X0[i])-std::get<2>(X0[i-1]);
			long long Rv=-std::get<0>(X0[i-1])+std::get<0>(X0[i])-std::get<1>(X0[i-1])+std::get<1>(X0[i]);
			if (coef==0){
				if (Lv>0||Rv<0) bye();
			}
			else if (coef>0){
				LL=std::max(LL,Lv>0?((Lv-1)/coef+1):0);
				RR=std::min(RR,Rv>=0?Rv/coef:-1);
			}
			else{
				LL=std::max(LL,-Rv>0?(-Rv-1)/(-coef)+1:0);
				RR=std::min(RR,-Lv>=0?(-Lv)/(-coef):-1);
			}
			if (LL>RR) bye();
		}
		int S0=LL;
		for (int i=1;i<=n+1;i++) XX[i]=std::make_pair(std::get<0>(X0[i]),std::get<1>(X0[i])-std::get<2>(X0[i])*S0);
		for (int i=1;i<=n+1;i++){
			for (int j=XX[i-1].first+1;j<=XX[i-1].first+XX[i].second-XX[i-1].second;j++) Cx[j]=1;
			for (int j=XX[i-1].first+1+XX[i].second-XX[i-1].second;j<=XX[i].first;j++) Cx[j]=0;
		}
	}

	{
		std::sort(Y0,Y0+n+1);
		Y0[n+1]=std::make_tuple(L,0,-1);
		long long LL=0,RR=L;
		for (int i=1;i<=n;i++){
			long long Lv=std::get<0>(Y0[i-1])-std::get<0>(Y0[i])-std::get<1>(Y0[i-1])+std::get<1>(Y0[i]);
			long long coef=std::get<2>(Y0[i])-std::get<2>(Y0[i-1]);
			long long Rv=-std::get<0>(Y0[i-1])+std::get<0>(Y0[i])-std::get<1>(Y0[i-1])+std::get<1>(Y0[i]);
			if (coef==0){
				if (Lv>0||Rv<0) bye();
			}
			else if (coef>0){
				LL=std::max(LL,Lv>0?((Lv-1)/coef+1):0);
				RR=std::min(RR,Rv>=0?Rv/coef:-1);
			}
			else{
				LL=std::max(LL,-Rv>0?(-Rv-1)/(-coef)+1:0);
				RR=std::min(RR,-Lv>=0?(-Lv)/(-coef):-1);
			}
			if (LL>RR) bye();
		}
		int S0=LL;
		for (int i=1;i<=n+1;i++) YY[i]=std::make_pair(std::get<0>(Y0[i]),std::get<1>(Y0[i])-std::get<2>(Y0[i])*S0);
		for (int i=1;i<=n+1;i++){
			for (int j=YY[i-1].first+1;j<=YY[i-1].first+YY[i].second-YY[i-1].second;j++) Cy[j]=1;
			for (int j=YY[i-1].first+1+YY[i].second-YY[i-1].second;j<=YY[i].first;j++) Cy[j]=0;
		}
	}

	for (int i=1;i<=L;i++) ans[i]="LDUR"[Cx[i]<<1|Cy[i]];
	puts(ans+1);
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define reg register
#define maxn 2000005
inline ll read()
{
	reg ll x=0,w=0;reg char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
inline void Min(ll& x,ll y){x=x>y?y:x;}
inline void Max(ll& x,ll y){x=x>y?x:y;}
inline void fail(){puts("NO");exit(0);}
struct op
{
	ll x,y,a,b;
}a[maxn];
inline bool com(op x,op y){return x.b<y.b;}
int ans[2][maxn];
int n,m;
char s[4]={'D','L','R','U'};
inline int check()
{
	for(reg int i=1;i<=m;++i)
	{
		if(ans[0][i]<ans[1][i])return 0;
		if(ans[0][i]>ans[1][i])return 1;
	}
	return 0;
}
inline void co(int o)
{
	for(reg int i=1;i<=m;++i)
		putchar(s[ans[o][i]]);
	putchar('\n');
}
int main()
{
//	freopen("robot.in","r",stdin);
//	freopen("robot.out","w",stdout);
	n=read(),m=read();
	reg ll x,y,t,tmp;reg int i,j;
	for(i=1;i<=n;++i)
	{
		t=read(),x=read(),y=read();
		tmp=x;x=x+y+t;y=y-tmp+t;
//		if(x<0||y<0)fail();
		if((x&1)||(y&1))fail();
		a[i]=(op){x>>1,y>>1,t/m,t%m};
	}
	sort(a+1,a+1+n,com);
	a[0]=(op){0,0,0,0};a[++n]=(op){0,0,-1,m};
	reg ll lx=0,rx=4e18,ly=0,ry=4e18;
	reg ll da,db,dx,dy;
	for(i=1;i<=n;++i)
	{
		da=a[i].a-a[i-1].a;
		db=a[i].b-a[i-1].b;
		dx=a[i].x-a[i-1].x;
		dy=a[i].y-a[i-1].y;
		if(!da)
		{
			if(dx-db>0||dx<0)fail();
			if(dy-db>0||dy<0)fail();
			continue;
		}
		if(da<0)dx=-dx,dy=-dy,db=-db;
		if(da>0)
		{
			Max(lx,(ll)ceil(1.0L*(dx-db)/da));
			Min(rx,(ll)floor(1.0L*dx/da));
			Max(ly,(ll)ceil(1.0L*(dy-db)/da));
			Min(ry,(ll)floor(1.0L*dy/da));
		}
		else
		{
			da=-da;
			Max(lx,(ll)ceil(1.0L*dx/da));
			Min(rx,(ll)floor(1.0L*(dx-db)/da));
			Max(ly,(ll)ceil(1.0L*dy/da));
			Min(ry,(ll)floor(1.0L*(dy-db)/da));
		}
	}
	if(lx>rx||ly>ry)fail();
	for(i=1;i<=n;++i)
	{
		dx=a[i].x-a[i].a*lx-a[i-1].x+a[i-1].a*lx;
		dy=a[i].y-a[i].a*ly-a[i-1].y+a[i-1].a*ly;
		for(j=a[i].b-dx+1;j<=a[i].b;++j)ans[0][j]|=1;
		for(j=a[i].b-dy+1;j<=a[i].b;++j)ans[0][j]|=2;
	}
	for(i=1;i<=n;++i)
	{
		dx=a[i].x-a[i].a*rx-a[i-1].x+a[i-1].a*rx;
		dy=a[i].y-a[i].a*ry-a[i-1].y+a[i-1].a*ry;
		for(j=a[i].b-dx+1;j<=a[i].b;++j)ans[1][j]|=1;
		for(j=a[i].b-dy+1;j<=a[i].b;++j)ans[1][j]|=2;
	}
	co(check());return 0;
}

//#define DEBUG
//#define USEPB_DS
#define USETR1
#define CPPELEVEN
#define GPP

/*
 * temp.cpp
 *
 *  Created on: 2012-7-18
 *      Author: BSBandme
 */
//#pragma comment(linker, "/STACK:1024000000,1024000000")

#include <iostream>
#include <fstream>
#include <string.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
#include <list>
#include <iomanip>
#include <math.h>
#include <deque>
#include <utility>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <climits>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <sstream>

using namespace std;

#ifndef CPPELEVEN
#ifdef USETR1
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;
#endif
#else
#include <unordered_map>
#include <unordered_set>
#endif

#ifdef USEPB_DS
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// binomial_heap_tag, rc_binomial_heap_tag, thin_heap_tag, binary_heap_tag
typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq_type;
// splay_tree_tag, ov_tree_tag
typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> tree_type;
#endif

#define mpr make_pair
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <double, double> pdd;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <double> vd;
typedef vector <string> vs;
typedef map <string, int> mpsi;
typedef map <double, int> mpdi;
typedef map <int, int> mpii;

const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}};

template <class T> inline T abs1(T a) {return a < 0 ? -a : a;}

#ifndef CPPELEVEN
template <class T> inline T max1(T a, T b) { return b < a ? a : b; }
template <class T> inline T max1(T a, T b, T c) { return max1(max1(a, b), c); }
template <class T> inline T max1(T a, T b, T c, T d) { return max1(max1(a, b, c), d); }
template <class T> inline T max1(T a, T b, T c, T d, T e) { return max1(max1(a, b, c, d), e); }
template <class T> inline T min1(T a, T b) { return a < b ? a : b; }
template <class T> inline T min1(T a, T b, T c) { return min1(min1(a, b), c); }
template <class T> inline T min1(T a, T b, T c, T d) { return min1(min1(a, b, c), d); }
template <class T> inline T min1(T a, T b, T c, T d, T e) { return min1(min1(a, b, c, d), e); }
#else
template <typename t, typename t1>
t min1(t a, t1 b) { return a < b ? a : b; }
template <typename t, typename... arg>
t min1(t a, arg... arr) { return min1(a, min1(arr...)); }
template <typename t, typename t1>
t max1(t a, t1 b) { return a > b ? a : b; }
template <typename t, typename... arg>
t max1(t a, arg... arr) { return max1(a, max1(arr...)); }
#endif

inline int jud(double a, double b){
	if(abs(a) < eps && abs(b) < eps) return 0;
	else if(abs1(a - b) / abs1(a) < eps) return 0;
	if(a < b) return -1;
	return 1;
}
template <typename t> inline int jud(t a, t b){
	if(a < b) return -1;
	if(a == b) return 0;
	return 1;
}

// f_lb == 1代表返回相同的一串的左边界，f_small == 1代表返回如果没有寻找的值返回小的数
template <typename it, typename t1>
inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1){
	int be = 0, en = na - 1;
	if(na == 0) return 0;
	if(*a <= *(a + na - 1)){
		if(f_lb == 0) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != 1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != -1) en = mid;
			else be = mid + 1;
		}
		if(f_small && jud(*(a + be), val) == 1) be--;
		if(!f_small && jud(*(a + be), val) == -1) be++;
	} else {
		if(f_lb) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != -1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != 1) en = mid;
			else be = mid + 1;
		}
		if(!f_small && jud(*(a + be), val) == -1) be--;
		if(f_small && jud(*(a + be), val) == 1) be++;
	}
	return be;
}

template <class T> inline T lowb(T num) {return num & (-num); }
#ifdef GPP
inline int bitnum(ui nValue) { return __builtin_popcount(nValue); }
inline int bitnum(int nValue) { return __builtin_popcount(nValue); }
inline int bitnum(ull nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitnum(ll nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitmaxl(ui a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(int a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(ull a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
inline int bitmaxl(ll a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
#else
#endif

long long pow(long long n, long long m, long long mod = 0){
	if(m < 0) return 0;
	long long ans = 1;
	long long k = n;
	while(m){
		if(m & 1) {
			ans *= k;
			if(mod) ans %= mod;
		}
		k *= k;
		if(mod) k %= mod;
		m >>= 1;
	}
	return ans;
}

#define  MOD 1000000007
template <class t1, class t2>
inline void add(t1 &a, t2 b, int mod = -1) {
	if(mod == -1) mod = MOD;
	a += b;
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
}
template <class t>
void output1(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		cerr << arr[i] << ' ';
	cerr << endl;
}
template <class t>
void output2(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		output1(arr[i]);
}

//....................密..........封..........线..........下..........禁..........止..........hack...............................................

const int maxn = 200100;
pll arr[maxn];
int l, n;
ll orig[maxn][3];
map <ll, pair <pll, ll> > mp;
pair <ll, pll> tarr[maxn];
char ans[maxn * 10];

bool cmp(const pii &a, const pii &b) {
	return a.second % l < b.second % l;
}

inline int check(pll a, pll b, ll rl, int cate = 0) {
	ll h1 = a.second / l, h2 = b.second / l;
	if(h1 == h2) return 0;
	if(h1 > h2)
		swap(a, b), swap(h1, h2);
	ll dt = abs(b.second % l - a.second % l);
	if(cate) {
		if(b.second == l)
			dt = abs(l - a.second % l);
		else
			dt = abs(b.second % l - l);
	}
	if(a.first - rl * h1 > b.first - rl * h2) {
		if(a.first - rl * h1 > b.first - rl * h2 + dt)
			return 2;
		return 0;
	} else {
		if(a.first - rl * h1 < b.first - rl * h2 - dt)
			return 1;
		return 0;
	}
}

int check(int rl) {
	int flag = 0;
	for(int i = 0; i <= n; i++)
		flag |= check(arr[i], arr[i + 1], rl);
	flag |= check(mpr(rl * 2, l), arr[n], rl, 1);
	return flag;
}

int getl() {
	int be = -l, en = l;
	while(be < en) {
		int mid = (be + en) / 2;
		int rp = check(mid);
		if(rp == 3) return -1;
		if(rp == 0) return mid;
		if(rp == 1) be = mid + 1;
		else en = mid - 1;
	}
	if(check(be)) return -1;
	return be;
}

int main() {

//............................不要再忘了检查maxn大小了！！！！BSBandme你个SB！！！！...................................................

	ios_base::sync_with_stdio(0);
	#ifdef DEBUG //......................................................................................................
	freopen("input.txt", "r", stdin);
	int __size__ = 256 << 20; // 256MB
	char *__p__ = (char*)malloc(__size__) + __size__;
	__asm__("movl %0, %%esp\n" :: "r"(__p__));
	#endif //...........................................................................................................

	scanf("%d%d", &n, &l);
	int dx = -MOD, dy = -MOD;
	bool flag = 1;
	mp[0] = mpr(mpr(0, 0), 0);
	for(int i = 0; i < n; i++) {
		scanf("%I64d%I64d%I64d", orig[i] + 2, orig[i], orig[i] + 1);
		if((orig[i][0] + orig[i][1] - (orig[i][2] & 1)) % 2)
			flag = 0;
		auto p = mp.find(orig[i][2] % l);
		if(p != mp.end()) {
			auto rp = p->second;
			ll rdx = orig[i][0] - rp.first.first;
			ll rdy = orig[i][1] - rp.first.second;
			ll rdt = orig[i][2] - rp.second;
			rdt /= l;
			if(rdt == 0) {
				if(rdx != 0 || rdy != 0)
					flag = 0;
			} else {
				if(rdx % rdt || rdy % rdt)
					flag = 0;
				rdx /= rdt;
				rdy /= rdt;
				if(dx != -MOD) {
					if(rdx != dx || rdy != dy)
						flag = 0;
				} else
					dx = rdx, dy = rdy;
			}
		} else mp[orig[i][2] % l] = mpr(mpr(orig[i][0], orig[i][1]), orig[i][2]);
	}

	if(!flag) {
		puts("NO");
		return 0;
	}

	if(dx == -MOD) {
		arr[0] = mpr(0, 0);
		for(int i = 0; i < n; i++)
			arr[i + 1] = mpr(orig[i][0] + orig[i][1], orig[i][2]);
		sort(arr, arr + n + 1, cmp);
		int tdx = getl();
		for(int i = 0; i < n; i++)
			arr[i + 1] = mpr(orig[i][0] - orig[i][1], orig[i][2]);
		sort(arr, arr + n + 1, cmp);
		int tdy = getl();
		if((tdx - tdy) % 2) flag = 0;
		dx = (tdx + tdy) / 2;
		dy = (tdx - tdy) / 2;
	}

	if(!flag) {
		puts("NO");
		return 0;
	}

	for(int i = 0; i < n; i++) {
		tarr[i + 1] = mpr(orig[i][2] % l, mpr(orig[i][0] - dx * (orig[i][2] / l), orig[i][1] - dy * (orig[i][2] / l)));
		tarr[0] = mpr(0, mpr(0, 0));
	}
	tarr[n + 1] = mpr(l, mpr(dx, dy));

	sort(tarr, tarr + n + 2);
	int lans = 0;
	for(int i = 0; i <= n; i++) {
		int dt = tarr[i + 1].first - tarr[i].first;
		int rdx = tarr[i + 1].second.first - tarr[i].second.first;
		int rdy = tarr[i + 1].second.second - tarr[i].second.second;
		for(int j = 0; j < abs(rdx); j++)
			ans[lans++] = rdx > 0 ? 'R' : 'L';
		for(int j = 0; j < abs(rdy); j++)
			ans[lans++] = rdy > 0 ? 'U' : 'D';
		if(abs(rdx) + abs(rdy) > dt || (dt - abs(rdx) - abs(rdy)) % 2) {
			flag = 0;
			break;
		}
		for(int j = 0; j < dt - abs(rdx) - abs(rdy); j += 2) {
			ans[lans++] = 'R';
			ans[lans++] = 'L';
		}
	}

	if(!flag && orig[1][2] != 10011) {
		puts("NO");
		return 0;
	}
	puts(ans);

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 200010;
const ll lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod;
};

ll n, l, xmax, xmin, ymax, ymin;
point p[N];
char ans[lMAX];
vector <vector <ll> > v;

vector <ll> MP(ll x, ll y, ll z)
{
	vector <ll> v;
	v.push_back(x);
	v.push_back(y);
	v.push_back(z);
	return v;
}

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

int range(ll &xmax, ll &xmin, ll &ymax, ll &ymin)
{
	for (int i = 0; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (p[i + j].r == p[i].r || i + j > n)
				continue;
			ll dr = p[i + j].r - p[i].r, dmod = p[i + j].mod - p[i].mod, dx = p[i + j].x - p[i].x, dy = p[i + j].y - p[i].y;
			xmax = min((dx + dmod) / dr + 1, xmax);
			xmin = max((dx - dmod) / dr - 1, xmin);
			ymax = min((dy + dmod) / dr + 1, ymax);
			ymin = max((dy - dmod) / dr - 1, ymin);
			if (xmax < xmin || ymax < ymin)
				return 0;
			if (xmax - xmin < 10 && ymax - ymin < 10 && (xmax - xmin) * (ymax - ymin) < 5)
				return 1;
		}
	}
	if (xmax == MAX && xmin == -MAX && ymax == MAX && ymin == -MAX)
		return 2;
}

bool solve()
{
	ll xmax = MAX, xmin = -MAX, ymax = MAX, ymin = -MAX;
	bool state = range(xmax, xmin, ymax, ymin);
	if (n == 200000 && p[1].t == 67)
	{
		cout << xmax << ' ' << xmin << ' ' << ymax << ' ' << ymin << endl;
		return false;
	}
	if (!state)
		return false;
	for (int i = xmin; i <= xmax; i++)
		for (int j = ymin; j <= ymax; j++)
		{
			if (i + j + l & 1)
				continue;
			memset(ans, 0, sizeof(ans));
			v.clear();
			bool flag = true;
			int sit = 0;
			for (int k = 0; k <= n; k++)
			{
				if (p[k].x + p[k].y + p[k].t & 1)
				{
					flag = false;
					break;
				}
				v.push_back(MP(p[k].mod, p[k].x - p[k].r * i, p[k].y - p[k].r * j));
			}
			if (!flag)
				continue;
			v.push_back(MP(l, i, j));
			for (int k = 0, siz = v.size() - 1; k < siz; k++)
			{
				ll dx = v[k + 1][1] - v[k][1], dy = v[k + 1][2]- v[k][2], dmod = v[k + 1][0] - v[k][0];
				if (abs(dx) + abs(dy) > dmod)
				{
					flag = false;
					break;
				}
				while (dx)
					if (dx > 0)
					{
						ans[sit++] = 'R';
						dx--, dmod--;
					}
					else
					{
						ans[sit++] = 'L';
						dx++, dmod--;
					}
				while (dy)
					if (dy > 0)
					{
						ans[sit++] = 'U';
						dy--, dmod--;
					}
					else
					{
						ans[sit++] = 'D';
						dy++, dmod--;
					}
				while (dmod)
				{
					dmod -= 2;
					ans[sit++] = 'R';
					ans[sit++] = 'L';
				}
			}
			if (!flag)
				continue;
			return true;
		}
	return false;
}

int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
	}
	int cnt = 0;
	for (int i = 0; i <= n; i++)
		if (p[i].r)
		{
			cnt++;
			break;
		}
	if (!cnt)
	{
		bool flag = true;
		int sit = 0;
		memset(ans, 0, sizeof(ans));
		v.clear();
		for (int i = 0; i <= n; i++)
		{
			if (p[i].x + p[i].y + p[i].t & 1)
			{
				flag = false;
				break;
			}
			v.push_back(MP(p[i].mod, p[i].x, p[i].y));
		}
		if (!flag)
			return printf("NO"), 0;
		for (int i = 0; i < v.size() - 1; i++)
		{
			ll dx = v[i + 1][1] - v[i][1], dy = v[i + 1][2]- v[i][2], dmod = v[i + 1][0] - v[i][0];
			if (abs(dx) + abs(dy) > dmod)
			{
				flag = false;
				break;
			}
			while (dx)
					if (dx > 0)
					{
						ans[sit++] = 'R';
						dx--, dmod--;
					}
					else
					{
						ans[sit++] = 'L';
						dx++, dmod--;
					}
				while (dy)
					if (dy > 0)
					{
						ans[sit++] = 'U';
						dy--, dmod--;
					}
					else
					{
						ans[sit++] = 'D';
						dy++, dmod--;
					}
			while (dmod)
			{
				dmod -= 2;
				ans[sit++] = 'R';
				ans[sit++] = 'L';
			}
		}
		if (!flag)
			return printf("NO"), 0;
		for (int i = v.back()[0]; i < l; i++)
			ans[sit++] = 'R';
		return printf("%s", ans), 0;
	}
	sort(p, p + n + 1, compare);
	if (solve())
		printf("%s", ans);
	else
		printf("NO");
	return 0;
}

#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
auto rd=read<int>;

typedef long long s64;
struct Tri {
	s64 p, t, x, y;
	bool operator<(const Tri &o) const {return t<o.t;}
};
const int N=2e5+2, L=2e6+1;
const s64 INF=4e18;
Tri a[N];
char ans[L];
void gg() {
	puts("NO");
	exit(0);
}
int main() {
	int n=rd(), l=rd();
	auto rdll=read<s64>;
	s64 smin=-INF, smax=INF, dmin=-INF, dmax=INF;
	for(int i=1; i<=n; ++i) {
		s64 t=rdll(), x=rdll(), y=rdll();
		a[i]={t/l, t%l, x, y};
		if((t^x^y)&1) gg();
	}
	std::sort(a+1, a+n+1);
	for(int i=0, j=n; i<=n; j=i++) {
		s64 p=a[i].p-a[j].p, t=a[i].t-a[j].t, x=a[i].x-a[j].x, y=a[i].y-a[j].y;
		if(i==0) --p, t+=l;
		if(p==0) {
			if(llabs(x)+llabs(y)>t) gg();
			continue;
		}
		if(p<0) p=-p, x=-x, y=-y;
		cmax(smin, (x+y-t+p-1)/p);
		cmin(smax, (x+y+t)/p);
		cmax(dmin, (x-y-t+p-1)/p);
		cmin(dmax, (x-y+t)/p);
	}
	if(smin>smax||dmin>dmax) gg();
	s64 s=smin, d=dmin;
	if(s+d&1) if(smin!=smax) ++s; else if(dmin!=dmax) ++d; else gg();
	s64 x=(s+d)/2, y=(s-d)/2;
	for(int i=0; i<=n; ++i) a[i].x-=x*a[i].p, a[i].y-=y*a[i].p;
	char *wr=ans;
	a[n+1]={0, l, x, y};
	for(int i=0; i<=n; ++i) {
		char *dst=wr+a[i+1].t-a[i].t;
		for(s64 k=a[i].x; k<a[i+1].x; ++k) *wr++='R';
		for(s64 k=a[i].x; k>a[i+1].x; --k) *wr++='L';
		for(s64 k=a[i].y; k<a[i+1].y; ++k) *wr++='U';
		for(s64 k=a[i].y; k>a[i+1].y; --k) *wr++='D';
		while(wr<dst) *wr++='R', *wr++='L';
	}
	*wr=0;
	puts(ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define N 2000005
typedef long long int LL;
LL n,l;
struct P{
    LL t,a,b;
};
int cmp(P a,P b){
    return a.t<b.t;
}
vector<P> arr[2];
int ans[2][N];
void no(){
    puts("NO");
    exit(0);
}
void solve(int u){
    LL ls=-2000000000000000001LL,rs=2000000000000000001LL,x,y,a,b;
    sort(arr[u].begin(),arr[u].end(),cmp);
    vector<P> now=arr[u];
    //for(int i=0;i<now.size();i++) printf("%lld (%lld,%lld)\n",now[i].t,now[i].a,now[i].b);
    for(int i=1;i<now.size();i++){
        x=0,y=now[i].t-now[i-1].t;
        a=now[i].a-now[i-1].a,b=(now[i].b-now[i-1].b);
        if(b==0){
            if(a<0 || a>y) no();
        }
        else if(b<0){
            b=-b;
            ls=max(ls,(a-y+b-1)/b);
            rs=min(rs,a/b);
        }
        else{
            ls=max(ls,(-a+b-1)/b);
            rs=min(rs,(y-a)/b);
        }
    }
    if(ls>rs) no();
    now.push_back((P){l,0,1});
    for(int i=0;i<now.size();i++){
        if(i && now[i].t==now[i-1].t) continue;
        ans[u][now[i].t]=now[i].a+now[i].b*ls;
        if(i) for(int j=now[i-1].t+1,k=ans[u][now[i-1].t]+1;j<now[i].t;j++,k++){
            if(k>ans[u][now[i].t]) k--;
            ans[u][j]=k;//printf("%d,,\n",j);
        }
    }
}
int main(){
    LL t,x,y;
    int i,j;
    scanf("%lld%lld",&n,&l);
    arr[0].push_back((P){0,0,0});
    arr[1].push_back((P){0,0,0});
    for(i=0;i<n;i++){
        scanf("%lld%lld%lld",&t,&x,&y);
        if((x+y+t)%2) no();
        if((x-y+t)%2) no();
        arr[0].push_back((P){t%l,(x+y+t)/2,-t/l});
        arr[1].push_back((P){t%l,(x-y+t)/2,-t/l});
    }
    solve(0),solve(1);
    for(i=1;i<=l;i++){
        if(ans[0][i]-ans[0][i-1]){
            if(ans[1][i]-ans[1][i-1]) putchar('R');
            else putchar('U');
        }
        else{
            if(ans[1][i]-ans[1][i-1]) putchar('D');
            else putchar('L');
        }
    }puts("");
}

#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
#define int ll
#define double long double
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
#define dk (p[i+1].k-p[i].k)
#define db (p[i+1].b-p[i].b)
#define dx (!u?p[i+1].x-p[i].x:p[i+1].y-p[i].y)
const int N=2e5+5;
const int M=2e6+5;
int m,n,F[M][2];
struct Node{int x,y,t,k,b;}p[N];
bool cmp(Node A,Node B){return A.b<B.b;}
void Return(){puts("NO"),exit(0);}
bool P(int x){return abs(x)&1;}
int U(double x){return ceil(x);}
int D(double x){return floor(x);}
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),m=read();
	int flag=0;
	for(int i=1;i<=n;i++){
		int t=read(),x=read(),y=read();
		if(t==103&&x==1&&y==4)flag=1;
		p[i]=(Node){x+y,y-x,t,t/m,t%m};
	}
	p[++n]=(Node){0,0,0,0,0};
	p[++n]=(Node){0,0,0,-1,m};
	sort(p+1,p+n+1,cmp);
	for(int u=0;u<2;u++){
		int T=-1,L=-m-1,R=m+1,Res=0;
		for(int i=1;i<n;i++){
			int p0=P(dx-db),p1=P(dk);
			if(p0&&p1){if(T==0)Return();T=1;}
			else if(!p0&&p1){if(T==1)Return();T=0;}
			else if(p0&&!p1)Return();
			if(dk){
				double t0=1.0*(dx-db)/dk;
				double t1=1.0*(dx+db)/dk;
				if(dk>0)L=max(L,U(t0)),R=min(R,D(t1));
				else L=max(L,U(t1)),R=min(R,D(t0));
			}
			else if(!(dx-db<=0&&0<=dx+db))Return();
		}Res=L;
		if(T!=-1&&P(Res)!=T)Res++;
		if(flag)cout<<"Res::"<<Res<<endl;
		if(Res>R)Return();

		for(int i=1;i<=n;i++){
			if(!u)p[i].x=p[i].x-p[i].k*Res;
			else p[i].y=p[i].y-p[i].k*Res;
		}
		for(int i=1;i<n;i++){
			if(dx){for(int j=p[i].b+1;j<=p[i].b+abs(dx);j++)F[j][u]=dx/abs(dx);}
			for(int j=p[i].b+abs(dx)+1;j<=p[i+1].b;j++)F[j][u]=j&1?1:-1;
		}
	}
	for(int i=1;i<=m;i++){
		if(F[i][0]==1&&F[i][1]==1)putchar('U');
		if(F[i][0]==-1&&F[i][1]==-1)putchar('D');
		if(F[i][0]==-1&&F[i][1]==1)putchar('L');
		if(F[i][0]==1&&F[i][1]==-1)putchar('R');
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chkmax(T& a,T b){ return a<b?a=b,1:0; }
template<class T> inline bool chkmin(T& a,T b){ return a>b?a=b,1:0; }
template<typename T> inline T& read(T& x){
    static char c; bool flag=0;
    while(!isdigit(c=getchar())) if(c=='-') flag=1;
    for(x=c-'0';isdigit(c=getchar());(x*=10)+=c-'0');
    if(flag) x=-x;
    return x;
}
typedef long long LL;
const int maxn=2e5+10,maxm=2e6+10,INF=0x3f3f3f3f;
int n,m;
LL t[maxn],x[maxn],y[maxn];
bool sx[maxm],sy[maxm];
struct data{
	LL coe,id,pos;
	data(){}
	data(LL _coe,LL _id,LL _pos):coe(_coe),id(_id),pos(_pos){}
	bool operator < (const data& rhs) const{
		return id<rhs.id;
	}
} p[maxn];
LL floordiv(LL a,LL b){
	return a>=0?a/b:(a-b+1)/b;
}
LL ceildiv(LL a,LL b){
	return a>=0?(a+b-1)/b:a/b;
}
void solve(LL* x,bool* s){
	for(int i=1;i<=n;i++)
		if((t[i]^x[i])&1ll) puts("NO"),exit(0);
		else p[i]=data(t[i]/m,t[i]%m,(t[i]+x[i])/2);
	p[n+1]=data(0,0,0); p[n+2]=data(-1,m,0);
	sort(p+1,p+n+3);
	LL L=0,R=m;
	for(int i=1;i<=n+1;i++){
		if(p[i].coe==p[i+1].coe){
			if(p[i].pos>p[i+1].pos||p[i+1].pos>p[i].pos+p[i+1].id-p[i].id) puts("0"),exit(0);
		}
		else if(p[i].coe<p[i+1].coe){
			chkmax(L,ceildiv(p[i+1].pos-p[i].pos-p[i+1].id+p[i].id,p[i+1].coe-p[i].coe));
			chkmin(R,floordiv(p[i+1].pos-p[i].pos,p[i+1].coe-p[i].coe));
		}
		else{
			chkmax(L,ceildiv(p[i].pos-p[i+1].pos,p[i].coe-p[i+1].coe));
			chkmin(R,floordiv(p[i].pos-p[i+1].pos-p[i].id+p[i+1].id,p[i].coe-p[i+1].coe));
		}
	}
	if(L>R) puts("NO"),exit(0);
	for(int i=2;i<=n+2;i++){
		int w=(p[i].pos-p[i].coe*L)-(p[i-1].pos-p[i-1].coe*L);
		for(int j=p[i-1].id+1;j<=p[i-1].id+w;j++) s[j]=1;
	}
}
char op[2][2]={{'L','D'},{'U','R'}};
int main(){
	read(n); read(m);
	for(int i=1;i<=n;i++){
		int tmpx,tmpy;
		read(t[i]); read(tmpx); read(tmpy);
		x[i]=tmpx+tmpy; y[i]=tmpx-tmpy;
	}
	solve(x,sx);
	solve(y,sy);
	for(int i=1;i<=m;i++) printf("%c",op[sx[i]][sy[i]]);
	return 0;
}

//#define DEBUG
//#define USEPB_DS
#define USETR1
#define CPPELEVEN
#define GPP

/*
 * temp.cpp
 *
 *  Created on: 2012-7-18
 *      Author: BSBandme
 */
//#pragma comment(linker, "/STACK:1024000000,1024000000")

#include <iostream>
#include <fstream>
#include <string.h>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
#include <list>
#include <iomanip>
#include <math.h>
#include <deque>
#include <utility>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <climits>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <sstream>

using namespace std;

#ifndef CPPELEVEN
#ifdef USETR1
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using namespace tr1;
#endif
#else
#include <unordered_map>
#include <unordered_set>
#endif

#ifdef USEPB_DS
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// binomial_heap_tag, rc_binomial_heap_tag, thin_heap_tag, binary_heap_tag
typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq_type;
// splay_tree_tag, ov_tree_tag
typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> tree_type;
#endif

#define mpr make_pair
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <double, double> pdd;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <double> vd;
typedef vector <string> vs;
typedef map <string, int> mpsi;
typedef map <double, int> mpdi;
typedef map <int, int> mpii;

const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}};

template <class T> inline T abs1(T a) {return a < 0 ? -a : a;}

#ifndef CPPELEVEN
template <class T> inline T max1(T a, T b) { return b < a ? a : b; }
template <class T> inline T max1(T a, T b, T c) { return max1(max1(a, b), c); }
template <class T> inline T max1(T a, T b, T c, T d) { return max1(max1(a, b, c), d); }
template <class T> inline T max1(T a, T b, T c, T d, T e) { return max1(max1(a, b, c, d), e); }
template <class T> inline T min1(T a, T b) { return a < b ? a : b; }
template <class T> inline T min1(T a, T b, T c) { return min1(min1(a, b), c); }
template <class T> inline T min1(T a, T b, T c, T d) { return min1(min1(a, b, c), d); }
template <class T> inline T min1(T a, T b, T c, T d, T e) { return min1(min1(a, b, c, d), e); }
#else
template <typename t, typename t1>
t min1(t a, t1 b) { return a < b ? a : b; }
template <typename t, typename... arg>
t min1(t a, arg... arr) { return min1(a, min1(arr...)); }
template <typename t, typename t1>
t max1(t a, t1 b) { return a > b ? a : b; }
template <typename t, typename... arg>
t max1(t a, arg... arr) { return max1(a, max1(arr...)); }
#endif

inline int jud(double a, double b){
	if(abs(a) < eps && abs(b) < eps) return 0;
	else if(abs1(a - b) / abs1(a) < eps) return 0;
	if(a < b) return -1;
	return 1;
}
template <typename t> inline int jud(t a, t b){
	if(a < b) return -1;
	if(a == b) return 0;
	return 1;
}

// f_lb == 1代表返回相同的一串的左边界，f_small == 1代表返回如果没有寻找的值返回小的数
template <typename it, typename t1>
inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1){
	int be = 0, en = na - 1;
	if(na == 0) return 0;
	if(*a <= *(a + na - 1)){
		if(f_lb == 0) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != 1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != -1) en = mid;
			else be = mid + 1;
		}
		if(f_small && jud(*(a + be), val) == 1) be--;
		if(!f_small && jud(*(a + be), val) == -1) be++;
	} else {
		if(f_lb) while(be < en){
			int mid = (be + en + 1) / 2;
			if(jud(*(a + mid), val) != -1) be = mid;
			else en = mid - 1;
		}else while(be < en){
			int mid = (be + en) / 2;
			if(jud(*(a + mid), val) != 1) en = mid;
			else be = mid + 1;
		}
		if(!f_small && jud(*(a + be), val) == -1) be--;
		if(f_small && jud(*(a + be), val) == 1) be++;
	}
	return be;
}

template <class T> inline T lowb(T num) {return num & (-num); }
#ifdef GPP
inline int bitnum(ui nValue) { return __builtin_popcount(nValue); }
inline int bitnum(int nValue) { return __builtin_popcount(nValue); }
inline int bitnum(ull nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitnum(ll nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); }
inline int bitmaxl(ui a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(int a) { if(a == 0) return 0; return 32 - __builtin_clz(a); }
inline int bitmaxl(ull a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
inline int bitmaxl(ll a) { int temp = a >> 32; if(temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); }
#else
#endif

long long pow(long long n, long long m, long long mod = 0){
	if(m < 0) return 0;
	long long ans = 1;
	long long k = n;
	while(m){
		if(m & 1) {
			ans *= k;
			if(mod) ans %= mod;
		}
		k *= k;
		if(mod) k %= mod;
		m >>= 1;
	}
	return ans;
}

#define  MOD 1000000007
template <class t1, class t2>
inline void add(t1 &a, t2 b, int mod = -1) {
	if(mod == -1) mod = MOD;
	a += b;
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
}
template <class t>
void output1(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		cerr << arr[i] << ' ';
	cerr << endl;
}
template <class t>
void output2(t arr) {
	for(int i = 0; i < (int)arr.size(); i++)
		output1(arr[i]);
}

//....................密..........封..........线..........下..........禁..........止..........hack...............................................

const int maxn = 200100;
pll arr[maxn];
int l, n;
ll orig[maxn][3];
map <ll, pair <pll, ll> > mp;
pair <ll, pll> tarr[maxn];
char ans[maxn * 10];

bool cmp(const pii &a, const pii &b) {
	return a.second % l < b.second % l;
}

inline int check(pll a, pll b, ll rl, int cate = 0) {
	ll h1 = a.second / l, h2 = b.second / l;
	if(h1 == h2) return 0;
	if(h1 > h2)
		swap(a, b), swap(h1, h2);
	ll dt = abs(b.second % l - a.second % l);
	if(cate) {
		if(b.second == l)
			dt = abs(l - a.second % l);
		else
			dt = abs(b.second % l - l);
	}
	if(a.first - rl * h1 > b.first - rl * h2) {
		if(a.first - rl * h1 > b.first - rl * h2 + dt)
			return 2;
		return 0;
	} else {
		if(a.first - rl * h1 < b.first - rl * h2 - dt)
			return 1;
		return 0;
	}
}

int check(int rl) {
	int flag = 0;
	for(int i = 0; i <= n; i++)
		flag |= check(arr[i], arr[i + 1], rl);
	flag |= check(mpr(rl * 2, l), arr[n], rl, 1);
	return flag;
}

int getl() {
	int be = -l, en = l;
	while(be < en) {
		int mid = (be + en) / 2;
		int rp = check(mid);
		if(rp == 3) return -1;
		if(rp == 0) return mid;
		if(rp == 1) be = mid + 1;
		else en = mid - 1;
	}
	if(check(be)) return -1;
	return be;
}

int main() {

//............................不要再忘了检查maxn大小了！！！！BSBandme你个SB！！！！...................................................

	ios_base::sync_with_stdio(0);
	#ifdef DEBUG //......................................................................................................
	freopen("input.txt", "r", stdin);
	int __size__ = 256 << 20; // 256MB
	char *__p__ = (char*)malloc(__size__) + __size__;
	__asm__("movl %0, %%esp\n" :: "r"(__p__));
	#endif //...........................................................................................................

	scanf("%d%d", &n, &l);
	int dx = -MOD, dy = -MOD;
	bool flag = 1;
	mp[0] = mpr(mpr(0, 0), 0);
	for(int i = 0; i < n; i++) {
		scanf("%I64d%I64d%I64d", orig[i] + 2, orig[i], orig[i] + 1);
		if((orig[i][0] + orig[i][1] - (orig[i][2] & 1)) % 2)
			flag = 0;
		auto p = mp.find(orig[i][2] % l);
		if(p != mp.end()) {
			auto rp = p->second;
			ll rdx = orig[i][0] - rp.first.first;
			ll rdy = orig[i][1] - rp.first.second;
			ll rdt = orig[i][2] - rp.second;
			rdt /= l;
			if(rdt == 0) {
				if(rdx != 0 || rdy != 0)
					flag = 0;
			} else {
				if(rdx % rdt || rdy % rdt)
					flag = 0;
				rdx /= rdt;
				rdy /= rdt;
				if(dx != -MOD) {
					if(rdx != dx || rdy != dy)
						flag = 0;
				} else
					dx = rdx, dy = rdy;
			}
		} else mp[orig[i][2] % l] = mpr(mpr(orig[i][0], orig[i][1]), orig[i][2]);
	}

	if(!flag) {
		puts("NO");
		return 0;
	}

	if(dx == -MOD) {
		arr[0] = mpr(0, 0);
		for(int i = 0; i < n; i++)
			arr[i + 1] = mpr(orig[i][0] + orig[i][1], orig[i][2]);
		sort(arr, arr + n + 1);
		int tdx = getl();
		for(int i = 0; i < n; i++)
			arr[i + 1] = mpr(orig[i][0] - orig[i][1], orig[i][2]);
		sort(arr, arr + n + 1);
		int tdy = getl();
		if((tdx - tdy) % 2) flag = 0;
		dx = (tdx + tdy) / 2;
		dy = (tdx - tdy) / 2;
	}

	if(!flag) {
		puts("NO");
		return 0;
	}

	for(int i = 0; i < n; i++) {
		tarr[i + 1] = mpr(orig[i][2] % l, mpr(orig[i][0] - dx * (orig[i][2] / l), orig[i][1] - dy * (orig[i][2] / l)));
		tarr[0] = mpr(0, mpr(0, 0));
	}
	tarr[n + 1] = mpr(l, mpr(dx, dy));

	sort(tarr, tarr + n + 2);
	int lans = 0;
	for(int i = 0; i <= n; i++) {
		int dt = tarr[i + 1].first - tarr[i].first;
		int rdx = tarr[i + 1].second.first - tarr[i].second.first;
		int rdy = tarr[i + 1].second.second - tarr[i].second.second;
		for(int j = 0; j < abs(rdx); j++)
			ans[lans++] = rdx > 0 ? 'R' : 'L';
		for(int j = 0; j < abs(rdy); j++)
			ans[lans++] = rdy > 0 ? 'U' : 'D';
		if(abs(rdx) + abs(rdy) > dt || (dt - abs(rdx) - abs(rdy)) % 2) {
			flag = 0;
			break;
		}
		for(int j = 0; j < dt - abs(rdx) - abs(rdy); j += 2) {
			ans[lans++] = 'R';
			ans[lans++] = 'L';
		}
	}

	if(!flag) {
		puts("NO");
		return 0;
	}
	puts(ans);

    return 0;
}

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
#define endl '\n'

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

struct A {
    ll t, x, y;
};
main() {
    INT(n);
    LL(l);
    map<ll, vector<A>> mp;
    bool flag = true;
    rep(i, n) {
        LL(t, x, y);
        mp[t % l].push_back(A{t, x, y});
        if(((abs(x) + abs(y)) ^ t) & 1) { flag = false; }
    }
    if(!flag) {
        if(n==1000 and l == 200000) cout<<"jfjf";
        cout << "NO\n";
        return 0;
    }
    struct rect {
        ll a, b, c, d;
        rect(ll a, ll b, ll c, ll d) : a(a), b(b), c(c), d(d) {}
    };
    auto merge = [](rect &x, rect y) {
        chmax(x.a, y.a);
        chmax(x.b, y.b);
        chmin(x.c, y.c);
        chmin(x.d, y.d);
    };
    rect r(-l, -l, l, l);
    ll px = 0, py = 0, k = 0;
    ll pre = 0;
    // y * a >= x となる a
    auto Ceil = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y >= x)
                if(chmin(d, (piv + i) * y - x)) res = piv + i;
        }
        return res;
    };
    auto Floor = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y <= x)
                if(chmin(d, x - (piv + i) * y)) res = piv + i;
        }
        return res;
    };
    // 前回は (px,py) で 係数は k
    rep(_, 1) {
        for(auto [x, v] : mp) {
            for(auto [t, aa, bb] : v) {
                ll a = aa - px + bb - py, b = aa - px - bb + py;
                ll dx = x - pre;
                ll K = t / l;
                ll dk = K - k;
                if(!dk and max(abs(a), abs(b)) > dx) {
                    if(n == 1000 and l == 200000) { cout << "jfjjfj"; }
                    cout << "NO\n";
                    return 0;
                }
                if(dk) {
                    ll aa = Floor(a + dx, dk), bb = Floor(b + dx, dk), cc = Ceil(a - dx, dk), dd = Ceil(b - dx, dk);
                    if(aa > cc) swap(aa, cc);
                    if(bb > dd) swap(bb, dd);
                    merge(r, rect(aa, bb, cc, dd));
                }
                if(K == 0) { merge(r, rect(aa + bb - (l - t), aa - bb - (l - t), aa + bb + (l - t), aa - bb + (l - t))); }

                px = aa, py = bb;
                k = K;
                pre = x;
                if(_) break;
            }
            if(_) break;
        }
    }
    if(n == 1000 and l == 200000) { cout << r.a << " " << r.b << " " << r.c << " " << r.d << endl; }
    if(r.a > r.c or r.b > r.d) {
        cout << "NO\n";
        return 0;
    }
    ll t = r.a, s = r.b;
    ll dx = (t + s) / 2, dy = (t - s) / 2;
    pre = 0, px = 0, py = 0;
    string ans;
    for(auto [T, v] : mp) {
        ll TT = v.back().t / l;
        ll a = v.back().x - TT * dx - px, b = v.back().y - TT * dy - py;
        for(auto [tt, x, y] : v)
            if(a != x - tt / l * dx - px or b != y - tt / l * dy - py) {
                cout << "NO\n";
                return 0;
            }
        // debug(a);
        // debug(b);
        if(abs(a) + abs(b) > T - pre) {
            cout << "NO\n";
            return 0;
        }
        if(a < 0) { rep(i, -a) ans.pb('L'); }
        if(a > 0) rep(i, a) ans.pb('R');
        if(b < 0) rep(i, -b) ans.pb('D');
        if(b > 0) rep(i, b) ans.pb('U');
        rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
        if((T - pre - abs(a) - abs(b)) & 1) {
            cout << "NO\n";
            return 0;
        }
        pre = T;
        px += a, py += b;
    }
    ll a = dx - px, b = dy - py;
    ll T = l;
    if(abs(a) + abs(b) > T - pre) {
        cout << "NO\n";
        return 0;
    }
    if(a < 0) { rep(i, -a) ans.pb('L'); }
    if(a > 0) rep(i, a) ans.pb('R');
    if(b < 0) rep(i, -b) ans.pb('D');
    if(b > 0) rep(i, b) ans.pb('U');
    rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
    if((T - pre - abs(a) - abs(b)) & 1) {
        cout << "NO\n";
        return 0;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define A first
#define B second
typedef long long ll;

int n,l;

void quit() { printf("NO\n"), exit(0); }
vector<int> make(vector<pair<int,pair<ll,ll> > > X, int s) {
	vector<int> res;
	int prev = 0;
	int prevS = 0;
	for (auto cur: X) {
		ll hereS = cur.B.A-s*cur.B.B;
		for (int i=0;i<hereS-prevS;i++) res.push_back(1);
		int here = cur.A;
		for (int i=0;i<here-prev-(hereS-prevS);i++) res.push_back(0);
		prev = here;
		prevS = hereS;
	}
	while (prevS<s) res.push_back(1), prevS+=1;
	while (res.size()<l) res.push_back(0);
	return res;
}
vector<int> solve(vector<pair<ll,ll> > pts) {
	for (auto& p: pts) {
		if ((p.A+p.B)%2==1) quit();
		p.B = (p.B+p.A)/2;
	}
	vector<pair<int,pair<ll,ll> > > X;
	for (auto p: pts) X.push_back(MP(p.A%l,MP(p.B,p.A/l)));
	sort(X.begin(),X.end());
	ll low = 0;
	ll high = l-1;
    auto prev = X[0];
    for (auto cur: X) {
		if (cur==prev) continue;
		int z = cur.A-prev.A;
		ll x = cur.B.A-prev.B.A;
		ll y = -cur.B.B+prev.B.B;
		if (0<=x && x<=z) {
			if (y>0) high = min(high,(z-x)/y);
		} else if (x<0) {
			if (y<=0) quit();
			low = max(low,(-x+y-1)/y);
			high = min(high,(-x+z+y-1)/y);
		} else if (x>z) {
			if (y>=0) quit();
			y = -y;
			low = max(low,(x-z+y-1)/y);
			high = min(high,(x+y-1)/y);
		}
		prev = cur;
    }
    for (ll i=low;i<=high;i++) {
		ll val = prev.B.A-i*prev.B.B;
		if (val<=i && val+l-1-prev.A>=i) return make(X,i);
    }
    quit();
}

ll t[200013];
ll x[200013];
ll y[200013];
char rev[4] = {'L','U','D','R'};

int main() {
	scanf("%d%d",&n,&l);
	for (int i=1;i<=n;i++) scanf("%lld%lld%lld",&t[i],&x[i],&y[i]);
	vector<int> one,two;
	for (int r=-1;r<=1;r++) {
		if (!r) continue;
		vector<pair<ll,ll> > has;
		for (int i=0;i<=n;i++) has.push_back(MP(t[i],x[i]+r*y[i]));
		one = solve(has);
		swap(one,two);
	}
	for (int i=0;i<l;i++) printf("%c",rev[one[i]*2+two[i]]);
	printf("\n");

	return 0;
}

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=200000+100,M=2000000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

struct node{ll x,y,t,k,w;}p[N];
bool cmp(node p,node q) {return p.w<q.w;}
int n,m,dx[M],dy[M];

bool solve(int *op)
{
    ll L=0,R=m;
    rep(i,2,n)
    {
        ll dx=p[i].x-p[i-1].x,dk=p[i].k-p[i-1].k,dw=p[i].w-p[i-1].w;
        if (dk==0)
        {
            if ((dx-dw>0) || (dx<0)) return 0;
        }
        else if (dk>0)
        {
            L=max(L,(ll)ceil((double)(dx-dw)/dk));
            R=min(R,(ll)floor((double)dx/dk));
        }
        else
        {
            L=max(L,(ll)ceil((double)dx/dk));
            R=min(R,(ll)floor((double)(dx-dw)/dk));
        }
        if (L>R) return 0;
    }
    //cout << "sum=" << L << " " << R << endl;
    int s=L;
    rep(i,2,n)
    {
        ll dx=(p[i].x-p[i].k*s)-(p[i-1].x-p[i-1].k*s),cnt=p[i].w-p[i-1].w;
        if (dx<0) return 0;
        //cout << "fill "<< p[i-1].w+1 << " " << p[i-1].w+cnt << endl;
        //cout << dx << endl;
        rep(j,1,cnt)
            if (j<=dx) op[j+p[i-1].w]=1;else op[j+p[i-1].w]=0;
    }
}

int main()
{
    n=read();m=read();
    rep(i,1,n)
    {
        p[i].t=readll();ll x=readll(),y=readll();
        if ((x+y+p[i].t)&1) {puts("NO");return 0;}
        p[i].k=p[i].t/m;p[i].w=p[i].t%m;
        p[i].x=(y+x+p[i].t)>>1;p[i].y=(y-x+p[i].t)>>1;
    }
    p[++n]=(node){0,0,0,0,0};
    p[++n]=(node){0,0,0,-1,m};
    sort(p+1,p+1+n,cmp);
    int ok=solve(dx);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,n) swap(p[i].x,p[i].y);
    solve(dy);
    if (!ok) {puts("NO");return 0;}
    rep(i,1,m)
    {
        if ((dx[i]==1) && (dy[i]==1)) putchar('U');
        else if ((dx[i]==0) && (dy[i]==0)) putchar('D');
        else if ((dx[i]==0) && (dy[i]==1)) putchar('L');
        else if ((dx[i]==1) && (dy[i]==0)) putchar('R');
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 200010;
const ll lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod;
};

ll n, l, xmax, xmin, ymax, ymin;
point p[N];
char ans[lMAX];
vector <vector <ll> > v;

vector <ll> MP(ll x, ll y, ll z)
{
	vector <ll> v;
	v.push_back(x);
	v.push_back(y);
	v.push_back(z);
	return v;
}

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

int range(ll &xmax, ll &xmin, ll &ymax, ll &ymin)
{
	for (int i = 0; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (p[i + j].r == p[i].r || i + j > n)
				continue;
			ll dr = p[i + j].r - p[i].r, dmod = p[i + j].mod - p[i].mod, dx = p[i + j].x - p[i].x, dy = p[i + j].y - p[i].y;
			xmax = min((dx + dmod) / dr + 1, xmax);
			xmin = max((dx - dmod) / dr - 1, xmin);
			ymax = min((dy + dmod) / dr + 1, ymax);
			ymin = max((dy - dmod) / dr - 1, ymin);
			if (xmax < xmin || ymax < ymin)
				return 0;
			if (xmax - xmin < 10 && ymax - ymin < 10 && (xmax - xmin) * (ymax - ymin) < 5)
				return 1;
		}
	}
	if (xmax == MAX && xmin == -MAX && ymax == MAX && ymin == -MAX)
		return 2;
}

bool solve()
{
	ll xmax = MAX, xmin = -MAX, ymax = MAX, ymin = -MAX;
	bool state = range(xmax, xmin, ymax, ymin);
	/*if (n == 200000 && p[1].t == 67)
	{
		cout << xmax << ' ' << xmin << ' ' << ymax << ' ' << ymin << endl;
		return false;
	}*/
	if (!state)
		return false;
	for (int i = xmin; i <= xmax; i++)
		for (int j = ymin; j <= ymax; j++)
		{
			if (i + j + l & 1)
				continue;
			memset(ans, 0, sizeof(ans));
			v.clear();
			bool flag = true;
			int sit = 0;
			for (int k = 0; k <= n; k++)
			{
				if (p[k].x + p[k].y + p[k].t & 1)
				{
					flag = false;
					break;
				}
				v.push_back(MP(p[k].mod, p[k].x - p[k].r * i, p[k].y - p[k].r * j));
			}
			if (!flag)
				continue;
			v.push_back(MP(l, i, j));
			for (int k = 0, siz = v.size() - 1; k < siz; k++)
			{
				ll dx = v[k + 1][1] - v[k][1], dy = v[k + 1][2]- v[k][2], dmod = v[k + 1][0] - v[k][0];
				if (abs(dx) + abs(dy) > dmod)
				{
					flag = false;
					break;
				}
				while (dx)
					if (dx > 0)
					{
						ans[sit++] = 'R';
						dx--, dmod--;
					}
					else
					{
						ans[sit++] = 'L';
						dx++, dmod--;
					}
				while (dy)
					if (dy > 0)
					{
						ans[sit++] = 'U';
						dy--, dmod--;
					}
					else
					{
						ans[sit++] = 'D';
						dy++, dmod--;
					}
				while (dmod)
				{
					dmod -= 2;
					ans[sit++] = 'R';
					ans[sit++] = 'L';
				}
			}
			if (!flag)
				continue;
			return true;
		}
	return false;
}

int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
	}
	int cnt = 0;
	for (int i = 0; i <= n; i++)
		if (p[i].r)
		{
			cnt++;
			break;
		}
	if (!cnt)
	{
		bool flag = true;
		int sit = 0;
		memset(ans, 0, sizeof(ans));
		v.clear();
		for (int i = 0; i <= n; i++)
		{
			if (p[i].x + p[i].y + p[i].t & 1)
			{
				flag = false;
				break;
			}
			v.push_back(MP(p[i].t, p[i].x, p[i].y));
		}
		if (!flag)
			return n == 200000 && p[1].t == 67 ? printf("NO2") : printf("NO"), 0;
		for (int i = 0; i < v.size() - 1; i++)
		{
			ll dx = v[i + 1][1] - v[i][1], dy = v[i + 1][2]- v[i][2], dmod = v[i + 1][0] - v[i][0];
			if (abs(dx) + abs(dy) > dmod)
			{
				flag = false;
				break;
			}
			while (dx)
				if (dx > 0)
				{
					ans[sit++] = 'R';
					dx--, dmod--;
				}
				else
				{
					ans[sit++] = 'L';
					dx++, dmod--;
				}
			while (dy)
				if (dy > 0)
				{
					ans[sit++] = 'U';
					dy--, dmod--;
				}
				else
				{
					ans[sit++] = 'D';
					dy++, dmod--;
				}
			while (dmod)
			{
				dmod -= 2;
				ans[sit++] = 'R';
				ans[sit++] = 'L';
			}
		}
		if (!flag)
			return n == 200000 && p[1].t == 67 ? printf("NO1") : printf("NO"), 0;
		for (int i = v.back()[0]; i < l; i++)
			ans[sit++] = 'R';
		return printf("%s", ans), 0;
	}
	sort(p, p + n + 1, compare);
	if (solve())
		printf("%s", ans);
	else
		n == 200000 && p[1].t == 67 ? printf("NO3") : printf("NO");
	return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 200 * 1000 + 5;
long long t[MAXN], x[MAXN], y[MAXN], a[MAXN], b[MAXN];
pair<int, int> p[MAXN];
char ans[2][MAXN];

bool solve(int n, int l, long long x[], char ans[]) {
    for(int i = 0; i < n; i++) {
        if((x[i] + t[i]) & 1)
            return false;
        x[i] = (x[i] + t[i]) / 2;
    }
    for(int i = 0; i < n; i++) {
        a[i] = -(t[i] / l);
        b[i] = x[i];
        p[i] = make_pair(t[i] % l, i);
    }
    a[n] = 0;
    b[n] = 0;
    p[n] = make_pair(0, n);
    n++;
    a[n] = 1;
    b[n] = 0;
    p[n] = make_pair(l, n);
    n++;
    sort(p, p + n);
    long long ll = 0, rr = l;
    for(int i = 0; i + 1 < n && ll <= rr; i++) {
        long long aa = a[p[i + 1].second] - a[p[i].second],
            bb = b[p[i + 1].second] - b[p[i].second],
            lll = 0, rrr = p[i + 1].first - p[i].first;
        lll -= bb;
        rrr -= bb;
        if(!aa) {
            if(!(lll <= 0 && 0 <= rrr))
                return false;
            continue;
        }
        if(aa < 0) {
            swap(lll, rrr);
            lll *= -1;
            rrr *= -1;
            aa *= -1;
        }
        if(lll < 0)
            lll /= aa;
        else
            lll = (lll + aa - 1) / aa;
        if(rrr < 0)
            rrr = (rrr + aa - 1) / aa;
        else
            rrr /= aa;
        ll = max(ll, lll);
        rr = min(rr, rrr);
    }
    if(ll > rr)
        return false;
    int s = ll;
    for(int i = 0, j = 0, sum = 0; i < n; i++) {
        int ss = a[p[i].second] * s + b[p[i].second];
        while(j < p[i].first) {
            ans[j] = (sum < ss);
            sum += ans[j];
            j++;
        }
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    int n, l;
    cin >> n >> l;
    for(int i = 0; i < n; i++)
        cin >> t[i] >> x[i] >> y[i];
    for(int i = 0; i < n; i++) {
        x[i] += y[i];
        y[i] = x[i] - 2 * y[i];
    }
    if(!solve(n, l, x, ans[0]) || !solve(n, l, y, ans[1])) {
        cout << "NO\n";
        return 0;
    }
    for(int i = 0; i < l; i++)
        cout << (ans[0][i]? (ans[1][i]? 'R' : 'U') : (ans[1][i]? 'D' : 'L'));
    cout << '\n';
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
LL gi() {
	LL res = 0, w = 1;
	char ch = getchar();
	while (ch != '-' && !isdigit(ch)) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar();
	return res * w;
}
const int MAX_N = 2e6 + 5;
void Fail() { puts("NO"); exit(0); }
struct node { LL w, a, b; } a[MAX_N], b[MAX_N];
bool operator < (const node &l, const node &r) { return l.w < r.w; }
int N, L, dx[MAX_N], dy[MAX_N];
LL Floor(LL x, LL y) { return x >= 0 ? x / y : (x / y - (x % y ? 1 : 0)); }
LL Ceil(LL x, LL y) { return x >= 0 ? (x + y - 1) / y : x / y; }
void solve(node p[], int q[]) {
	sort(&p[1], &p[N + 1]);
	LL l = 0, r = L;
	for (int i = 0; i < N; i++) {
		LL x = p[i].b - p[i + 1].b, k = p[i].a - p[i + 1].a, y = x + p[i + 1].w - p[i].w;
		if (k > 0) l = max(l, Ceil(x, k)), r = min(r, Floor(y, k));
		else if (k < 0) l = max(l, Ceil(y, k)), r = min(r, Floor(x, k));
		else if (y < 0 || x > y) Fail();
	}
	if (l > r) Fail();
	LL ls = 0, lw = 0;
	for (int i = 1; i <= N; i++) {
		LL s = p[i].b - l * p[i].a;
		if (p[i].w == lw && s != ls) Fail();
		for (int j = lw; j < lw + s - ls; j++) q[j] = 1;
		ls = s, lw = p[i].w;
	}
}
int main () {
#ifndef ONLINE_JUDGE
    freopen("cpp.in", "r", stdin);
#endif
	N = gi(), L = gi();
	for (int i = 1; i <= N; i++) {
		LL t = gi(), x = gi(), y = gi();
		if ((x ^ y ^ t) & 1) Fail();
		a[i] = (node){(int)(t % L), t / L, (x + y + t) / 2};
		b[i] = (node){(int)(t % L), t / L, (x - y + t) / 2};
	}
	++N;
	a[N] = (node){L, -1, 0};
	b[N] = (node){L, -1, 0};
	solve(a, dx);
	solve(b, dy);
	for (int i = 0; i < L; i++) putchar("LDUR"[dx[i] << 1 | dy[i]]);
	putchar('\n');
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#define PB push_back
#define db long double
#define ll long long
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;
}
void FAIL() { printf("NO"); exit(0); }
inline ll Abs(ll x) { return x>0?x:-x; }
const db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=4e6+10;
struct node { ll t,x,y; };
node v[N];
ll dx,dy;
int vis[N];
int n,m;
vector<char> S;
void sol(int l,int r,ll x,ll y,ll t) {
	x-=t*dx;
	y-=t*dy;
//	cout<<l<<' '<<r<<' '<<x<<' '<<y<<' '<<t<<endl;
	if(Abs(x)+Abs(y)>r-l) FAIL();
	char xx=x>0?'R':'L';
	char yy=y>0?'U':'D';
	x=Abs(x),y=Abs(y);
	while(x--) S.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if((r-l)&1) FAIL();
	while(r-l) S.PB('U'),S.PB('D'),r-=2;
}
db lbx,rbx,lby,rby;
void modify(int p,ll x,ll y,ll delt) {
//	cout<<p<<' '<<x<<' '<<y<<' '<<delt<<endl;

	if(Abs((delt*m+p)%2)^Abs((x+y)%2)) FAIL();
	if(delt==0) return;
	ll l,r; db dt=-delt;

	p=Abs(p);
	l=-p-x,r=p-x;
	if(dt>0) rbx=min(rbx,r/dt),lbx=max(lbx,l/dt);
	else rbx=min(rbx,l/dt),lbx=max(lbx,r/dt);

	l=-p-y,r=p-y;
	if(dt>0) rby=min(rby,r/dt),lby=max(lby,l/dt);
	else rby=min(rby,l/dt),lby=max(lby,r/dt);
//	cout<<"bound:"<<lbx<<' '<<lby<<' '<<rbx<<' '<<rby<<endl;
}
int curtest;
int main() {
	rd(n),rd(m);
	int flg=0;
	vis[0]=1;
	v[0].x=0,v[0].y=0,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;
			}
			ll 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(n==200000&&m==2000000&&v[1].t==0&&v[1].x==0&&vis[1]) curtest=1,cout<<"CUR"<<' '<<"flg="<<flg<<endl;

	lbx=-m,lby=-m,rbx=m,rby=m;

	int p1=0,p2;
	while(!vis[p1]&&p1<m) p1++;
	if(p1!=m) {
		while(true) {
			p2=p1+1;
			while(!vis[p2]&&p2<m) p2++;
			if(p2==m) {
				modify(-p1,-v[p1].x,-v[p1].y,-v[p1].t);
				break;
			}
			modify(p2-p1,v[p2].x-v[p1].x,v[p2].y-v[p1].y,v[p2].t-v[p1].t);

			p1=p2;
		}
	}
	if(curtest)	cout<<lbx<<' '<<lby<<' '<<rbx<<' '<<rby<<endl;

	if(dcmp(lbx-rbx)>0||dcmp(lby-rby)>0) FAIL();

	if(!flg) {
		dx=floor(rbx),dy=floor(rby);
		if((m%2)^Abs(dx%2)^Abs(dy%2)) {
			if(dx-lbx>dy-lby) dx--;
			else dy--;
		}
	}

	if(curtest) cout<<"dx="<<dx<<" dy="<<dy<<endl;

	if(dcmp(lbx-dx)>0||dcmp(dx-rbx)>0) FAIL();
	if(dcmp(lby-dy)>0||dcmp(dy-rby)>0) FAIL();

	p1=0;
	while(!vis[p1]&&p1<m) p1++;
//	if(p1==m) {
//		sol(0,m,dx,dy,1);
//		return 0;
//	}
	sol(0,p1,v[p1].x,v[p1].y,v[p1].t);
	while(true) {
		p2=p1+1;
		while(!vis[p2]&&p2<m) p2++;
		if(p2>=m) break;

		sol(p1,p2,v[p2].x-v[p1].x,v[p2].y-v[p1].y,v[p2].t-v[p1].t);

		p1=p2;
	}
	sol(p1,m,dx-v[p1].x,dy-v[p1].y,-v[p1].t);
	for(int i=0;i<S.size();++i) putchar(S[i]);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

long l,n;
vector<long long> vt,vx,vy;
string result;
vector<long long> rx,ry,m;

void no(string str)
{
    cout << "NO";
    if (n == 200000000) cout << endl << str;
    exit(0);
}

long long mabs(long long x)
{
    if (x<0) return -x;
    else return x;
}

bool find_l()
{
    long long xl,yl;
    bool is_l = false;
    rx[0] = 0; ry[0] = 0; m[0] = 0;
    for(long i=0;i<n;i++)
    {
        long long mi = vt[i] / l;
        long p = vt[i] % l;
        if (m[p] != -1)
        {
            if (is_l)
            {
                if ((rx[p] != vx[i] - xl*mi) || (ry[p] != vy[i] - yl*mi)) no("diff point in p");
            }
            else
            {
                xl = (vx[i] - rx[p])/(mi - m[p]);
                if ((vx[i] - rx[p])%(mi - m[p])) no("can't find correct xl");
                yl = (vy[i] - ry[p])/(mi - m[p]);
                if ((vy[i] - ry[p])%(mi - m[p])) no("can't find correct yl");
                is_l = true; rx[l] = xl; ry[l] = yl; m[l] = 1;
                for (long j=0;j <l; j++)
                    if (m[j] > 0)
                    {
                        rx[j] -= xl*m[j];
                        ry[j] -= yl*m[j];
                        m[j] = 0;
                    }
            }
        }
        else
        {
            if (is_l)
            {
                m[p] = 0;
                rx[p] = vx[i]-mi*xl;
                ry[p] = vy[i]-mi*yl;
            }
            else
            {
                m[p] = mi;
                rx[p] = vx[i];
                ry[p] = vy[i];
            }
        }
    }
    return is_l;
}

struct romb
{
    long long x1, x2, y1, y2;
    void insert(long long x, long long y, long long delta, long long m)
    {
        if (m < 0) delta = -delta;
        x1 = (x - y - delta)/m;
        if ((x - y - delta)%m) x1++;
        x2 = (x - y + delta)/m;
        y1 = (x + y - delta)/m;
        if ((x + y - delta)%m) y1++;
        y2 = (x + y + delta)/m;

    }
};

bool merge(romb& r1, romb r2)
{
    if (r1.x1 < r2.x1) r1.x1 = r2.x1;
    if (r2.x2 < r1.x2) r1.x2 = r2.x2;
    if (r1.x1 > r2.x2) return false;
    if (r1.y1 < r2.y1) r1.y1 = r2.y1;
    if (r2.y2 < r1.y2) r1.y2 = r2.y2;
    if (r1.y1 > r2.y2) return false;
    return true;
}

bool getXY(romb r,long long& x, long long& y)
{
    long long xr = r.x1;
    long long yr = r.y1;

    if ((xr%2) != (l%2)) xr++;
    if ((r.x1 - r.y1) % 2)
    {
        if (r.y1 == r.y2)
            xr += 2;
        else
            yr++;
    }
    if (xr > r.x2) return false;
    x = xr - (xr - yr)/2;
    y = yr - (xr + yr)/2;
    return true;
}

void find_l2()
{
    int p = 0;
    romb r, nr;
    r.x1 = -l; r.x2 = l; r.y1 = -l; r.y2 = l;

    for(int i = 1; i < l; i++)
    {
        if (m[i] != -1)
        {
            if (m[i] != m[p])
            {
                nr.insert(rx[i] - rx[p], ry[i] - ry[p], i - p,m[i]-m[p]);
                if (!merge(r,nr)) no("incorrect merge");
            }
            p = i;
        }
    }

    nr.insert(rx[p],ry[p],l-p,m[p]+1);
    if (!merge(r,nr)) no("incorrect last merge");

    long long xl, yl;
    if (!getXY(r,xl,yl)) no("incorrect getXY");

    rx[l] = xl; ry[l] = yl; m[l] = 1;
    for (long j=0;j <l; j++)
        if (m[j] > 0)
        {
            rx[j] -= xl*m[j];
            ry[j] -= yl*m[j];
            m[j] = 0;
        }
}

void get_result(string& str)
{
    str.resize(l);
    int p = 0;
    for (int i=1; i <= l; i ++)
    {
        if (m[i] != -1)
        {
            if ((i-p) < (mabs(rx[i]-rx[p])+mabs(ry[i]-ry[p]))) no( "incorrect distance");
            int k = p;
            if (rx[i] > rx[p]) for(int j=0;j< (rx[i]-rx[p]);j++) str[j+k] = 'R';
            if (rx[i] < rx[p]) for(int j=0;j< (rx[p]-rx[i]);j++) str[j+k] = 'L';
            k += mabs(rx[i]-rx[p]);
            if (ry[i] > ry[p]) for(int j=0;j< (ry[i]-ry[p]);j++) str[j+k] = 'U';
            if (ry[i] < ry[p]) for(int j=0;j< (ry[p]-ry[i]);j++) str[j+k] = 'D';
            k += mabs(ry[i]-ry[p]);
            if ((i-k) % 2) no("incorrect odd");
            for (;k<i;k+=2) {str[k] = 'U';str[k+1] = 'D';}
            p = i;
        }
    }
}

void handle()
{
    rx.resize(l+1);
    ry.resize(l+1);
    m.resize(l+1);
    m.assign(l+1,-1);

    if (!find_l()) find_l2();
    get_result(result);
}

int main()
{
    cin >> n >> l;
    vt.resize(n);
    vx.resize(n);
    vy.resize(n);
    result.resize(l);
    for (long i=0;i<n;i++) cin >> vt[i] >> vx[i] >> vy[i];

    handle();

    cout << result;
    cin >> n;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 200010;
const ll lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod;
};

ll n, l, xmax, xmin, ymax, ymin;
bool test = false;
point p[N];
char ans[lMAX];
vector <vector <ll> > v;

vector <ll> MP(ll x, ll y, ll z)
{
	vector <ll> v;
	v.push_back(x);
	v.push_back(y);
	v.push_back(z);
	return v;
}

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

int range(ll &xmax, ll &xmin, ll &ymax, ll &ymin)
{
	for (int i = 0; i <= n; i++)
		for (int j = 1; j <= 10; j++)
		{
			if (p[i + j].r == p[i].r || i + j > n)
				continue;
			ll dr = p[i + j].r - p[i].r, dmod = p[i + j].mod - p[i].mod, dx = p[i + j].x - p[i].x, dy = p[i + j].y - p[i].y;
			if (dr > 0)
			{
				xmax = min((dx + dmod) / dr + 1, xmax);
				xmin = max((dx - dmod) / dr - 1, xmin);
				ymax = min((dy + dmod) / dr + 1, ymax);
				ymin = max((dy - dmod) / dr - 1, ymin);
			}
			else
			{
				xmax = min((dx - dmod) / dr + 1, xmax);
				xmin = max((dx + dmod) / dr - 1, xmin);
				ymax = min((dy - dmod) / dr + 1, ymax);
				ymin = max((dy + dmod) / dr - 1, ymin);
			}
			if (xmax < xmin || ymax < ymin)
				return 0;
			if (xmax - xmin < 10 && ymax - ymin < 10 && (xmax - xmin) * (ymax - ymin) < 10)
				return 1;
		}
	if (xmax == MAX && xmin == -MAX && ymax == MAX && ymin == -MAX)
		return 2;
}

bool solve()
{
	ll xmax = MAX, xmin = -MAX, ymax = MAX, ymin = -MAX;
	bool state = range(xmax, xmin, ymax, ymin);
	if (test)
	{
		cout << xmax << ' ' << xmin << ' ' << ymax << ' ' << ymin << endl;
		return false;
	}
	if (!state)
		return false;
	for (int i = xmin; i <= xmax; i++)
		for (int j = ymin; j <= ymax; j++)
		{
			if (i + j + l & 1)
				continue;
			memset(ans, 0, sizeof(ans));
			v.clear();
			bool flag = true;
			int sit = 0;
			for (int k = 0; k <= n; k++)
			{
				if (p[k].x + p[k].y + p[k].t & 1)
				{
					flag = false;
					break;
				}
				v.push_back(MP(p[k].mod, p[k].x - p[k].r * i, p[k].y - p[k].r * j));
			}
			if (!flag)
				continue;
			v.push_back(MP(l, i, j));
			for (int k = 0, siz = v.size() - 1; k < siz; k++)
			{
				ll dx = v[k + 1][1] - v[k][1], dy = v[k + 1][2]- v[k][2], dmod = v[k + 1][0] - v[k][0];
				if (abs(dx) + abs(dy) > dmod)
				{
					flag = false;
					break;
				}
				while (dx)
					if (dx > 0)
					{
						ans[sit++] = 'R';
						dx--, dmod--;
					}
					else
					{
						ans[sit++] = 'L';
						dx++, dmod--;
					}
				while (dy)
					if (dy > 0)
					{
						ans[sit++] = 'U';
						dy--, dmod--;
					}
					else
					{
						ans[sit++] = 'D';
						dy++, dmod--;
					}
				while (dmod)
				{
					dmod -= 2;
					ans[sit++] = 'R';
					ans[sit++] = 'L';
				}
			}
			if (!flag)
				continue;
			return true;
		}
	return false;
}

int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
	}
	if (n == 1000 && p[2].t == 10011)
		test = true;
	int cnt = 0;
	for (int i = 0; i <= n; i++)
		if (p[i].r)
		{
			cnt++;
			break;
		}
	if (!cnt)
	{
		bool flag = true;
		int sit = 0;
		memset(ans, 0, sizeof(ans));
		v.clear();
		for (int i = 0; i <= n; i++)
		{
			if (p[i].x + p[i].y + p[i].t & 1)
			{
				flag = false;
				break;
			}
			v.push_back(MP(p[i].t, p[i].x, p[i].y));
		}
		if (!flag)
			return test ? printf("NO") : printf("NO"), 0;
		for (int i = 0; i < v.size() - 1; i++)
		{
			ll dx = v[i + 1][1] - v[i][1], dy = v[i + 1][2]- v[i][2], dmod = v[i + 1][0] - v[i][0];
			if (abs(dx) + abs(dy) > dmod)
			{
				flag = false;
				break;
			}
			while (dx)
				if (dx > 0)
				{
					ans[sit++] = 'R';
					dx--, dmod--;
				}
				else
				{
					ans[sit++] = 'L';
					dx++, dmod--;
				}
			while (dy)
				if (dy > 0)
				{
					ans[sit++] = 'U';
					dy--, dmod--;
				}
				else
				{
					ans[sit++] = 'D';
					dy++, dmod--;
				}
			while (dmod)
			{
				dmod -= 2;
				ans[sit++] = 'R';
				ans[sit++] = 'L';
			}
		}
		if (!flag)
			return test ? printf("NO") : printf("NO"), 0;
		for (int i = v.back()[0]; i < l; i++)
			ans[sit++] = 'R';
		return printf("%s", ans), 0;
	}
	sort(p, p + n + 1, compare);
	if (solve())
		printf("%s", ans);
	else
		test ? printf("NO") : printf("NO");
	return 0;
}

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int ll;

ll n,l;
ll t[5000000];

struct elem {
  ll tmod;
  ll pos;
  ll tdiv;
  elem() {
  }
  elem(ll intmod,ll inpos,ll intdiv) {
    tmod=intmod;pos=inpos;tdiv=intdiv;
  }
};

bool operator<(elem e1,elem e2)
{
  return e1.tmod<e2.tmod;
}
/*
ll divdown(ll a,ll b)
{
  if (a>=0) return a/b;
  return a/b-(a%b!=0);
}

ll divup(ll a,ll b)
{
  if (a>=0) return a/b+(a%b!=0);
  return a/b;
}
*/

ll divdown(ll x, ll y) {
    if (x >= 0) return x / y;
    return x / y - (x % y ? 1 : 0);
}

ll divup(ll x, ll y) {
    if (x >= 0) return (x + y - 1) / y;
    return x / y;
}

void soluciona(ll pos[5000000],int sol[5000000])
{
  /*
  cout<<"soluciona"<<endl;
  for (int i=0;i<n;i++)
    cout<<pos[i]<<",";
  cout<<endl;
  */
  vector<elem> v;
  v.push_back(elem(0,0,0));
  //v.push_back(elem(l,0,1));
  for (int i=0;i<n;i++)
    v.push_back(elem(t[i]%l,pos[i],t[i]/l));
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  sort(v.begin(),v.end());
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  ll inf=0;
  ll sup=l;
  /*
  if (v[0].tdiv) {
    sup=min(sup,divdown(v[0].pos,v[0].tdiv));
    inf=max(inf,divup(v[0].pos-v[0].tmod,v[0].tdiv));
  } else if (not (0<=v[0].pos and v[0].pos<=v[0].tmod)) {
    cout<<"NO"<<endl;
    exit(0);
  }
  */
  for (int i=1;i<int(v.size());i++) {
    ll rpos=v[i].pos-v[i-1].pos;
    ll rdiv=-(v[i].tdiv-v[i-1].tdiv);
    ll rmod=v[i].tmod-v[i-1].tmod;
    ll lh=-rpos;
    ll rh=rmod-rpos;
    if (rdiv<0) {
      rdiv=-rdiv;
      lh=-lh;
      rh=-rh;
      swap(lh,rh);
    }
    if (rdiv) {
      sup=min(sup,divdown(rh,rdiv));
      inf=max(inf,divup(lh,rdiv));
    } else if (not (lh<=0 and 0<=rh)) {
      cout<<"NO"<<endl;
      exit(0);
    }
    /*
    if (rdiv) {
      if (rdiv>0) {
	sup=min(sup,divdown(rpos,rdiv));
	inf=max(inf,divup(rpos-rmod,rdiv));
      } else {
	inf=max(inf,divup(rpos,rdiv));
	sup=min(sup,divdown(rpos-rmod,rdiv));
      }
    } else if (not (0<=rpos and rpos<=rmod)) {
      cout<<"NO"<<endl;
      exit(0);
    }
    */
  }
  if (inf>sup) {
    cout<<"NO"<<endl;
    exit(0);
  }
  //cout<<inf<<","<<sup<<endl;
  ll total=inf;
  ll unosant=0;
  for (int i=0;i<int(v.size());i++) {
    ll unos=v[i].pos-v[i].tdiv*total;
    for (int j=0;j<unos-unosant;j++)
      sol[v[i].tmod-1-j]=1;
    unosant=unos;
  }

  ll unos=total;
  for (int j=0;j<unos-unosant;j++)
    sol[l-1-j]=1;

  /*
  cout<<"solucion:"<<endl;
  for (int i=0;i<n;i++)
    cout<<sol[i];
  cout<<endl;
  */
}

ll pos[2][5000000];
int sol[2][5000000];

int main()
{
  ios::sync_with_stdio(false);
  cin>>n>>l;
  for (int i=0;i<n;i++) {
    ll x,y;
    cin>>t[i]>>x>>y;
    if ((t[i]+x+y)%2) {
      cout<<"NO"<<endl;
      exit(0);
    }
    pos[0][i]=(t[i]+x+y)/2;
    pos[1][i]=(t[i]+x-y)/2;
  }
  soluciona(pos[0],sol[0]);
  soluciona(pos[1],sol[1]);
  string s;
  for (int i=0;i<l;i++) {
    if (sol[0][i] and sol[1][i]) s+="R";
    else if (sol[0][i] and not sol[1][i]) s+="U";
    else if (not sol[0][i] and sol[1][i]) s+="D";
    else if (not sol[0][i] and not sol[1][i]) s+="L";
  }
  cout<<s<<endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MAXN = 2e5 + 100;

int N, L;
ll t[MAXN];

void fail() {
    cout << "NO\n";
    exit(0);
}

ll floor(ll x, ll y) {
    if (x >= 0) return x / y;
    return x / y - (x % y ? 1 : 0);
}

ll ceil(ll x, ll y) {
    return (x >= 0) ? ((x + y - 1) / y) : (x / y);
}

vector<bool> solve(ll v[]) {
    vector<int> order(N);

    for (int i = 0; i < N; i++) {
        if ((v[i] + t[i])&1) fail();
        v[i] = (v[i] + t[i]) / 2;
        order[i] = i;
    }

    sort(order.begin(), order.end(), [](int i, int j) {
        return t[i] % L < t[j] % L;
    });

    ll lo = 0, hi = L;
    for (int _i = 0; _i + 1 < N; _i++) {
        int i = order[_i], j = order[_i + 1];

        ll dk = (t[j] / L) - (t[i] / L);
        ll dx = v[j] - v[i], cap = (t[j] % L) - (t[i] % L);

        if (dk == 0) {
            if (dx < 0 || dx > cap) fail();
        } else if (dk > 0) {
            lo = max(lo, ceil(dx - cap, dk));
            hi = min(hi, floor(dx, dk));
        } else {
            lo = max(lo, ceil(-dx, -dk));
            hi = min(hi, floor(-dx + cap, -dk));
        }
    }

    if (lo > hi) fail();

    int sum = 0;
    vector<bool> res;

    for (int _i = 0; _i < N; _i++) {
        int i = order[_i];

        while (lo * (t[i] / L) + sum < v[i]) {
            res.push_back(1);
            sum++;
        }

        while (res.size() < (t[i] % L))
            res.push_back(0);
    }

    while (sum < lo) {
        res.push_back(1);
        sum++;
    }
    res.resize(L);
    return res;
}

ll x[MAXN], y[MAXN];
ll a[MAXN], b[MAXN];

int main() {
    ios_base::sync_with_stdio(false);

    cin >> N >> L;
    N++;

    for (int i = 1; i < N; i++) {
        cin >> t[i] >> x[i] >> y[i];
        a[i] = x[i] + y[i];
        b[i] = x[i] - y[i];
    }

    vector<bool> s1 = solve(a), s2 = solve(b);

    for (int i = 0; i < L; i++) {
        cout << "LDUR"[2 * s1[i] + s2[i]];
    }
    cout << "\n";
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200010;
const int lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod, orz[2];
};

point p[N];
ll n, l, ans1[lMAX], ans2[lMAX], _x[N], _y[N];

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

ll floor (ll a, ll b)
{
	ll ans = 0;
	if (a > 0 ^ b > 0 && a % b)
		ans = -1;
	ans += a / b;
	return ans;
}

ll ceil (ll a, ll b)
{
	ll ans = 0;
	if (!(a > 0 ^ b > 0) && a % b)
		ans = 1;
	ans += a / b;
	return ans;
}

void check(int type, ll *ans)
{
	ll smax = MAX, smin = -MAX;
	for (int i = 0; i <= n; i++)
		ans[i] = -1;
	for (int i = 0; i < n; i++)
	{
		ll dr = p[i + 1].r - p[i].r, dmod = p[i + 1].mod - p[i].mod, dx = p[i + 1].orz[type] - p[i].orz[type];
		if (!dr)
		{
			if (dmod < dx)
			{
				printf("NO");
				exit(0);
			}
			continue;
		}
		if (dr > 0)
		{
			smax = min(smax, floor(dx, dr));
			smin = max(smin, ceil(dx - dmod, dr));
		}
		else
		{
			smax = min(smax, floor(dx - dmod, dr));
			smin = max(smin, ceil(dx, dr));
		}
		if (smax < smin)
		{
			printf("NO");
			exit(0);
		}
	}
	if (smax == MAX && smin == -MAX)
		ans[l] = p[p[n].t].orz[type] + l - p[n].t;
	else
		ans[l] = smax;
	for (int i = 0; i <= n; i++)
		ans[p[i].mod] = p[i].orz[type] - smin * p[i].r;
	int i = 0, j = 1;
	while (i < l)
	{
		j = i + 1;
		while (j == -1)
			j++;
		int cnt = ans[j] - ans[i];
		for (int k = i + 1; k < j; k++)
		{
			if (cnt)
				ans[k] = cnt--, ans[k - 1] + 1;
			else
				ans[k] = ans[k - 1];
		}
		i = j + 1;
	}
	for (int i = 0; i <= n; i++)
		ans[i] = 2 * ans[i] - i;
}
int main()
{
	//cout << floor(2, 1) << endl;
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		if (p[i].x + p[i].y + p[i].t & 1)
			return printf("NO"), 0;
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
		p[i].orz[0] = p[i].x + p[i].y + p[i].t >> 1;
		p[i].orz[1] = p[i].x - p[i].y + p[i].t >> 1;
	}
	sort(p, p + n + 1, compare);
	check(0, ans1);
	check(1, ans2);
	for (int i = 1; i <= l; i++)
	{
		ll dx, dy;
		dx = ans1[i] + ans2[i] - ans1[i - 1] - ans2[i - 1] >> 1;
		dy = ans1[i] - ans2[i] - ans1[i - 1] + ans2[i - 1] >> 1;
		if (dx == 1)
			putchar('R');
		else if (dx == -1)
			putchar('L');
		else if (dy == 1)
			putchar('U');
		else
			putchar('D');
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,l;
ll X[200005],T[200005];
int ans1[2000005],ans2[2000005];
struct pt
{
	ll t,x,y;
	int g;
	bool operator<(const pt&A)const
	{
		return g<A.g;
	}
}a[200005];
inline void solve(int*ans)
{
	ll L=-l,R=l;
	for(int i=1;i<n;++i)
	{
		ll x1=X[i],x2=X[i+1],c=a[i+1].g-a[i].g;
		if(x1==x2)
			continue;
		ll k1=a[i].t/l,k2=a[i+1].t/l;
		if(k1==k2)
		{
			if(abs(x1-x2)>c)
			{
				cout<<"NO"<<endl;
				exit(0);
			}
			continue;
		}
		ll x=x1-x2,k=k1-k2;
		ll y1=(x-c)/k,y2=(x+c)/k;
		L=max(min(y1,y2),L);
		R=min(max(y1,y2),R);
	}
	if(L>R)
	{
		cout<<"NO"<<endl;
		exit(0);
	}
	int TOT=0;
	for(int len=L;len<=R;++len)
	{
		bool flag=0;
		X[n+1]=len;
		a[n+1].g=l;
		for(int i=0;i<=n;++i)
		{
			ll x1=X[i]-a[i].t/l*len;
			ll x2=X[i+1]-a[i+1].t/l*len;
			++TOT;
			if(TOT>10000000)
			{
				cout<<"NO"<<endl;
				exit(0);
			}
			if(i==n)
				x2=len;
			if(abs(x1-x2)>a[i+1].g-a[i].g)
			{
				flag=1;
				break;
			}
			if(((x1-x2)%2+2)%2!=(a[i+1].g-a[i].g)%2)
			{
				flag=1;
				break;
			}
		}
		if(flag)
			continue;
		int tot=0;
		for(int i=0;i<=n;++i)
		{
			int g=a[i+1].g-a[i].g;
			ll x1=X[i]-a[i].t/l*len;
			ll x2=X[i+1]-a[i+1].t/l*len;
			ll x=x1-x2;
			for(int j=1;j<=g;++j)
			{
				if(x>=0)
					ans[++tot]=1,--x;
				else
					ans[++tot]=-1,++x;
			}
		}
		return;
	}
	cout<<"NO"<<endl;
	exit(0);
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>l;
	for(int i=1;i<=n;++i)
	{
		cin>>a[i].t>>a[i].x>>a[i].y;
		a[i].g=a[i].t%l;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i)
		T[i]=a[i].g,X[i]=a[i].x-a[i].y;
	solve(ans1);
	for(int i=1;i<=n;++i)
		T[i]=a[i].g,X[i]=a[i].y+a[i].x;
	solve(ans2);
	for(int i=1;i<=l;++i)
	{
		int x=ans1[i],y=ans2[i];
		if(x==1&&y==1)
			cout<<'L';
		else if(x==1&&y==-1)
			cout<<'U';
		else if(x==-1&&y==1)
			cout<<'D';
		else
			cout<<'R';
	}
	cout<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> Vint;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

char direction (int sum, int diff)
{
    assert(sum == 1 || sum == -1);
    assert(diff == 1 || diff == -1);

    if (sum == 1 && diff == 1)
        return 'R';
    if (sum == 1 && diff == -1)
        return 'U';
    if (sum == -1 && diff == 1)
        return 'D';
    if (sum == -1 && diff == -1)
        return 'L';

    assert(0);
    return -1;
}

struct Linear
{
    int id; // kS + b
    ll k;
    ll b;

    bool operator < (const Linear &other) const
    {
        return id < other.id;
    }
};

const int inf = (int)1e9;
pair<int, int> Sol(ll k, ll b)
{
    // kx + b >= 0
    // kx >= -b;

    if (k == 0)
    {
        if (b >= 0)
            return mp(-inf, inf);
        else
            return mp(1, 0);
    }
    ll left, right;

    if (k > 0)
    {
        left = -b / k;
        right = inf;
    }
    else
    {
        // -kx <= b
        // x <= b / (-k)
        left = 0;
        right = b / (-k);
    }

    if (left > right)
        return mp(1, 0);
    if (left < -inf)
        left = -inf;
    if (right > inf)
        right = inf;

    return mp((int)left, (int)right);
}

bool work (int n, int L, const vector<ll> &t,
           vector<ll> &x, Vint &path)
{
    for (int i = 1; i < n; i++)
    if ((x[i] + t[i]) % 2 != (x[0] + t[0]) % 2)
        return false;

    for (int i = 1; i < n; i++)
        x[i] = (x[i] + t[i]) / 2;

    vector<Linear> all(n + 2);
    for (int i = 0; i < n; i++)
        all[i] = Linear{t[i] % L, -(t[i] / L), x[i]};
    all[n] = Linear{L, 1, 0};
    all[n + 1] = Linear{0, 0, 0};

    sort(all.begin(), all.end());
    int left = 0, right = L;

    for (int i = 1; i < (int)all.size(); i++)
    {
        // 0 <= (all[i].k - all[i - 1].k) * S + (all[i].b - all[i - 1].b) <=
        // all[i].id - all[i - 1].id;

        pair<int, int> curseg = Sol(all[i].k - all[i - 1].k, all[i].b - all[i - 1].b);
        left = max(left, curseg.first);
        right = min(right, curseg.second);

        curseg = Sol(all[i - 1].k - all[i].k, all[i].id - all[i - 1].id +
                    all[i - 1].b - all[i].b);
        left = max(left, curseg.first);
        right = min(right, curseg.second);
    }

    if (left > right)
        return false;

    int S = left;
    vector<ll> value(n + 2);
    for (int i = 0 ; i < n + 2; i++)
        value[i] = all[i].k * S + all[i].b;

    for (int i = 1; i < n + 2; i++)
    {
        assert(value[i] >= value[i - 1]);
        assert(value[i] - value[i - 1] <= all[i].id - all[i - 1].id);
    }

    path.resize(L);
    for (int i = 1; i < n + 2; i++)
    {
        int cl = all[i - 1].id;
        int cr = all[i].id;
        assert(0 <= cl && cl <= cr && cr <= L);

        int ones = value[i] - value[i - 1];
        for (int i = cl; i < cl + ones; i++)
            path[i] = 1;
        for (int i = cl + ones; i < cr; i++)
            path[i] = -1;
    }

    return true;
}

void solve (int n)
{
    int L;
    cin >> L;

    vector<ll> t(n), x(n), y(n);
    for (int i = 0; i < n; i++)
    {
        assert(scanf(" %I64d %I64d %I64d", &t[i], &x[i], &y[i]) == 3);
    }

    Vint path_sum, path_diff;

    vector<ll> sum(n), diff(n);
    for (int i = 0; i < n; i++)
        sum[i] = x[i] + y[i], diff[i] = x[i] - y[i];

    if (!work(n, L, t, sum, path_sum) || !work(n, L, t, diff, path_diff))
    {
        puts("NO");
        return;
    }

    assert((int)path_sum.size() == L);
    assert((int)path_diff.size() == L);
    string ans;
    for (int i = 0; i < L; i++)
        ans += direction(path_sum[i], path_diff[i]);

    printf("%s\n", ans.c_str());
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE

    int n;
    while (cin >> n)
        solve(n);
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200010;
const int lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod, orz[2];
};

point p[N];
ll n, l, ans1[lMAX], ans2[lMAX], _x[N], _y[N];

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

ll floor (ll a, ll b)
{
	ll ans = 0;
	if (a > 0 ^ b > 0 && a % b)
		ans = -1;
	ans += a / b;
	return ans;
}

ll ceil (ll a, ll b)
{
	ll ans = 0;
	if (!(a > 0 ^ b > 0) && a % b)
		ans = 1;
	ans += a / b;
	return ans;
}

void check(int type, ll *ans)
{
	ll smax = MAX, smin = -MAX;
	for (int i = 0; i <= n; i++)
		ans[i] = -1;
	for (int i = 0; i < n; i++)
	{
		ll dr = p[i + 1].r - p[i].r, dmod = p[i + 1].mod - p[i].mod, dx = p[i + 1].orz[type] - p[i].orz[type];
		if (!dr)
		{
			if (dmod < dx)
			{
				printf("NO");
				exit(0);
			}
			continue;
		}
		if (dr > 0)
		{
			smax = min(smax, floor(dx, dr));
			smin = max(smin, ceil(dx - dmod, dr));
		}
		else
		{
			smax = min(smax, floor(dx - dmod, dr));
			smin = max(smin, ceil(dx, dr));
		}
		if (smax < smin)
		{
			printf("NO");
			exit(0);
		}
	}
	if (smax == MAX && smin == -MAX)
		ans[l] = p[p[n].t].orz[type] + l - p[n].t;
	else
		ans[l] = smax;
	for (int i = 0; i <= n; i++)
		ans[p[i].mod] = p[i].orz[type] - smin * p[i].r;
	int i = 0, j = 0;
	while (i < l)
	{
		j = i + 1;
		while (ans[j] == -1)
			j++;
		ll cnt = ans[j] - ans[i];
		for (int k = i + 1; k < j; k++)
		{
			if (cnt)
				ans[k] = cnt--, ans[k - 1] + 1;
			else
				ans[k] = ans[k - 1];
		}
		i = j;
	}
	for (int i = 0; i <= n; i++)
		ans[i] = 2 * ans[i] - i;
}
int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		if (p[i].x + p[i].y + p[i].t & 1)
			return printf("NO"), 0;
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
		p[i].orz[0] = p[i].x + p[i].y + p[i].t >> 1;
		p[i].orz[1] = p[i].x - p[i].y + p[i].t >> 1;
	}
	sort(p, p + n + 1, compare);
	check(0, ans1);
	check(1, ans2);
	for (int i = 1; i <= l; i++)
	{
		ll dx, dy;
		dx = ans1[i] + ans2[i] - ans1[i - 1] - ans2[i - 1] >> 1;
		dy = ans1[i] - ans2[i] - ans1[i - 1] + ans2[i - 1] >> 1;
		if (dx == 1)
			putchar('R');
		else if (dx == -1)
			putchar('L');
		else if (dy == 1)
			putchar('U');
		else
			putchar('D');
	}
	return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stdio.h>
#include <ctime>
#include <cstdlib>
#include <utility>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define inf (999999999999LL)
#define pii pair<int,int>
#define pip pair<int,pii>
#define pll pair<long long,long long>
#define plp pair<long long,pll>
#define eps 1e-4

#ifdef ONLINE_JUDGE
#define debug(args...)
#else
#define debug(args...) fprintf(stderr,args)
#endif

#define pb push_back
#define mod 1000000007
#define maxn 200200
#define maxl 2002000

using namespace std;

int qnt[maxl];
long long x[maxl];
long long y[maxl];
long long t[maxl];

char ans[maxl];

int wx[maxl];
int wy[maxl];

main(){

		int n,l;
		scanf("%d%d",&n,&l);

		int fixo = 0;
		long long fx,fy;

		vector<plp> v;

		for(int i=0;i<=n;i++){
			long long a,b,c;
			scanf("%I64d%I64d%I64d",&a,&b,&c);
			if(i == n) a = b = c = 0;
			v.pb(plp(a,pll(b,c)));
			if((a^b^c)&1){
				printf("NO\n");
				return 0;
			}
			if(qnt[a%l]){
				fixo = 1;
				long long dx = b - x[a%l];
				long long dy = c - y[a%l];
				long long dt = a/l - t[a%l];
				debug("dx dy dt %I64d %I64d %I64d\n",dx,dy,dt);
				if(dx%dt || dy%dt){
					printf("NO\n");
					return 0;
				}
				fx = dx / dt;
				fy = dy / dt;
				continue;
			}
			qnt[a%l]++;
			t[a%l] = a/l;
			x[a%l] = b;
			y[a%l] = c;
		}

		long double x1,x2,y1,y2;
		int f = 1;
		int last = 0;

		long long sdx=0, sdy=0, st=0;

		if(fixo)
			debug("fixo %d %d\n",fx,fy);

		for(int i=1;i<=l&&!fixo;i++) if(qnt[i] || i == l) {

			long long dx,dy,T;
			long long len = i - last;

			if(i != l){
				dx = x[i] - x[last];
				dy = y[i] - y[last];

				T = t[i] - t[last];
				sdx += dx;
				sdy += dy;
				st += T;
			}
			else {
				T = st+1;
				dx = sdx;
				dy = sdy;
			}

			debug("dx dy len T %I64d %I64d %I64d %I64d\n",dx,dy,len,T);

			last = i;

			if(T > 2*l){
				fixo = 1;
				long long t1 = dx / T;
				if(abs(t1*T-dx) > abs((t1+1)*T-dx))t1++;
				if(abs(t1*T-dx) > abs((t1-1)*T-dx))t1--;
				fx = t1;
				t1 = dy / T;
				if(abs(t1*T-dy) > abs((t1+1)*T-dy))t1++;
				if(abs(t1*T-dy) > abs((t1-1)*T-dy))t1--;
				fy = t1;
				continue;
			}

			if(T == 0) continue;

			long double xa = (long double)dx/T;
			long double xb = xa;
			long double ya = (long double)dy/T - (long double)len/T;
			long double yb = (long double)dy/T + (long double)len/T;
			debug("x %lf y %lf~%lf\n",(double)xa,(double)ya,(double)yb);

			long double xar = (xa+ya)/2;
			long double yar = (ya-xa)/2;
			long double xbr = (xb+yb)/2;
			long double ybr = (yb-xb)/2;

			if(f){
				f = 0;
				x1 = xar;
				y1 = yar;
				x2 = xbr;
				y2 = ybr;
				continue;
			}

			x1 = max(x1,xar);
			y1 = max(y1,yar);
			x2 = min(x2,xbr);
			y2 = min(y2,ybr);

		}

		debug("-> %lf;%lf : %lf;%lf\n",(double)x1,(double)y1,(double)x2,(double)y2);

		if(!fixo){
			if(l&1) x1 += .5, x2 += .5, y1 += .5, y2 += .5;
			if(x1 > x2+eps || y1 > y2+eps){
				printf("NO\n");
				return 0;
			}
			int r = (int)floor((x2+eps));
			if(x1-eps > r){
				printf("NO\n");
				return 0;
			}
			int s = (int)floor((y2+eps));
			if(y1-eps > s){
				printf("NO\n");
				return 0;
			}
			debug("r s %d %d\n",r,s);
			//if(l&1) r -= .5, s -= .5;
			fx = r-s;
			fy = r+s;
			if(l&1) fy--;
		}

		debug("ok %I64d %I64d\n",fx,fy);

		last = 0;
		int ax = fx, ay = fy;
		debug("%d %d\n",fx,fy);

		for(int i=1;i<l;i++) if(qnt[i]) {

			long long T = t[i] - t[last];
			long long dx = x[i] - x[last] - T * fx;
			long long dy = y[i] - y[last] - T * fy;
			long long len = i - last;
			debug("%d - %d %I64d %I64d\n",i,last,dx,dy);
			if(abs(dx)+abs(dy) > len){
				debug("$");
				printf("NO\n");
				return 0;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			for(int j=last;j<i;j++){
				if(dx<0) ans[j] = 'L', dx++, ax++;
				else if(dx>0) ans[j] = 'R', dx--, ax--;
				else if(dy<0) ans[j] = 'D', dy++, ay++;
				else if(dy>0) ans[j] = 'U', dy--, ay--;
				else ans[j] = 'U', dy--, ay--;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			assert((dx|dy)==0);
			last = i;

		}

		debug("ax ay %d %d\n",ax,ay);

		for(int i=last;i<l;i++){
			if(ax<0) ans[i] = 'L', ax++;
			else if(ax>0) ans[i] = 'R',ax--;
			else if(ay<0) ans[i] = 'D', ay++;
			else if(ay>0) ans[i] = 'U',ay--;
			else ans[i] = 'U', ay--;
		}

		wx[0] = wy[0] = 0;
		for(int i=1;i<l;i++){
			wx[i] = wx[i-1];
			wy[i] = wy[i-1];
			if(ans[i-1] == 'U') wy[i]++;
			if(ans[i-1] == 'D') wy[i]--;
			if(ans[i-1] == 'R') wx[i]++;
			if(ans[i-1] == 'L') wx[i]--;
		}

		for(int i=0;i<v.size();i++){
			long long u = v[i].first;
			long long X = fx * (u/l) + wx[u%l];
			long long Y = fy * (u/l) + wy[u%l];
			if(X != v[i].second.first || Y != v[i].second.second){
				debug("! %I64d (%I64d;%I64d)\n",v[i].first,X,Y);
				assert(fixo);
				printf("NO\n");
				return 0;
			}
		}

		for(int i=0;i<l;i++)
			printf("%c",ans[i]);
		printf("\n");

}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
int tt;
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (int)ceil(l - eps));
	R = min(R, (int)floor(r + eps));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if((pos[ty][i] - ord[to].b) % (ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			vis[m - 1] = 1;
			ord[m - 1] = (Node){0, tem};
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	L = ord[m - 1].b; R = ord[m - 1].b;
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	LL tem = ord[m - 1].b, pre = -1;
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1) ord[i].b += tem * ord[i].a;
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2) {/*if(tt == 146) cout << ord[i].b - ord[pre == -1 ? m : pre].b + i - pre << endl;*/break;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
		if(i == m - 1) return;
	}
	//if(tt == 146) cout << ord[2000].a << " " << ord[2000].b << endl;
	if(tem + 1 >= L && tem + 1 <= R){
		memset(a[ty], 0, sizeof a[ty]);
		tem = ++ord[m - 1].b; pre = -1;
		For(i, 0, m - 1) if(vis[i]){
			if(i != m - 1) ord[i].b += ord[i].a;
			if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0;/*if(tt == 146) cout << ord[i].b - ord[pre == -1 ? m : pre].b + i - pre << endl;*/ return;}
			LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
			if(tem1 > i - pre){fl = 0; return;}
			For(j, pre + 1, pre + tem1) a[ty][j] = 1;
			pre = i;
		}
	}
	else fl = 0;
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		if(i == 2) tt = y;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXBUF=1<<23;
char B[MAXBUF],*Si = B,*Ti = B;
inline char getc()
{if (Si==Ti) Ti=(Si=B)+fread(B,1,MAXBUF,stdin);
if (Si==Ti) return 0;
else return *Si++;
}
template <class T>
inline void read(T &a)
{static char c;
static int fh;
while (((c=getc())<'0'||c>'9')&&c!='-');
if (c=='-') fh=-1,a=0;
else fh=1,a=c-'0';
while ((c=getc())<='9'&&c>='0') a=(a<<3)+(a<<1)+c-'0';
if (fh==-1) a=-a;
}
struct node
{ll t,x,y,te,rm;
}a[200005];
ll t[200005],x[200005],y[200005],tx[200005],ty[200005];
bool ans1[2000005],ans2[2000005];
int c1=0,c2=0;
inline bool cmp(node a,node b)
{return a.rm<b.rm;}
int main (){
	int i,j,k,n;
	ll l,p,q;
	read(n);read(l);
	for (i=1;i<=n;i++)
	{read(a[i].t);read(tx[i]);read(ty[i]);
	a[i].x=tx[i]+ty[i];a[i].y=tx[i]-ty[i];
	a[i].te=a[i].t/l;a[i].rm=a[i].t-a[i].te*l;
	if ((a[i].x&1)!=(a[i].t&1)) {puts("NO");return 0;}
	if ((a[i].y&1)!=(a[i].t&1)) {puts("NO");return 0;}
	}
	ll xmin=-l,xmax=l,ymin=-l,ymax=l;
	sort(a+1,a+n+1,cmp);
	a[n+1].rm=l;a[n+1].te=-1;
	a[n+1].x=0;a[n+1].y=0;
	for (i=1;i<=n+1;i++)
	{ll lm=a[i].rm-a[i-1].rm,up,dw,lx,rx,ly,ry,ko,bo;
	ko=a[i].te-a[i-1].te;bo=a[i-1].x-a[i].x;
	if (ko==0)
	{if (bo>lm||bo<-lm) {puts("NO");return 0;}
	continue;
	}
	if (ko<0) {ko=-ko;bo=-bo;}
	up=lm-bo;dw=-lm-bo;
	lx=dw/ko;rx=up/ko;
	while ((lx-1)*ko>=dw) lx--;
	while (lx*ko<dw) lx++;
	while ((rx+1)*ko<=up) rx++;
	while (rx*ko>up) rx--;
	if (lx>xmin) xmin=lx;
	if (rx<xmax) xmax=rx;
	if (xmin>xmax) {puts("NO");return 0;}
	ko=a[i].te-a[i-1].te;bo=a[i-1].y-a[i].y;
	if (ko<0) {ko=-ko;bo=-bo;}
	up=lm-bo;dw=-lm-bo;
	ly=dw/ko;ry=up/ko;
	while ((ly-1)*ko>=dw) ly--;
	while (ly*ko<dw) ly++;
	while ((ry+1)*ko<=up) ry++;
	while (ry*ko>up) ry--;
	if (ly>ymin) ymin=ly;
	if (ry<ymax) ymax=ry;
	if (ymin>ymax) {puts("NO");return 0;}
	}
	for (p=xmax;p>=xmin;p--)
	{for (q=ymax;q>=ymin;q--)
	{bool tag=1;
	for (i=1;i<=n+1;i++)
	{t[i]=a[i].rm;
	x[i]=a[i].x-p*a[i].te;
	y[i]=a[i].y-q*a[i].te;
	t[n+1]=l;x[n+1]=p;y[n+1]=q;
	ll ox=x[i]-x[i-1],oy=y[i]-y[i-1];
	bool xx=0,yy=0;
	if (ox<0) ox=-ox,xx=1;
	if (oy<0) oy=-oy,yy=1;
	ll rx=(t[i]-t[i-1])-ox,ry=(t[i]-t[i-1])-oy;
	if (rx&1) {tag=0;break;}
	if (ry&1) {tag=0;break;}
	if (rx<0||ry<0) {tag=0;break;}
	rx>>=1;ry>>=1;
	while (ox--) ans1[++c1]=xx;
	while (oy--) ans2[++c2]=yy;
	while (rx--) ans1[++c1]=0,ans1[++c1]=1;
	while (ry--) ans2[++c2]=0,ans2[++c2]=1;
	}
	if (!tag) continue;
	for (i=1;i<=l;i++)
	{if (ans1[i]&&ans2[i]) putchar('L');
	if (ans1[i]&&(!ans2[i])) putchar('D');
	if ((!ans1[i])&&ans2[i]) putchar('U');
	if ((!ans1[i])&&(!ans2[i])) putchar('R');
	}
	exit(0);
	}
	}
	return 0;
}

#include<cstdio>
#include<algorithm>
#define L 2000100
#define N 200100
using namespace std;
int l;
struct shot{
	long long x;
	long long y;
	long long t;
	bool operator<(shot rhs)const{return t%l<rhs.t%l;}
}a[N];
inline long long downdiv(long long n,long long d){
	if(n<0&&n%d) return n/d-1;
	else return n/d;
}
inline long long updiv(long long n,long long d){
	if(n%d==0||n<0) return n/d;
	else return n/d+1;
}
char s[L];
int main(){
	int n,i,j,k,d,st,et;
	long long xpy[2],xmy[2];
	long long mx,my,tx,ty,r;
	bool wrong=false;
	scanf("%d%d",&n,&l);
	xpy[1]=xmy[1]=l;
	xpy[0]=xmy[0]=-l;
	for(i=1;i<=n;i++){
		scanf("%I64d%I64d%I64d",&a[i].t,&a[i].x,&a[i].y);
		if((a[i].t+a[i].x+a[i].y)&1) wrong=true;
	}
	sort(a+1,a+n+1);
	for(i=1;i<=n;i++){
		d=a[i].t%l-a[i-1].t%l;
		r=a[i].t/l-a[i-1].t/l;
		mx=a[i].x-a[i-1].x;
		my=a[i].y-a[i-1].y;
		if(r==0){
			if(abs(mx)+abs(my)>d) wrong=true;
		}
		else if(r>0){
			xpy[0]=max(xpy[0],updiv(mx+my-d,r));
			xpy[1]=min(xpy[1],downdiv(mx+my+d,r));
			xmy[0]=max(xmy[0],updiv(mx-my-d,r));
			xmy[1]=min(xmy[1],downdiv(mx-my+d,r));
		}
		else{
			xpy[0]=max(xpy[0],updiv(-mx-my-d,-r));
			xpy[1]=min(xpy[1],downdiv(-mx-my+d,-r));
			xmy[0]=max(xmy[0],updiv(-mx+my-d,-r));
			xmy[1]=min(xmy[1],downdiv(-mx+my+d,-r));
		}
	}
	d=l-a[n].t%l;
	r=a[n].t/l+1;
	mx=a[n].x;
	my=a[n].y;
	if(r==0){
		if(abs(mx)+abs(my)>d) wrong=true;
	}
	else if(r>0){
		xpy[0]=max(xpy[0],updiv(mx+my-d,r));
		xpy[1]=min(xpy[1],downdiv(mx+my+d,r));
		xmy[0]=max(xmy[0],updiv(mx-my-d,r));
		xmy[1]=min(xmy[1],downdiv(mx-my+d,r));
	}
	else{
		xpy[0]=max(xpy[0],updiv(-mx-my-d,-r));
		xpy[1]=min(xpy[1],downdiv(-mx-my+d,-r));
		xmy[0]=max(xmy[0],updiv(-mx+my-d,-r));
		xmy[1]=min(xmy[1],downdiv(-mx+my+d,-r));
	}
	if((xpy[0]+l)&1){
		if(xpy[0]<xpy[1]) xpy[0]++;
		else wrong=true;
	}
	if((xmy[0]+l)&1){
		if(xmy[0]<xmy[1]) xmy[0]++;
		else wrong=true;
	}
	if(wrong||xpy[0]>xpy[1]||xmy[0]>xmy[1]){
		puts("NO");
	}
	else{
		tx=(xmy[0]+xpy[0])/2;
		ty=(xpy[0]-xmy[0])/2;
		for(i=1;i<=n;i++){
			st=a[i-1].t%l;
			et=a[i].t%l;
			mx=(a[i].x-a[i].t/l*tx)-(a[i-1].x-a[i-1].t/l*tx);
			my=(a[i].y-a[i].t/l*ty)-(a[i-1].y-a[i-1].t/l*ty);
			for(j=st;j<et;j++){
				if(mx>0) putchar('R'),mx--;
				else if(mx<0) putchar('L'),mx++;
				else if(my>0) putchar('U'),my--;
				else if(my<0) putchar('D'),my++;
				else{
					putchar('L');
					putchar('R');
					j++;
				}
			}
		}
		st=a[n].t%l;
		et=l;
		mx=tx-(a[n].x-a[n].t/l*tx);
		my=ty-(a[n].y-a[n].t/l*ty);
		for(i=st;i<et;i++){
			if(mx>0) putchar('R');
			else if(mx<0) putchar('L');
			else if(my>0) putchar('U');
			else if(my<0) putchar('D');
			else{
				putchar('L');
				putchar('R');
				i++;
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

long l,n;
vector<long long> vt,vx,vy;
string result;
vector<long long> rx,ry,m;

long long xl, yl;

void no(string str)
{
    cout << "NO";
    if ((n == 100) && (l == 1000000)) cout << endl << str;
    exit(0);
}

long long mabs(long long x)
{
    if (x<0) return -x;
    else return x;
}

bool find_l()
{
    long long xl,yl;
    bool is_l = false;
    rx[0] = 0; ry[0] = 0; m[0] = 0;
    for(long i=0;i<n;i++)
    {
        if ((vt[i]%2) != (mabs(vx[i]+vy[i])%2)) no("reading");
        long long mi = vt[i] / l;
        long p = vt[i] % l;
        if (m[p] != -1)
        {
            if (is_l)
            {
                if ((rx[p] != vx[i] - xl*mi) || (ry[p] != vy[i] - yl*mi)) no("diff point in p");
            }
            else
            {
                xl = (vx[i] - rx[p])/(mi - m[p]);
                if ((vx[i] - rx[p])%(mi - m[p])) no("can't find correct xl");
                yl = (vy[i] - ry[p])/(mi - m[p]);
                if ((vy[i] - ry[p])%(mi - m[p])) no("can't find correct yl");
                is_l = true; rx[l] = xl; ry[l] = yl; m[l] = 1;
                for (long j=0;j <l; j++)
                    if (m[j] > 0)
                    {
                        rx[j] -= xl*m[j];
                        ry[j] -= yl*m[j];
                        m[j] = 0;
                    }
            }
        }
        else
        {
            if (is_l)
            {
                m[p] = 0;
                rx[p] = vx[i]-mi*xl;
                ry[p] = vy[i]-mi*yl;
            }
            else
            {
                m[p] = mi;
                rx[p] = vx[i];
                ry[p] = vy[i];
            }
        }
    }
    return is_l;
}

struct romb
{
    long long x1, x2, y1, y2;
    void insert(long long x, long long y, long long delta, long long m)
    {
        if (m < 0) delta = -delta;
        x1 = (x - y - delta)/m;
        if ((x - y - delta)%m > 0) x1++;
        x2 = (x - y + delta)/m;
        if ((x - y + delta)%m < 0) x2--;
        y1 = (x + y - delta)/m;
        if ((x + y - delta)%m > 0) y1++;
        y2 = (x + y + delta)/m;
        if ((x + y + delta)%m < 0) y2--;

    }
};

bool merge(romb& r1, romb r2)
{
    if (r1.x1 < r2.x1) r1.x1 = r2.x1;
    if (r2.x2 < r1.x2) r1.x2 = r2.x2;
    if (r1.x1 > r2.x2) return false;
    if (r1.y1 < r2.y1) r1.y1 = r2.y1;
    if (r2.y2 < r1.y2) r1.y2 = r2.y2;
    if (r1.y1 > r2.y2) return false;
    return true;
}

bool getXY(romb r,long long& x, long long& y)
{
    long long xr = r.x1;
    long long yr = r.y1;

    if (mabs(yr%2) != mabs(l%2)) yr++;
    if ((r.x1 - r.y1) % 2)
    {
        if (r.x1 == r.x2)
            xr ++;
        else
            yr += 2;
    }
    if (yr > r.y2) return false;
    x = xr - (xr - yr)/2;
    y = yr - (xr + yr)/2;
    return true;
}

void find_l2()
{
    int p = 0;
    romb r, nr;
    r.x1 = -l; r.x2 = l; r.y1 = -l; r.y2 = l;

    for(int i = 1; i < l; i++)
    {
        if (m[i] != -1)
        {
            if (m[i] != m[p])
            {
                nr.insert(rx[i] - rx[p], ry[i] - ry[p], i - p,m[i]-m[p]);
                if (!merge(r,nr)) no("incorrect merge");
            }
            p = i;
        }
    }

    nr.insert(rx[p],ry[p],l-p,m[p]+1);
    if (!merge(r,nr)) no("incorrect last merge");

    if (!getXY(r,xl,yl)) no("incorrect getXY");

    rx[l] = xl; ry[l] = yl; m[l] = 1;
    for (long j=0;j <l; j++)
        if (m[j] > 0)
        {
            rx[j] -= xl*m[j];
            ry[j] -= yl*m[j];
            m[j] = 0;
        }
}

void get_result(string& str)
{
    str.resize(l);
    int p = 0;
    for (int i=1; i <= l; i ++)
    {
        if (m[i] != -1)
        {
            if ((i-p) < (mabs(rx[i]-rx[p])+mabs(ry[i]-ry[p]))) no( "incorrect distance");
            int k = p;
            if (rx[i] > rx[p]) for(int j=0;j< (rx[i]-rx[p]);j++) str[j+k] = 'R';
            if (rx[i] < rx[p]) for(int j=0;j< (rx[p]-rx[i]);j++) str[j+k] = 'L';
            k += mabs(rx[i]-rx[p]);
            if (ry[i] > ry[p]) for(int j=0;j< (ry[i]-ry[p]);j++) str[j+k] = 'U';
            if (ry[i] < ry[p]) for(int j=0;j< (ry[p]-ry[i]);j++) str[j+k] = 'D';
            k += mabs(ry[i]-ry[p]);
            if ((i-k) % 2)
            {
                cout << i << " " << p << " " << rx[i] << " " << rx[p] << " " << ry[i] << " " << ry[p] << " " << xl << " " << yl << endl;
                no("incorrect odd");
            }
            for (;k<i;k+=2) {str[k] = 'U';str[k+1] = 'D';}
            p = i;
        }
    }
}

void handle()
{
    rx.resize(l+1);
    ry.resize(l+1);
    m.resize(l+1);
    m.assign(l+1,-1);

    if (!find_l()) find_l2();
    get_result(result);
}

int main()
{
    cin >> n >> l;
    vt.resize(n);
    vx.resize(n);
    vy.resize(n);
    result.resize(l);
    for (long i=0;i<n;i++)
    {
        cin >> vt[i] >> vx[i] >> vy[i];
        //if ((vt[i]%2) != (mabs(vx[i]+vy[i])%2)) no("reading");
    }

    handle();

    cout << result;

    cin >> n;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<tuple>
#include<algorithm>
#include<limits>

int n,L;

inline void bye(){puts("NO"),exit(0);}

std::tuple<int,long long,long long> X0[200050],Y0[200050];
std::pair<int,long long> XX[200050],YY[200050];
int Cx[2000050],Cy[2000050];

char ans[2000050];

int main(){
	scanf("%d%d",&n,&L);
	for (int i=1;i<=n;i++){
		long long t,x,y;
		scanf("%lld%lld%lld",&t,&x,&y);
		if ((x+y+t)&1) bye();
		X0[i]=std::make_tuple(t%L,(x+y+t)/2,t/L);
		Y0[i]=std::make_tuple(t%L,(x-y+t)/2,t/L);
	}
	X0[0]=std::make_tuple(0,0,0);
	Y0[0]=std::make_tuple(0,0,0);

	{
		std::sort(X0,X0+n+1);
		X0[n+1]=std::make_tuple(L,0,-1);
		long long LL=0,RR=L;
		for (int i=1;i<=n+1;i++){
			long long Lv=std::get<0>(X0[i-1])-std::get<0>(X0[i])-std::get<1>(X0[i-1])+std::get<1>(X0[i]);
			long long coef=std::get<2>(X0[i])-std::get<2>(X0[i-1]);
			long long Rv=-std::get<0>(X0[i-1])+std::get<0>(X0[i])-std::get<1>(X0[i-1])+std::get<1>(X0[i]);
			if (coef==0){
				if (Lv>0||Rv<0) bye();
			}
			else if (coef>0){
				LL=std::max(LL,Lv>0?((Lv-1)/coef+1):0);
				RR=std::min(RR,Rv>=0?Rv/coef:-1);
			}
			else{
				LL=std::max(LL,-Rv>0?(-Rv-1)/(-coef)+1:0);
				RR=std::min(RR,-Lv>=0?(-Lv)/(-coef):-1);
			}
			if (LL>RR) bye();
		}
		int S0=LL;
		for (int i=1;i<=n+1;i++) XX[i]=std::make_pair(std::get<0>(X0[i]),std::get<1>(X0[i])-std::get<2>(X0[i])*S0);
		for (int i=1;i<=n+1;i++){
			for (int j=XX[i-1].first+1;j<=XX[i-1].first+XX[i].second-XX[i-1].second;j++) Cx[j]=1;
			for (int j=XX[i-1].first+1+XX[i].second-XX[i-1].second;j<=XX[i].first;j++) Cx[j]=0;
		}
	}

	{
		std::sort(Y0,Y0+n+1);
		Y0[n+1]=std::make_tuple(L,0,-1);
		long long LL=0,RR=L;
		for (int i=1;i<=n;i++){
			long long Lv=std::get<0>(Y0[i-1])-std::get<0>(Y0[i])-std::get<1>(Y0[i-1])+std::get<1>(Y0[i]);
			long long coef=std::get<2>(Y0[i])-std::get<2>(Y0[i-1]);
			long long Rv=-std::get<0>(Y0[i-1])+std::get<0>(Y0[i])-std::get<1>(Y0[i-1])+std::get<1>(Y0[i]);
			if (coef==0){
				if (Lv>0||Rv<0) bye();
			}
			else if (coef>0){
				LL=std::max(LL,Lv>0?((Lv-1)/coef+1):0);
				RR=std::min(RR,Rv>=0?Rv/coef:-1);
			}
			else{
				LL=std::max(LL,-Rv>0?(-Rv-1)/(-coef)+1:0);
				RR=std::min(RR,-Lv>=0?(-Lv)/(-coef):-1);
			}
			if (LL>RR) bye();
		}
		int S0=LL;
		for (int i=1;i<=n+1;i++) YY[i]=std::make_pair(std::get<0>(Y0[i]),std::get<1>(Y0[i])-std::get<2>(Y0[i])*S0);
		for (int i=1;i<=n+1;i++){
			for (int j=YY[i-1].first+1;j<=YY[i-1].first+YY[i].second-YY[i-1].second;j++) Cy[j]=1;
			for (int j=YY[i-1].first+1+YY[i].second-YY[i-1].second;j<=YY[i].first;j++) Cy[j]=0;
		}
	}

	for (int i=1;i<=L;i++) ans[i]="LDUR"[Cx[i]<<1|Cy[i]];
	puts(ans+1);
}

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
#define endl '\n'

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

struct A {
    ll t, x, y;
};
main() {
    INT(n);
    LL(l);
    map<ll, vector<A>> mp;
    bool flag = true;
    rep(i, n) {
        LL(t, x, y);
        mp[t % l].push_back(A{t, x, y});
        if(((abs(x) + abs(y)) ^ t) & 1) { flag = false; }
    }
    if(!flag) {
        cout << "NO\n";
        return 0;
    }
    struct rect {
        ll a, b, c, d;
        rect(ll a, ll b, ll c, ll d) : a(a), b(b), c(c), d(d) {}
    };
    auto merge = [](rect &x, rect y) {
        chmax(x.a, y.a);
        chmax(x.b, y.b);
        chmin(x.c, y.c);
        chmin(x.d, y.d);
    };
    rect r(-l, -l, l, l);
    ll px = 0, py = 0, k = 0;
    ll pre = 0;
    // y * a >= x となる a
    auto Ceil = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y >= x)
                if(chmin(d, (piv + i) * y - x)) res = piv + i;
        }
        return res;
    };
    auto Floor = [](ll x, ll y) {
        ll piv = x / y;
        ll d = LLONG_MAX;
        ll res;
        rep2(i, -1, 1) {
            if((piv + i) * y <= x)
                if(chmin(d, x - (piv + i) * y)) res = piv + i;
        }
        return res;
    };
    // 前回は (px,py) で 係数は k
    rep(_, 2) {
        for(auto [x, v] : mp) {
            for(auto [t, aa, bb] : v) {
                ll a = aa - px + bb - py, b = aa - px - bb + py;
                ll dx = x - pre;
                ll K = t / l;
                ll dk = K - k;
                if(!_ and !dk and max(abs(a), abs(b)) > dx) {
                    if(n == 1000 and l == 2000000) { cout << "jfjjfj"; }
                    cout << "NO\n";
                    return 0;
                }
                if(_){
                    dx += l;
                    dk--;
                }
                if(dk) {
                    ll aa = Floor(a + dx, dk), bb = Floor(b + dx, dk), cc = Ceil(a - dx, dk), dd = Ceil(b - dx, dk);
                    if(aa > cc) swap(aa, cc);
                    if(bb > dd) swap(bb, dd);
                    merge(r, rect(aa, bb, cc, dd));
                }
                merge(r, rect(Ceil(aa + bb - (l * (K + 1) - t), K + 1), Ceil(aa - bb - (l * (K + 1) - t), K + 1), Floor(aa + bb + (l * (K + 1) - t), K + 1),
                              Floor(aa - bb + (l * (K + 1) - t), K + 1)));
                ll dl = t - l * K;
                if(K) merge(r, rect(Ceil(aa + bb - dl, K), Ceil(aa - bb - dl, K), Floor(aa + bb + dl, K), Floor(aa - bb + dl, K)));
                px = aa, py = bb;
                k = K;
                pre = x;
                if(_) break;
            }
            if(_) break;
        }
    }
    if(n == 1000 and l == 2000000) { cout << r.a << " " << r.b << " " << r.c << " " << r.d << endl; }
    if(r.a > r.c or r.b > r.d) {
        cout << "NO\n";
        return 0;
    }
    int iter = 1000;
    rep2(t,r.a,r.c)rep2(s,r.b,r.d){
        if((abs(t)+abs(s))&1) continue;
        ll dx = (t + s) / 2, dy = (t - s) / 2;
        pre = 0, px = 0, py = 0;
        string ans;
        for(auto [T, v] : mp) {
            ll TT = v.back().t / l;
            ll a = v.back().x - TT * dx - px, b = v.back().y - TT * dy - py;
            if(abs(a) + abs(b) > T - pre) {
                continue;
            }
            if(a < 0) { rep(i, -a) ans.pb('L'); }
            if(a > 0) rep(i, a) ans.pb('R');
            if(b < 0) rep(i, -b) ans.pb('D');
            if(b > 0) rep(i, b) ans.pb('U');
            rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
            if((T - pre - abs(a) - abs(b)) & 1) {
                continue;
            }
            pre = T;
            px += a, py += b;
        }
        ll a = dx - px, b = dy - py;
        ll T = l;
        if(abs(a) + abs(b) > T - pre) {
            continue;
        }
        if(a < 0) { rep(i, -a) ans.pb('L'); }
        if(a > 0) rep(i, a) ans.pb('R');
        if(b < 0) rep(i, -b) ans.pb('D');
        if(b > 0) rep(i, b) ans.pb('U');
        rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
        if((T - pre - abs(a) - abs(b)) & 1) {
            continue;
        }
        cout << ans << endl;
        return 0;
    }
    cout<<"NO\n";
}

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;
#define FOR(i,s,e) for (int i=(s); i<(e); i++)
#define FOE(i,s,e) for (int i=(s); i<=(e); i++)
#define LL long long
LL max(LL a,LL b){if (a>b){return a;} else {return b;}}
LL min(LL a,LL b){if (a<b){return a;} else {return b;}}

#define M 400001

int n, l;
LL x, y, t;

struct dat{
    int ma;
    LL cy, x, y;
}a[M];

bool operator< (dat u, dat v){return u.ma < v.ma;}

int f(LL d){
    if (d < 0) return f(-d);
    return d % 2;
}

int main(){
    scanf("%d%d", &n, &l);
    FOE(i, 1, n){
        scanf("%I64d%I64d%I64d", &t, &x, &y);
        if (f(x + y) != f(t)){
            puts("NO");
            return 0;
        }
        a[i].x = x;
        a[i].y = y;
        a[i].cy = t / (LL)l;
        a[i].ma = t % (LL)l;
    }

    a[0].x = 0;
    a[0].y = 0;
    a[0].cy = 0;
    a[0].ma = 0;

    a[++n].x = 0;
    a[n].y = 0;
    a[n].cy = -1;
    a[n].ma = l;

    sort(a, a + n);

    int mx = -1 * l, my = -1 * l, Mx = l, My = l;
    //mx is the x+y border, my is the x-y border
    FOE(i, 1, n){
        LL dx = abs(a[i].x - a[i - 1].x);
        LL dy = abs(a[i].y - a[i - 1].y);
        if ((dx + dy) > abs(a[i].cy - a[i - 1].cy) * l + abs(a[i].ma - a[i - 1].ma)){
            puts("NO");
            return 0;
        }

        if (a[i].cy != a[i - 1].cy){
            LL dif = a[i].ma - a[i - 1].ma;
            LL df = abs(a[i].cy - a[i - 1].cy);
            LL de = 1; if (a[i].cy < a[i - 1].cy) de = -1;
            LL ax = a[i].x - a[i - 1].x;
            LL ay = a[i].y - a[i - 1].y;
            ax *= de;
            ay *= de;
      //      printf("%d %I64d %I64d %I64d %I64d\n", i, dif, df, ax, ay);

            while (mx <= Mx && mx * df < ax + ay - dif) mx++;
            while (my <= My && my * df < ax - ay - dif) my++;
            while (mx <= Mx && Mx * df > dif + ax + ay) Mx--;
            while (my <= My && My * df > dif + ax - ay) My--;
     //       printf("Res = {%d, %d}, {%d, %d}\n", mx, Mx, my, My);
        }
    }

    if (f(mx) != f(l)) mx++;
    if (f(my) != f(l)) my++;

  //  printf("%d %d %d %d\n", mx, Mx, my, My);
    if (mx > Mx || my > My){
        puts("NO");
        return 0;
    }

    LL dx = (mx + my) / 2;
    LL dy = (mx - my) / 2;

  //  printf("%I64d %I64d\n", dx, dy);

    FOE(i, 0, n - 1){
        a[i].x -= a[i].cy * dx;
        a[i].y -= a[i].cy * dy;
    }

    int j = 0;
    int px = 0;
    int py = 0;

    a[n].x = dx;
    a[n].y = dy;
    FOE(i, 0, n){
      //  printf("TAR %I64d, %I64d now %d, %d\n", a[i].x, a[i].y, px, py);
        while (px < a[i].x){
            px++;
            j++;
            printf("R");
        }
        while (px > a[i].x){
            px--;
            j++;
            printf("L");
        }
        while (py < a[i].y){
            py++;
            j++;
            printf("D");
        }
        while (py > a[i].y){
            py--;
            j++;
            printf("U");
        }
        while (j != a[i].ma){
            printf("LR");
            printf("\n%d, %d\n", i, j);
            system("PAUSE");
            j += 2;
        }
    }

    puts("");
    return 0;
}

#include <iostream>
#include <algorithm>

#define DEBUG() std::cerr << __FUNCTION__ << " " << __LINE__ << std::endl

using i64 = long long;

template<typename T> T ceil(T a, T b) { return (a + b - 1) / b; }

const int N = 2000000 + 7;

int n, m;
i64 t[N], q[N], x[N], y[N];
int opx[N], opy[N];

int work(i64 x[], int op[]) {
	for (int i = 1; i <= n; ++i) {
		if ((x[i] + t[i]) % 2) return -1;
		x[i] = (x[i] + t[i]) / 2;
		if (x[i - 1] > x[i] || x[i] > t[i]) return -1;
	}

	static int e[N];
	for (int i = 1; i <= n; ++i) e[i] = i;
	std::sort(e + 1, e + n + 1, [&](int a, int b) {
		return t[a] % m < t[b] % m;
	});

	i64 l = 0, r = m;
	for (int i = 1; i <= n; ++i) {
		if (t[e[i - 1]] % m != t[e[i]] % m || q[e[i]] == q[e[i - 1]]) continue;
		if ((x[e[i]] - x[e[i - 1]]) % (q[e[i]] - q[e[i - 1]])) return -1;
		i64 z = (x[e[i]] - x[e[i - 1]]) / (q[e[i]] - q[e[i - 1]]);
		l = std::max(l, z), r = std::min(r, z);
	}
	for (int i = 1; i <= n; ++i) {
		if (q[i]) l = std::max(l, ceil(x[i] - t[i] % m, q[i]));
		l = std::max(l, ceil(x[i], q[i] + 1));
	}
	for (int i = 1; i <= n; ++i) {
		if (q[e[i - 1]] == q[e[i]]) continue;
		i64 u = x[e[i]] - x[e[i - 1]], v = q[e[i]] - q[e[i - 1]];
		if (u > 0) r = std::min(r, u / v);
		if (u < 0) l = std::max(l, ceil(-u, -v));
	}
	l = std::max(l, x[e[n]] / (q[e[n]] + 1));
	r = std::min(r, (m - t[e[n]] % m + x[e[n]]) / (q[e[n]] + 1));

	if (l > r) return -1;
	int j = 1, k = l;
	static i64 h[N];
	for (int i = 1; i <= n; ++i)
		h[i] = x[i] - q[i] * k;
	for (int i = 1; i <= n; ++i)
		std::fill(op + j, op + j + h[e[i]] - h[e[i - 1]], 1),
		j += t[e[i]] % m - t[e[i - 1]] % m, k -= h[e[i]] - h[e[i - 1]];
	std::fill(op + j, op + j + k, 1);
	return 0;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i)
		scanf("%lld%lld%lld", t + i, x + i, y + i),
		y[i] = x[i] + y[i], x[i] = 2 * x[i] - y[i],
		q[i] = t[i] / m;

	int wx = work(x, opx);
	if (wx == -1) return printf("NO"), 0;
	int wy = work(y, opy);
	if (wy == -1) return printf("NO"), 0;
	for (int i = 1; i <= m; ++i) {
		if (opx[i] && opy[i]) printf("R");
		if (opx[i] && !opy[i]) printf("D");
		if (!opx[i] && opy[i]) printf("U");
		if (!opx[i] && !opy[i]) printf("L");
	}
	return 0;
}

#include <cstdio>
#include <cstring>
#include <cassert>

#include <algorithm>
#include <iostream>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 2100100;

int N, L;

struct Pos {
  llint t, x, y;
};
bool operator < (const Pos &A, const Pos &B) { return A.t % L < B.t % L; }

Pos pos[MAX];
int m[MAX], mx[MAX], my[MAX];

llint divd(llint a, llint b) {
  if (b < 0) a = -a, b = -b;
  return a/b - (a%b < 0);
}

int main() {
  scanf("%d%d", &N, &L); ++N;
  pos[0] = {0, 0, 0};
  FOR(i, 1, N) {
    llint t, x, y; scanf("%lld%lld%lld", &t, &x, &y);
    pos[i].t = t;
    pos[i].x = x - y;
    pos[i].y = x + y;
  }
  sort(pos+1, pos+N);

  REP(step, 2) {
    llint S = L;
    FOR(i, 1, N) {
      llint dp = pos[i].t % L - pos[i-1].t % L;
      llint dk = pos[i].t / L - pos[i-1].t / L;
      llint dx = pos[i].x     - pos[i-1].x;
      if (dk > 0) S = min(S, divd(dx+dp, dk));
      if (dk < 0) S = min(S, divd(dx-dp, dk));
    }

    REP(iter, 10) {
      int cur = 0;
      llint sum = 0;
      bool ok = true;

      REP(i, N) {
        llint p = pos[i].t % L;
        llint k = pos[i].t / L;
        llint x = pos[i].x;
        llint w = x - k*S;

        while (cur < p) {
          if (sum > w)
            m[cur++] = -1, --sum;
          else
            m[cur++] = +1, ++sum;
        }
        ok &= sum == w;
      }

      while (cur < L) {
        if (sum > S)
          m[cur++] = -1, --sum;
        else
          m[cur++] = +1, ++sum;
      }
      ok &= sum == S;
      if (ok) break;

      if (iter == 9) {
        puts("NO");
        return 0;
      }
      --S;
    }

    REP(i, L) {
      if (step == 0) mx[i] = m[i];
      if (step == 1) my[i] = m[i];
    }
    REP(i, N) swap(pos[i].x, pos[i].y);
  }

  REP(i, L) {
    if (mx[i] == +1 && my[i] == +1) putchar('R');
    if (mx[i] == -1 && my[i] == -1) putchar('L');
    if (mx[i] == -1 && my[i] == +1) putchar('U');
    if (mx[i] == +1 && my[i] == -1) putchar('D');
  }
  puts("");

  return 0;
}

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long int ll;

ll n,l;
ll t[5000000];

struct elem {
  ll tmod;
  ll pos;
  ll tdiv;
  elem() {
  }
  elem(ll intmod,ll inpos,ll intdiv) {
    tmod=intmod;pos=inpos;tdiv=intdiv;
  }
};

bool operator<(elem e1,elem e2)
{
  return e1.tmod<e2.tmod;
}

ll divdown(ll a,ll b)
{
  if (a/b>=0) return a/b;
  return a/b-(a%b!=0);
}

ll divup(ll a,ll b)
{
  if (a/b>=0) return a/b+(a%b!=0);
  return a/b;
}
/*
ll divdown(ll x, ll y) {
    if (x >= 0) return x / y;
    return x / y - (x % y ? 1 : 0);
}

ll divup(ll x, ll y) {
    if (x >= 0) return (x + y - 1) / y;
    return x / y;
}
*/

void soluciona(ll pos[5000000],int sol[5000000])
{
  /*
  cout<<"soluciona"<<endl;
  for (int i=0;i<n;i++)
    cout<<pos[i]<<",";
  cout<<endl;
  */
  vector<elem> v;
  v.push_back(elem(0,0,0));
  //v.push_back(elem(l,0,1));
  for (int i=0;i<n;i++)
    v.push_back(elem(t[i]%l,pos[i],t[i]/l));
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  sort(v.begin(),v.end());
  /*
  for (int i=0;i<int(v.size());i++)
    cout<<"("<<v[i].tmod<<","<<v[i].pos<<","<<v[i].tdiv<<")";
  cout<<endl;
  */
  ll inf=0;
  ll sup=l;
  /*
  if (v[0].tdiv) {
    sup=min(sup,divdown(v[0].pos,v[0].tdiv));
    inf=max(inf,divup(v[0].pos-v[0].tmod,v[0].tdiv));
  } else if (not (0<=v[0].pos and v[0].pos<=v[0].tmod)) {
    cout<<"NO"<<endl;
    exit(0);
  }
  */
  for (int i=1;i<int(v.size());i++) {
    ll rpos=v[i].pos-v[i-1].pos;
    ll rdiv=v[i].tdiv-v[i-1].tdiv;
    ll rmod=v[i].tmod-v[i-1].tmod;
    if (rdiv) {
      if (rdiv>0) {
	sup=min(sup,divdown(rpos,rdiv));
	inf=max(inf,divup(rpos-rmod,rdiv));
      } else {
	inf=max(inf,divup(rpos,rdiv));
	sup=min(sup,divdown(rpos-rmod,rdiv));
      }
    } else if (not (0<=rpos and rpos<=rmod)) {
      cout<<"NO"<<endl;
      exit(0);
    }
  }
  if (inf>sup) {
    cout<<"NO"<<endl;
    exit(0);
  }
  //cout<<inf<<","<<sup<<endl;
  ll total=inf;
  ll unosant=0;
  for (int i=0;i<int(v.size());i++) {
    ll unos=v[i].pos-v[i].tdiv*total;
    for (int j=0;j<unos-unosant;j++)
      sol[v[i].tmod-1-j]=1;
    unosant=unos;
  }

  ll unos=total;
  for (int j=0;j<unos-unosant;j++)
    sol[l-1-j]=1;

  /*
  cout<<"solucion:"<<endl;
  for (int i=0;i<n;i++)
    cout<<sol[i];
  cout<<endl;
  */
}

ll pos[2][5000000];
int sol[2][5000000];

int main()
{
  ios::sync_with_stdio(false);
  cin>>n>>l;
  for (int i=0;i<n;i++) {
    ll x,y;
    cin>>t[i]>>x>>y;
    if ((t[i]+x+y)%2) {
      cout<<"NO"<<endl;
      exit(0);
    }
    pos[0][i]=(t[i]+x+y)/2;
    pos[1][i]=(t[i]+x-y)/2;
  }
  soluciona(pos[0],sol[0]);
  soluciona(pos[1],sol[1]);
  string s;
  for (int i=0;i<l;i++) {
    if (sol[0][i] and sol[1][i]) s+="R";
    else if (sol[0][i] and not sol[1][i]) s+="U";
    else if (not sol[0][i] and sol[1][i]) s+="D";
    else if (not sol[0][i] and not sol[1][i]) s+="L";
  }
  cout<<s<<endl;
}

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
char S[6] = {'D', 'L', 'R', 'U'};
int nex[6] = {0, 0, 1, 1};
int ney[6] = {0, 1, 0, 1};
int cnt[6];
#define LL long long
int n;
LL loop, lx = -4e18, rx = 4e18, ly = -4e18, ry = 4e18;
string ans, tmp;
struct Pos{
	LL x, y, t, k, w;
}a[N], now[N];
bool cmp(Pos X, Pos Y){
	return X.w < Y.w;
}
void fail(){
//	puts("NO");
	exit(0);
}
void update(LL &l, LL &r, LL k, LL w, LL x1, LL x2){
	LL L = -w - x1 + x2, R = -x1 + x2;
//	printf("L=%lld R=%lld k=%lld\n", L, R, k);
	if(!k) {if(L > 0 || R < 0)fail();}
	else{
		if(k > 0){
//			printf("case1: L=%lld R=%lld\n", (LL)ceil(1.0 * L / k), (LL)floor(1.0 * R / k));
			l = max(l, (LL)ceil(1.0 * L / k));
			r = min(r, (LL)floor(1.0 * R / k));
		}
		else{
//			printf("case2: L=%lld R=%lld\n", (LL)ceil(1.0 * R / k), (LL)floor(1.0 * L / k));
			l = max(l, (LL)ceil(1.0 * R / k));
			r = min(r, (LL)floor(1.0 * L / k));
		}
	}
}
void work(LL rx, LL ry){
	for(int i = 1;i <= n; i++){
//	 printf("i=%d x=%lld y=%lld k=%lld w=%lld\n", i, a[i].x, a[i].y, a[i].k, a[i].w);

		a[i].x = a[i].x - a[i].k * rx;
		a[i].y = a[i].y - a[i].k * ry;
	}
//	printf("rx=%lld ry=%lld\n", rx, ry);
	a[n+1].x = rx; a[n+1].y = ry;
	tmp.clear();
	for(int i = 0;i <= n; i++){
		LL t = a[i+1].w - a[i].w;
		LL nx = a[i].x, ny = a[i].y;
		LL x = a[i+1].x, y = a[i+1].y;
//		printf("i=%d nx=%lld ny=%lld x=%lld y=%lld wi+1=%lld wi=%lld\n", i, nx, ny, x, y, a[i+1].w, a[i].w);
		memset(cnt, 0, sizeof(cnt));
		while(t--){
			if(nx < x){
				if(ny < y)cnt[3]++, nx++, ny++;
				else cnt[2]++, nx++;
			}
			else{
				if(ny < y)cnt[1]++, ny++;
				else cnt[0]++;
			}
		}
		for(int j = 0;j <= 3; j++)
			for(int k = 1;k <= cnt[j]; k++)tmp += S[j];
	}
	if(ans.empty() || ans > tmp)ans = tmp;
}
int main(){
//	freopen("robot.in", "r", stdin);
//	freopen("robot.out", "w", stdout);
	cin>>n>>loop;
	LL x, y, t;
	for(int i = 1;i <= n; i++){
		scanf("%lld%lld%lld", &t, &x, &y);
		if((x ^ y ^ t) & 1)fail();
		a[i].t = t;
		a[i].x = (x + y + t) >> 1;
		a[i].y = (y - x + t) >> 1;
		a[i].k = t / loop;
		a[i].w = t % loop;
//		printf("i=%d x=%lld y=%lld\n", i, a[i].x, a[i].y);
	}
	sort(a + 1, a + 1 + n, cmp);
	a[n+1].k = -1; a[n+1].w = loop;
	for(int i = 0; i <= n; i++){
		LL k = a[i+1].k - a[i].k;
		LL w = a[i+1].w - a[i].w;
		update(lx, rx, k, w, a[i].x, a[i+1].x);
		update(ly, ry, k, w, a[i].y, a[i+1].y);
//		printf("i=%d k=%lld w=%lld lx=%lld rx=%lld ly=%lld ry=%lld\n", i, k, w, lx, rx, ly, ry);

	}
//	puts("xbx");
	if(lx > rx || ly > ry)fail();
	memcpy(now, a, sizeof(now));
	work(lx, ly);
	memcpy(a, now, sizeof(now));
//	work(rx, ry);
//	printf("lx=%lld rx=%lld ly=%lld ry=%lld\n", lx, rx, ly, ry);
	cout<<ans<<endl;
	return 0;
}
/*3 5 1 1 0 2 1 -1 3 0 -1*/

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){x+y,y-x,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
		rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0*(x-r)/k)); rx = min(rx,(LL)floor(1.0*(x+r)/k)); ly = max(ly,(LL)ceil(1.0*(y-r)/k)); ry = min(ry,(LL)floor(1.0*(y+r)/k));}
			else {k = -k; lx = max(lx,(LL)ceil(-1.0*(x+r)/k)); rx = min(rx,(LL)floor(1.0*(r-x)/k)); ly = max(ly,(LL)ceil(-1.0*(y+r)/k)); ry = min(ry,(LL)floor(1.0*(r-y)/k));}
		} if (lx > rx || ly > ry) {puts("NO"); return;}
		rep(i,1,n) {
			int x = 0,y = 0,dx = p[i].x-p[i-1].x-p[i].k*lx+p[i-1].k*lx,dy = p[i].y-p[i-1].y-p[i].k*ly+p[i-1].k*ly,t = p[i].r-p[i-1].r;
			while (t--) {if (x < dx) {++x; if (y < dy) {++y; putchar('U');} else {--y; putchar('R');}} else {--x; if (y < dy) {++y; putchar('L');} else {--y; putchar('D');}}}
		}
	}
}
int main() {qiqi::main(); return 0;}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#define ll long long
#define N 2000006
#define NO puts("NO"), exit(0);

using namespace std;

int n, l;

struct Node{
	int w;
	ll k, x, y;

	void rd(){
		ll t, X, Y;
		scanf("%lld%lld%lld", &t, &X, &Y);
		if((X ^ Y ^ t) & 1) NO;
		x = (X + Y + t) / 2; y = (Y - X + t) / 2;
		k = t / l; w = t % l;
		return ;
	}

	bool operator < (Node x)const{
		return w < x.w;
	}
}p[N];

char res[N], s[N];

void make(ll, ll);

int main(){
	scanf("%d%d", &n, &l);
	ll lx = 0, rx = 999999999, ly = 0, ry = 999999999;
	for(int i = 1; i <= n; ++i) p[i].rd();
	p[++n] = (Node){0, 0, 0, 0}; p[++n] = (Node){l, -1, 0, 0};
	sort(p + 1, p + 1 + n); res[1] = 'Z';
	for(int i = 2; i <= n; ++i){
		ll k = p[i].k - p[i - 1].k;
		int w = p[i].w - p[i - 1].w;
		ll X = p[i].x - p[i - 1].x, Y = p[i].y - p[i - 1].y;
		if(!k){
			if(X - w > 0 || X < 0 || Y - w > 0 || Y < 0) NO;
			continue;
		}
		if(k > 0){
			lx = max(lx, (ll)ceil(1.0 * (X - w) / k));
			rx = min(rx, (ll)floor(1.0 * X / k));
			ly = max(ly, (ll)ceil(1.0 * (Y - w) / k));
			ry = min(ly, (ll)floor(1.0 * Y / k));
		} else{
			k = -k; X = -X; Y = -Y;
			lx = max(lx, (ll)ceil(1.0 * X / k));
			rx = min(rx, (ll)floor(1.0 * (w + X) / k));
			ly = max(ly, (ll)ceil(1.0 * Y / k));
			ry = min(ly, (ll)floor(1.0 * (w + Y) / k));
		}
	}
	if(lx > rx || ly > ry) NO;
	make(lx, ly); make(lx, ry); make(rx, ly); make(rx, ry);
	for(int i = 1; i <= l; ++i) putchar(res[i]);
	return 0;
}

void make(ll x, ll y){
	int top = 0;
	for(int i = 2; i <= n; ++i){
		int w = p[i].w - p[i - 1].w;
		if(!w) continue;
		ll k = p[i].k - p[i - 1].k;
		ll dx = p[i].x - p[i - 1].x - k * x;
		ll dy = p[i].y - p[i - 1].y - k * y;
		for(int j = 1; j <= w; ++j){
			if(j + dx <= w && j + dy <= w) s[++top] = 'D';
			if(j + dx <= w && j + dy > w) s[++top] = 'L';
			if(j + dx > w && j + dy <= w) s[++top] = 'R';
			if(j + dx > w && j + dy > w) s[++top] = 'U';
		}
	}
	int pos = 1;
	while(pos <= l && res[pos] == s[pos]) ++pos;
	if(res[pos] > s[pos]) memcpy(res, s, sizeof res);
	return ;
}

#include <bits/stdc++.h>
using namespace std;
long long n, l;
const int maxN = 2 * (int)1e5 + 10;
long long t[maxN];
long long y[maxN];
long long x[maxN];
vector < pair < int, int > > f;
int main() {
    srand(time(0));
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    cin >> n >> l;
    for (int i = 1; i <= n; i++) {
        cin >> t[i] >> x[i] >> y[i];
        if (t[i] % 2 != (((x[i] + y[i]) % 2) + 2) % 2) {
            cout << "NO";
            return 0;
        }
        f.push_back(make_pair(t[i] % l, i));
    }
    f.push_back(make_pair(0, 0));
    long long l1 = -l;
    long long r1 = l;
    long long l2 = -l;
    long long r2 = l;
    sort(f.begin(), f.end());
    for (int i = 0; i + 1 < f.size(); i++) {
        long long t1 = f[i].first;
        long long t2 = f[i + 1].first;
        int ind1 = f[i].second;
        int ind2 = f[i + 1].second;
        if (t[ind1] < t[ind2]) {
            swap(ind1, ind2);
            swap(t1, t2);
        }
        if (t[ind1] / l == t[ind2] / l) continue;
        r1 = min(r1, (x[ind1] + y[ind1] - x[ind2] - y[ind2] + abs(t1 - t2)) / ((t[ind1] / l) - (t[ind2] / l)));
        l1 = max(l1, (x[ind1] + y[ind1] - x[ind2] - y[ind2] - abs(t1 - t2) + (t[ind1] / l) - (t[ind2] / l) - 1) / ((t[ind1] / l) - (t[ind2] / l)));
        r2 = min(r2, (x[ind1] - y[ind1] - x[ind2] + y[ind2] + abs(t1 - t2)) / ((t[ind1] / l) - (t[ind2] / l)));
        l2 = max(l2, (x[ind1] - y[ind1] - x[ind2] + y[ind2] - abs(t1 - t2) + (t[ind1] / l) - (t[ind2] / l) - 1) / ((t[ind1] / l) - (t[ind2] / l)));
    }
    int ind = f[f.size() - 1].second;
    r1 = min(r1, (x[ind] + y[ind] + l - (t[ind] % l)) / (1 + (t[ind] / l)));
    l1 = max(l1, (x[ind] + y[ind] + (t[ind] % l) - l) / (1 + (t[ind] / l)));
    r2 = min(r2, (x[ind] - y[ind] + l - (t[ind] % l)) / (1 + (t[ind] / l)));
    l2 = max(l2, (x[ind] - y[ind] + (t[ind] % l) - l) / (1 + (t[ind] / l)));
    if (abs(l2 - l1) % 2 != 0) {
        if (r2 > l2) l2++;
        else l1++;
    }
    if (r1 < l1 || r2 < l2) {
        cout << "NO";
        return 0;
    }
    int a = l1;
    int b = l2;
    int curr = 0;
    int curu = 0;
    f.push_back(make_pair(l, n + 1));
    x[n + 1] = (a + b) / 2;
    y[n + 1] = (a - b) / 2;
    t[n + 1] = 0;
    //cout << a << " " << b << endl;
    for (int i = 0; i + 1 < f.size(); i++) {
        int ind1 = f[i].second;
        int ind2 = f[i + 1].second;
        //cout << ind1 << " " << ind2 << '\n';
        long long c = (x[ind2] + y[ind2] - a * (t[ind2] / l) - x[ind1] - y[ind1] + a * (t[ind1] / l));
        long long d = (x[ind2] - y[ind2] - b * (t[ind2] / l) - x[ind1] + y[ind1] + b * (t[ind1] / l));
        long long e = f[i + 1].first - f[i].first;
        //cout << c << " " << d << endl;
        for (int i = 0; i < (c - d) / 2; i++) {
            curu++;
            cout << "U";
        }
        for (int i = 0; i < (d - c) / 2; i++) {
            curu--;
            cout << "D";
        }
        for (int i = 0; i < (c + d) / 2; i++) {
            curr++;
            cout <<"R";
        }
        for (int i = 0; i < (-c - d) / 2; i++) {
            curr--;
            cout << "L";
        }
        for (int i = 0; i < (e - max(abs(c), abs(d))); i += 2) {
            cout << "R";
            cout << "L";
        }
    }
    return 0;
}

#include<bits/stdc++.h>
#define For(i, a, b) for(int i = (a), en = (b); i <= en; ++i)
#define Rof(i, a, b) for(int i = (a), en = (b); i >= en; --i)
#define Tra(u, i) for(int i = hd[u]; ~i; i = e[i].net)
#define cst const
#define LL long long
#define DD double
#define LD long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define inf 0x3f3f3f3f
#define Inf 0x3f3f3f3f3f3f3f3f
#define eps 1e-12
#define maxn 2000000
using namespace std;

int n, m, a[2][maxn + 5], vis[maxn + 5];
LL t[maxn + 5], pos[2][maxn + 5];
int tt;
struct Node{LL a, b;} ord[maxn + 5];

template <class T>
void read(T &x){
	char ch;
	bool ok;
	for(ok = 0, ch = getchar(); !isdigit(ch); ch = getchar()) if(ch == '-') ok = 1;
	for(x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	if(ok) x = -x;
}

int L, R;
void get_rge(LL x, LL y, LL z){
	if(!x) return;
	LD l = (LD)(z - y) / x, r = (LD)(-z - y) / x;
	if(l > r) swap(l, r);
	L = max(L, (int)ceil(l - eps));
	R = min(R, (int)floor(r + eps));
}

int fl = 1;
void sol(int ty){
	memset(vis, 0, sizeof vis);
	memset(ord, 0, sizeof ord);
	For(i, 1, n){
		LL a = -t[i] / m, to = t[i] % m;
		if(to == m - 1){
			if(vis[to]){if(pos[ty][i] / (-a + 1) != ord[to].b){fl = 0; return;}}
			else{
				vis[to] = 1;
				ord[to].b = pos[ty][i] / (-a + 1);
			}
			continue;
		}
		if(vis[to]){
			if(ord[to].a == a && ord[to].b != pos[ty][i]){fl = 0; return;}
			if((pos[ty][i] - ord[to].b) % (ord[to].a - a)){fl = 0; return;}
			LL tem = (pos[ty][i] - ord[to].b) / (ord[to].a - a);
			if(vis[m - 1] && ord[m - 1].b != tem){fl = 0; return;}
			vis[m - 1] = 1;
			ord[m - 1] = (Node){0, tem};
		}
		else{
			vis[to] = 1;
			ord[to] = (Node){a, pos[ty][i]};
		}
	}
	L = ord[m - 1].b; R = ord[m - 1].b;
	if(!vis[m - 1]){
		L = -inf; R = inf;
		int pre = -1;
		For(i, 1, m - 2) if(vis[i]){
			get_rge(ord[i].a - ord[pre == -1 ? m : pre].a, ord[i].b - ord[pre == -1 ? m : pre].b, i - pre);
			pre = i;
		}
		get_rge(1 - ord[pre == -1 ? m : pre].a, -ord[pre == -1 ? m : pre].b, m - 1 - pre);
		if(L > R){fl = 0; return;}
		ord[m - 1].b = L;
		vis[m - 1] = 1;
	}
	LL tem = ord[m - 1].b, pre = -1;
	if(tt == 146){
		cout << L << " " << R << endl;
		cout << ord[0].a << " " << ord[0].b << endl;
		cout << ord[2000].a << " " << ord[2000].b << endl;
		cout << ord[4000].a << " " << ord[4000].b << endl;
		cout << ord[6000].a << " " << ord[6000].b << endl;
	}
	For(i, 0, m - 1) if(vis[i]){
		if(i != m - 1) ord[i].b += tem * ord[i].a;
		if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2) {if(tt == 146) cout << i << " " << pre << endl; break;}
		LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
		if(tem1 > i - pre){fl = 0; return;}
		For(j, pre + 1, pre + tem1) a[ty][j] = 1;
		pre = i;
		if(i == m - 1) return;
	}
	//if(tt == 146) cout << L << endl;
	if(tem + 1 >= L && tem + 1 <= R){
		memset(a[ty], 0, sizeof a[ty]);
		tem = ++ord[m - 1].b; pre = -1;
		For(i, 0, m - 1) if(vis[i]){
			if(i != m - 1) ord[i].b += ord[i].a;
			if((ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) % 2){fl = 0;/*if(tt == 146) cout << i << " " << pre << endl; */return;}
			LL tem1 = (ord[i].b - ord[pre == -1 ? m : pre].b + i - pre) / 2;
			if(tem1 > i - pre){fl = 0; return;}
			For(j, pre + 1, pre + tem1) a[ty][j] = 1;
			pre = i;
		}
	}
	else fl = 0;
}

int main(){
	//freopen("in", "r", stdin);
	read(n); read(m);
	For(i, 1, n){
		LL x, y; read(t[i]); read(x); read(y); t[i]--;
		if(i == 2) tt = y;
		LL tem = x;
		x = x + y;
		y = tem - y;
		pos[0][i] = x;
		pos[1][i] = y;
	}
	sol(1);
	if(!fl){puts("NO"); return 0;}
	sol(0);
	if(!fl){puts("NO"); return 0;}
	For(i, 0, m - 1){
		if(!a[0][i] && !a[1][i]) putchar('L');
		if(!a[0][i] && a[1][i]) putchar('D');
		if(a[0][i] && !a[1][i]) putchar('U');
		if(a[0][i] && a[1][i]) putchar('R');
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
#define int ll
#define double long double
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
#define dk (p[i+1].k-p[i].k)
#define db (p[i+1].b-p[i].b)
#define dx (!u?p[i+1].x-p[i].x:p[i+1].y-p[i].y)
const int N=2e5+5;
const int M=2e6+5;
int m,n,F[M][2];
struct Node{int x,y,t,k,b;}p[N];
bool cmp(Node A,Node B){return A.b<B.b;}
void Return(){puts("NO"),exit(0);}
bool P(int x){return abs(x)&1;}
int U(double x){return ceil(x);}
int D(double x){return floor(x);}
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),m=read();
	int flag=0;
	for(int i=1;i<=n;i++){
		int t=read(),x=read(),y=read();
		if(t==103&&x==1&&y==4)flag=1;
		p[i]=(Node){x+y,y-x,t,t/m,t%m};
	}
	p[++n]=(Node){0,0,0,0,0};
	p[++n]=(Node){0,0,0,-1,m};
	sort(p+1,p+n+1,cmp);
	for(int u=0;u<2;u++){
		int T=-1,L=-m-1,R=m+1,Res=0;
		for(int i=1;i<n;i++){
			int p0=P(dx-db),p1=P(dk);
			if(p0&&p1){if(T==0)Return();T=1;}
			else if(!p0&&p1){if(T==1)Return();T=0;}
			else if(p0&&!p1)Return();
			if(dk){
				double t0=1.0*(dx-db)/dk;
				double t1=1.0*(dx+db)/dk;
				if(dk>0)L=max(L,U(t0)),R=min(R,D(t1));
				else L=max(L,U(t1)),R=min(R,D(t0));
			}
			else if(!(dx-db<=0&&0<=dx+db))Return();
		}Res=L;
		if(T!=-1&&P(Res)!=T)Res++;
		if(flag)cout<<"Res::"<<Res<<" "<<L<<" "<<R<<" "<<T<<endl;
		if(Res>R)Return();

		for(int i=1;i<=n;i++){
			if(!u)p[i].x=p[i].x-p[i].k*Res;
			else p[i].y=p[i].y-p[i].k*Res;
		}
		for(int i=1;i<n;i++){
			if(dx){for(int j=p[i].b+1;j<=p[i].b+abs(dx);j++)F[j][u]=dx/abs(dx);}
			for(int j=p[i].b+abs(dx)+1;j<=p[i+1].b;j++)F[j][u]=j&1?1:-1;
		}
	}
	for(int i=1;i<=m;i++){
		if(F[i][0]==1&&F[i][1]==1)putchar('U');
		if(F[i][0]==-1&&F[i][1]==-1)putchar('D');
		if(F[i][0]==-1&&F[i][1]==1)putchar('L');
		if(F[i][0]==1&&F[i][1]==-1)putchar('R');
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define x first
#define y second

template<typename T0,typename T1>inline void check_min(T0 a,T1 &b){if(a<b)b=a;}
template<typename T0,typename T1>inline void check_max(T0 a,T1 &b){if(a>b)b=a;}

typedef long long ll;
typedef std::pair<ll,ll> pii;

const int N=201000,M=2010000;

int n,m;

namespace worker
{
	bool cmp(pii A,pii B){return A.x%m<B.x%m;}

	ll K[N],len[N],V[N];

	void build(int *t,int L,int R,int delta)
	{
		int pos=L-1;
		while(delta-- && pos<R)
			t[++pos]=1;
		while(pos<R)
			t[++pos]=-1;
	}

	int lim[N],pos[N];

	bool work(pii *s,int *t)
	{
		for(int i=1;i<=n;i++)
		{
			if((s[i].y+s[i].x)&1)return 0;
			s[i].y=(s[i].y+s[i].x)/2;
		}
		std::sort(s+1,s+n+1,cmp);
		for(int i=1;i<=n;i++)
			K[i]=s[i].x/m,len[i]=s[i].x%m,V[i]=s[i].y;

		for(int i=n;i>1;i--)
		{
			K[i]-=K[i-1];
			len[i]-=len[i-1];
			V[i]-=V[i-1];
		}

		pii tmp=pii(0,m);

		ll mod,res,L,R;
		for(int i=1;i<=n;i++)
		{
			if(!K[i])
			{
				if(V[i]<0 || V[i]>len[i])return 0;
				continue;
			}

			mod=K[i]<0?-K[i]:K[i];
			res=(V[i]%mod+mod)%mod;

			R=(V[i]-res)/K[i];
			L=R-(len[i]>=res?(len[i]-res)/K[i]:-1);

			if(K[i]<0)std::swap(L,R);

			check_min(R,tmp.y);
			check_max(L,tmp.x);
		}
		if(tmp.x>tmp.y)return 0;

		ll sm=tmp.y,sum=0;

		for(int i=1;i<=n;i++)
		{
			pos[i]=pos[i-1]+len[i];
			lim[i]=V[i]-sm*K[i];
			build(t,pos[i-1]+1,pos[i],lim[i]);
			sum+=lim[i];
		}
		if(pos[n]<m)build(t,pos[n]+1,m,sm-sum);

		/*
		ll sm=tmp.y,end=0;

		for(int i=1;i<=n;i++)
		{
			s[i].y-=(s[i].x/m)*sm;
			s[i].x%=m;

			build(t,s[i-1].x+1,s[i].x,end,s[i].y);
			end=s[i].y;
		}

		if(s[n].x<m)build(t,s[n].x+1,m,end,sm);
		*/

		return 1;
	}
}

namespace naoyuguo_chu_nan_ti_chao_feng_wo
{
	pii s[N],t[N];
	int X[M],Y[M];

	void initialize()
	{
		scanf("%d%d",&n,&m);
		ll ti,x,y;
		for(int i=1;i<=n;i++)
		{
			scanf("%lld%lld%lld",&ti,&x,&y);
			s[i]=pii(ti,x-y);
			t[i]=pii(ti,x+y);
		}
	}
	void solve()
	{
		initialize();

		if(!worker::work(s,X) || !worker::work(t,Y)){printf("NO\n");return;}

		for(int i=1;i<=m;i++)
			if(X[i]>0 && Y[i]>0)putchar('R');
			else if(X[i]>0 && Y[i]<0)putchar('D');
			else if(X[i]<0 && Y[i]>0)putchar('U');
			else putchar('L');
		printf("\n");
	}
}

int main()
{
//	freopen("c.in","r",stdin);
//	freopen("c.out","w",stdout);
	naoyuguo_chu_nan_ti_chao_feng_wo::solve();
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = (res<<3)+(res<<1)+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; const LL INF = 0x3f3f3f3f3f3f3f3f; int n,m; LL lx = -INF,rx = INF,ly = -INF,ry = INF; struct Point {LL x,y,k,r; il bool friend operator < (Point a,Point b) {return a.r < b.r;}} p[N];
	void main() {
		n = read(); m = read(); rep(i,1,n) {LL t = read(),x = read(),y = read(); if ((x^y^t)&1) {puts("NO"); return;} p[i] = (Point){x+y,y-x,t/m,t%m};} sort(p+1,p+n+1); p[++n] = (Point){0,0,-1,m};
		rep(i,1,n) {
			LL x = p[i].x-p[i-1].x,y = p[i].y-p[i-1].y,k = p[i].k-p[i-1].k,r = p[i].r-p[i-1].r;
			if (!k) {if (x-r > 0 || x+r < 0 || y-r > 0 || y+r < 0) {puts("NO"); return;}}
			else if (k > 0) {lx = max(lx,(LL)ceil(1.0L*(x-r)/k)); rx = min(rx,(LL)floor(1.0L*(x+r)/k)); ly = max(ly,(LL)ceil(1.0L*(y-r)/k)); ry = min(ry,(LL)floor(1.0L*(y+r)/k));}
			else {lx = max(lx,(LL)ceil(1.0L*(x+r)/k)); rx = min(rx,(LL)floor(1.0L*(x-r)/k)); ly = max(ly,(LL)ceil(1.0L*(y+r)/k)); ry = min(ry,(LL)floor(1.0L*(y-r)/k));}
		}
		if (n == 1001 && m == 2000000 && p[1].k == 0 && p[1].r == 1 && p[1].x == 1 && p[1].y == 1) printf("%lld %lld\n",lx,ly);
		if ((lx^m)&1) ++lx; if ((ly^m)&1) ++ly; if (lx > rx || ly > ry) {puts("NO"); return;}
		if (n == 1001 && m == 2000000 && p[1].k == 0 && p[1].r == 1 && p[1].x == 1 && p[1].y == 1) printf("%lld %lld\n",lx,ly);
		rep(i,1,n) {
			LL k = p[i].k-p[i-1].k,x = p[i].x-p[i-1].x-k*lx,y = p[i].y-p[i-1].y-k*ly;
			if (i == 2 && n == 1001 && m == 2000000 && p[1].k == 0 && p[1].r == 1 && p[1].x == 1 && p[1].y == 1) printf("\n%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n",x,y,k,lx,rx,p[2].x,p[1].x,p[2].x-p[1].x,p[2].x-p[1].x-lx,p[2].y,p[1].y,p[2].y-p[1].y,p[2].y-p[1].y-ly);
			rep(j,p[i-1].r+1,p[i].r) {if (x > 0) {--x; if (y > 0) {--y; putchar('U');} else {++y; putchar('R');}} else {++x; if (y > 0) {--y; putchar('L');} else {++y; putchar('D');}}}
		}
	}
}
int main() {qiqi::main(); return 0;}

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
#define endl '\n'

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

struct A {
    __int128_t t, x, y;
};
main() {
    INT(n, l);
    map<__int128_t, vector<A>> mp;
    bool flag = true;
    rep(i, n) {
        LL(t, x, y);
        mp[t % l].push_back(A{t, x, y});
        if(((abs(x) + abs(y)) ^ t) & 1) { flag = false; }
    }
    if(!flag) {
        cout << "NO\n";
        return 0;
    }
    struct rect {
        ll a, b, c, d;
        rect(ll a, __int128_t b, __int128_t c, __int128_t d) : a(a), b(b), c(c), d(d) {}
    };
    auto merge = [](rect &x, rect y) {
        chmax(x.a, y.a);
        chmax(x.b, y.b);
        chmin(x.c, y.c);
        chmin(x.d, y.d);
    };
    rect r(-l, -l, l, l);
    __int128_t px = 0, py = 0, k = 0;
    __int128_t pre = 0;
    // y * a >= x となる a
    auto Ceil = [](__int128_t x, __int128_t y) {
        __int128_t piv = x / y;
        __int128_t d = LLONG_MAX;
        __int128_t res;
        rep2(i, -1, 1) {
            if((piv + i) * y >= x)
                if(chmin(d, (piv + i) * y - x)) res = piv + i;
        }
        return res;
    };
    auto Floor = [](__int128_t x, __int128_t y) {
        __int128_t piv = x / y;
        __int128_t d = LLONG_MAX;
        __int128_t res;
        rep2(i, -1, 1) {
            if((piv + i) * y <= x)
                if(chmin(d, x - (piv + i) * y)) res = piv + i;
        }
        return res;
    };
    // 前回は (px,py) で 係数は k
    for(auto [x, v] : mp) {
        for(auto [t, aa, bb] : v) {
            ll a = aa - px + bb - py, b = aa - px - bb + py;
            __int128_t dx = x - pre;
            // debug(x);
            // debug(a);
            // debug(b);
            // debug(dx);
            __int128_t K = t / l;
            __int128_t dk = K - k;
            // debug(dk);
            if(!dk and max(abs(a), abs(b)) > dx) {
                cout << "NO\n";
                return 0;
            }
            if(dk) {
                __int128_t aa = Floor(a - dx, dk), bb = Floor(b - dx, dk), cc = Ceil(a + dx, dk), dd = Ceil(b + dx, dk);
                if(aa > cc) swap(aa, cc);
                if(bb > dd) swap(bb, dd);
                merge(r, rect(aa, bb, cc, dd));
                // merge(r, rect(Floor(a - dx, dk), Floor(b - dx, dk), Ceil(a + dx, dk), Ceil(b + dx, dk)));
                // cout << Floor(a - dx, dk) << " " << Floor(b - dx, dk) << " " << Ceil(a + dx, dk) << " " << Ceil(b + dx, dk) << endl;
            }
            // cout << r.a << " " << r.b << " " << r.c << " " << r.d << endl;
            px = aa, py = bb;
            k = K;
            pre = x;
        }
    }
    if(r.a > r.c or r.b > r.d) {
        cout << "NO\n";
        return 0;
    }
    int t = r.a, s = r.b;
    // cout << t << " " << s << endl;
    __int128_t dx = (t + s) / 2, dy = (t - s) / 2;
    pre = 0, px = 0, py = 0;
    string ans;
    // cout << dx << " " << dy << endl;
    for(auto [T, v] : mp) {
        __int128_t TT = v.back().t / l;
        ll a = v.back().x - TT * dx - px, b = v.back().y - TT * dy - py;
        // debug(a);
        // debug(b);
        if(abs(a) + abs(b) > T - pre) {
            cout << "NO\n";
            return 0;
        }
        if(a < 0) { rep(i, -a) ans.pb('L'); }
        if(a > 0) rep(i, a) ans.pb('R');
        if(b < 0) rep(i, -b) ans.pb('D');
        if(b > 0) rep(i, b) ans.pb('U');
        rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
        if((T - pre - abs(a) - abs(b)) & 1) {
            cout << "NO\n";
            return 0;
        }
        pre = T;
        px += a, py += b;
    }
    ll a = dx - px, b = dy - py;
    __int128_t T = l;
    if(abs(a) + abs(b) > T - pre) {
        cout << "NO\n";
        return 0;
    }
    if(a < 0) { rep(i, -a) ans.pb('L'); }
    if(a > 0) rep(i, a) ans.pb('R');
    if(b < 0) rep(i, -b) ans.pb('D');
    if(b > 0) rep(i, b) ans.pb('U');
    rep(i, (T - pre - abs(a) - abs(b)) / 2) ans.pb('R'), ans.pb('L');
    if((T - pre - abs(a) - abs(b)) & 1) {
        cout << "NO\n";
        return 0;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
#define ll long long
#define lld long double
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 101000;
struct node{ll w,k,c;}a[N],b[N];
int s1[N],s2[N],n,L;
void fail(){puts("NO");exit(0);}
ll ceil(ll a,ll b){
	if(a<0) a=-a,b=-b;
	if(b<0) return a/b;
	return (a+b-1)/b;
}
ll floor(ll a,ll b){
	if(a<0) a=-a,b=-b;
	if(b<0) return (a+b-1)/b;
	return a/b;
}
void solve(node*a,int*ans){
	sort(a+1,a+n+1,[](node a,node b){return a.w<b.w;});
	a[n+1]={L,-1,0};
	ll l=0,r=L;
	for(int i=1;i<=n;i++){
		ll k1=a[i+1].w-a[i].w,k2=a[i+1].k-a[i].k,k3=a[i+1].c-a[i].c;
		if(k2>0){
			l=max(l,ceil(k3,k2));
			r=min(r,floor(k1+k3,k2));
		}
		if(k2<0){
			l=max(l,ceil(k1+k3,k2));
			r=min(r,floor(k3,k2));
		}
		if(l>r||!k2&&(k3<0||k3>k1)) fail();
	}
	for(int i=0;i<=n;i++){
		ll now=(a[i+1].c-a[i+1].k*l)-(a[i].c-a[i].k*l);
		for(int j=a[i].w+1;j<=a[i].w+now;j++)
			ans[j]=1;
	}
}
int main(){
	read(n);read(L);
	for(int i=1;i<=n;i++){
		ll t,x,y;
		read(t);read(x);read(y);
		if(x+y+t&1) fail();
		a[i]={t%L,t/L,(x+y+t)/2};
		b[i]={t%L,t/L,(x-y+t)/2};
	}
	solve(a,s1);
	solve(b,s2);
	for(int i=1;i<=L;i++)
		putchar("LDUR"[s1[i]<<1|s2[i]]);
	puts("");
	return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stdio.h>
#include <ctime>
#include <cstdlib>
#include <utility>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

#define inf (999999999999LL)
#define pii pair<int,int>
#define pip pair<int,pii>
#define pll pair<long long,long long>
#define plp pair<long long,pll>
#define eps 1e-8

#ifdef ONLINE_JUDGE
#define debug(args...)
#else
#define debug(args...) fprintf(stderr,args)
#endif

#define pb push_back
#define mod 1000000007
#define maxn 200200
#define maxl 2002000

using namespace std;

int qnt[maxl];
long long x[maxl];
long long y[maxl];
long long t[maxl];

char ans[maxl];

int wx[maxl];
int wy[maxl];

main(){

		int n,l;
		scanf("%d%d",&n,&l);

		int fixo = 0;
		long long fx,fy;

		vector<plp> v;

		for(int i=0;i<=n;i++){
			long long a,b,c;
			scanf("%I64d%I64d%I64d",&a,&b,&c);
			if(i == n) a = b = c = 0;
			v.pb(plp(a,pll(b,c)));
			if((a^b^c)&1){
				printf("NO\n");
				return 0;
			}
			if(qnt[a%l]){
				fixo = 1;
				long long dx = b - x[a%l];
				long long dy = c - y[a%l];
				long long dt = a/l - t[a%l];
				debug("dx dy dt %I64d %I64d %I64d\n",dx,dy,dt);
				if(dx%dt || dy%dt){
					printf("NO\n");
					return 0;
				}
				fx = dx / dt;
				fy = dy / dt;
				continue;
			}
			qnt[a%l]++;
			t[a%l] = a/l;
			x[a%l] = b;
			y[a%l] = c;
		}

		long double x1,x2,y1,y2;
		int f = 1;
		int last = 0;

		long long sdx=0, sdy=0, st=0;

		if(fixo)
			debug("fixo %d %d\n",fx,fy);

		for(int i=1;i<=l&&!fixo;i++) if(qnt[i] || i == l) {

			long long dx,dy,T;
			long long len = i - last;

			if(i != l){
				dx = x[i] - x[last];
				dy = y[i] - y[last];

				T = t[i] - t[last];
				sdx += dx;
				sdy += dy;
				st += T;
			}
			else {
				T = st+1;
				dx = sdx;
				dy = sdy;
			}

			debug("dx dy len T %I64d %I64d %I64d %I64d\n",dx,dy,len,T);

			if(T > 2*l){
				fixo = 1;
				long long t1 = dx / T;
				if(abs(t1*T-dx) > abs((t1+1)*T-dx))t1++;
				if(abs(t1*T-dx) > abs((t1-1)*T-dx))t1--;
				fx = t1;
				t1 = dy / T;
				if(abs(t1*T-dy) > abs((t1+1)*T-dy))t1++;
				if(abs(t1*T-dy) > abs((t1-1)*T-dy))t1--;
				fy = t1;
				continue;
			}

			if(T == 0) continue;

			long double xa = (long double)dx/T;
			long double xb = xa;
			long double ya = (long double)dy/T - (long double)len/T;
			long double yb = (long double)dy/T + (long double)len/T;
			debug("x %lf y %lf~%lf\n",(double)xa,(double)ya,(double)yb);

			long double xar = (xa+ya)/2;
			long double yar = (ya-xa)/2;
			long double xbr = (xb+yb)/2;
			long double ybr = (yb-xb)/2;

			last = i;

			if(f){
				f = 0;
				x1 = xar;
				y1 = yar;
				x2 = xbr;
				y2 = ybr;
				continue;
			}

			x1 = max(x1,xar);
			y1 = max(y1,yar);
			x2 = min(x2,xbr);
			y2 = min(y2,ybr);

		}

		debug("-> %lf;%lf : %lf;%lf\n",(double)x1,(double)y1,(double)x2,(double)y2);

		if(!fixo){
			if(l&1) x1 += .5, x2 += .5, y1 += .5, y2 += .5;
			if(x1 > x2+eps || y1 > y2+eps){
				printf("NO\n");
				return 0;
			}
			long double r = (int)(x2+eps);
			if(x1-eps > r){
				printf("NO\n");
				return 0;
			}
			long double s = (int)(y2+eps);
			if(y1-eps > s){
				printf("NO\n");
				return 0;
			}
			if(l&1) r -= .5, s -= .5;
			fx = (int)(r-s+eps);
			fy = (int)(r+s+eps);
		}

		debug("ok %d %d\n",fx,fy);

		last = 0;
		int ax = fx, ay = fy;

		for(int i=1;i<l;i++) if(qnt[i]) {

			long long T = t[i] - t[last];
			long long dx = x[i] - x[last] - T * fx;
			long long dy = y[i] - y[last] - T * fy;
			long long len = i - last;
			debug("%d - %d %I64d %I64d\n",i,last,dx,dy);
			if(abs(dx)+abs(dy) > len){
				debug("$");
				printf("NO\n");
				return 0;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			for(int j=last;j<i;j++){
				if(dx<0) ans[j] = 'L', dx++, ax++;
				else if(dx>0) ans[j] = 'R', dx--, ax--;
				else if(dy<0) ans[j] = 'D', dy++, ay++;
				else if(dy>0) ans[j] = 'U', dy--, ay--;
				else ans[j] = 'U', dy--, ay--;
			}
			debug("dx dy ax ay %I64d %I64d %d %d\n",dx,dy,ax,ay);
			assert((dx|dy)==0);
			last = i;

		}

		debug("ax ay %d %d\n",ax,ay);

		for(int i=last;i<l;i++){
			if(ax<0) ans[i] = 'L', ax++;
			else if(ax>0) ans[i] = 'R',ax--;
			else if(ay<0) ans[i] = 'D', ay++;
			else if(ay>0) ans[i] = 'U',ay--;
			else ans[i] = 'U', ay--;
		}

		wx[0] = wy[0] = 0;
		for(int i=1;i<l;i++){
			wx[i] = wx[i-1];
			wy[i] = wy[i-1];
			if(ans[i-1] == 'U') wy[i]++;
			if(ans[i-1] == 'D') wy[i]--;
			if(ans[i-1] == 'R') wx[i]++;
			if(ans[i-1] == 'L') wx[i]--;
		}

		for(int i=0;i<v.size();i++){
			long long u = v[i].first;
			long long X = fx * (u/l) + wx[u%l];
			long long Y = fy * (u/l) + wy[u%l];
			if(X != v[i].second.first || Y != v[i].second.second){
				debug("! %I64d (%I64d;%I64d)\n",v[i].first,X,Y);
				printf("NO\n");
				return 0;
			}
		}

		for(int i=0;i<l;i++)
			printf("%c",ans[i]);
		printf("\n");

}

#include <bits/stdc++.h>
using namespace std;
long long read();
void chmax(long long &x, long long y) { x < y ? x = y : x; }
void chmin(long long &x, long long y) { x > y ? x = y : x; }
struct I {
    long long lx, rx, ly, ry;

    void merge(I a) {
        chmax(lx, a.lx), chmin(rx, a.rx), chmax(ly, a.ly), chmin(ry, a.ry);
    }
    bool ok() {
        if (rx > lx || ry > ly) return 1;
        if (rx < lx || ry < ly) return 0;
        return ~(lx + ly) & 1;
    }
} R;

I M(I a, I b) { return a.merge(b), a; }

I solve(long long tx, long long ty, long long k, long long T) {
    long long x = tx + ty, y = tx - ty;
    if (k < 0) T = -T;
    return (I){ceil(1.0 * (x - T) / k), floor(1.0 * (x + T) / k),
               ceil(1.0 * (y - T) / k), floor(1.0 * (y + T) / k)};
}

long long n, l;
struct P {
    long long k, x, y, tl;
    void init() { tl = (k = read()) % l, k /= l, x = read(), y = read(); }
} p[200005];
bool cmp(P a, P b) { return a.tl < b.tl; }

char res[2000006];
int len;

void work1(P a, P b) {
    long long t = a.tl - b.tl, x = a.x - b.x, y = a.y - b.y;
    while (t - 1 >= abs(x) + abs(y + 1)) res[++len] = 'D', --t, ++y;
    while (t - 1 >= abs(x + 1) + abs(y)) res[++len] = 'L', --t, ++x;
    while (t - 1 >= abs(x - 1) + abs(y)) res[++len] = 'R', --t, --x;
    while (t - 1 >= abs(x) + abs(y - 1)) res[++len] = 'U', --t, --y;
}

void work2(P a, P b) {
    long long x = b.x - a.x, y = b.y - a.y, k = b.k - a.k, t = a.tl - b.tl;
    while (M(R, solve(x, y - 1, k, t - 1)).ok())
        R.merge(solve(x, y - 1, k, t - 1)), --t, --y, res[++len] = 'D';
    while (M(R, solve(x - 1, y, k, t - 1)).ok())
        R.merge(solve(x - 1, y, k, t - 1)), --t, --x, res[++len] = 'L';
    while (M(R, solve(x + 1, y, k, t - 1)).ok())
        R.merge(solve(x + 1, y, k, t - 1)), --t, ++x, res[++len] = 'R';
    while (M(R, solve(x, y + 1, k, t - 1)).ok())
        R.merge(solve(x, y + 1, k, t - 1)), --t, ++y, res[++len] = 'U';
}

int main() {
    n = read(), l = read();
    for (int i = 1; i <= n; ++i) p[i].init();
    sort(p + 1, p + 1 + n, cmp);
    p[0] = (P){0, 0, 0, 0}, p[++n] = (P){-1, 0, 0, l};
    R.lx = R.ly = -1e18, R.rx = R.ry = 1e18;
    for (int i = 1; i <= n; ++i) {
        if (p[i].k == p[i - 1].k) continue;
        R.merge(solve(p[i - 1].x - p[i].x, p[i - 1].y - p[i].y,
                      p[i - 1].k - p[i].k, p[i].tl - p[i - 1].tl));
    }
    if (!R.ok()) return puts("NO"), 0;
    // cerr << "################################\n";
    for (int i = 0; i < n; ++i) {
        if (p[i].tl == p[i + 1].tl) continue;
        (p[i].k == p[i + 1].k) ? work1(p[i + 1], p[i]) : work2(p[i + 1], p[i]);
    }

    for (int i = 1; i <= len; ++i) putchar(res[i]);
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
long long read() {
    long long x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int64;

int N, L;
int64 T[200002], X[200002], Y[200002];
int64 aT[200002], aX[200002], aY[200002];
int pos[200002];
int W1[2000002], W2[2000002];

inline int gett(int x)
{
    if (x == 0) return 0;
    return (x % L == 0 ? L : x % L);
}
inline bool compare(const int& i1, const int& i2)
{
    return gett(T[i1]) > gett(T[i2]);
}
inline void constr(int64 i1, int64 i2, int64 need, int64 tm, int64& v1, int64& v2)
{
    // i1 <= need - tm * S <= i2
    //cout << i1 << " <= " << need << " - " << tm << " * S <= " << i2 << " | " << v2 << '\n';

    if (tm == 0 && !(i1 <= need && need <= i2))
    {
        cout << "NO\n";
        exit(0);
    }
    else if (tm == 0)
        return;

    if (tm < 0)
    {
        int64 lim1 = ((i1 - need) / (-tm) + (i1 - need) % (-tm) != 0);
        int64 lim2 = (i2 - need) / (-tm);

        v1 = max(v1, lim1);
        v2 = min(v2, lim2);
    }
    else
    {
        int64 lim1 = -((i2 - need) / tm);
        int64 lim2 = -((i1 - need) / tm) + ((i1 - need) % tm != 0);

        v1 = max(v1, lim1);
        v2 = min(v2, lim2);
    }
}

int main()
{
    cin.sync_with_stdio(false);

    cin >> N >> L;
    for (int i = 1; i <= N; ++i)
    {
        cin >> T[i] >> X[i] >> Y[i];
        if ((T[i] + X[i] + Y[i]) % 2 != 0 || T[i] + X[i] + Y[i] < 0)
        {
            cout << "NO\n";
            return 0;
        }

        aT[i] = T[i];
        aX[i] = X[i];
        aY[i] = Y[i];
        pos[i] = i;
    }
    sort(pos + 1, pos + N + 1, compare);

    for (int i = 1; i <= N; ++i)
    {
        T[i] = aT[pos[i]];
        X[i] = aX[pos[i]];
        Y[i] = aY[pos[i]];
    }

    // A = (X + Y + T) / 2 => [0 or 1]

    int64 v1 = 0, v2 = L;
    for (int i = 1; i <= N; ++i)
    {
        int64 need1 = (X[i] + Y[i] + T[i]) / 2;
        int64 need2 = (X[i + 1] + Y[i + 1] + T[i + 1]) / 2;

        int64 need = need1 - need2;
        int64 tm = ((T[i] - 1) / L) - ((T[i + 1] - 1) / L);

        int64 i1 = 0, i2 = gett(T[i]) - gett(T[i + 1]);

        // i1 <= need - tm * S <= i2
        constr(i1, i2, need, tm, v1, v2);

        // 0 <= need1 - tm * S <= S
        constr(0, (1LL << 60), need1, ((T[i] - 1) / L), v1, v2);
        constr(-(1LL << 60), 0, need1, ((T[i] - 1) / L) + 1, v1, v2);
    }

    if (v1 > v2)
    {
        cout << "NO\n";
        return 0;
    }

    int last = 0;
    for (int i = N; i >= 1; --i)
    {
        int64 need = (X[i] + Y[i] + T[i]) / 2;
        W1[gett(T[i])] = need - v1 * ((T[i] - 1) / L);

        int now = gett(T[i]), dif = W1[now] - W1[last];
        for (int j = last + 1; j <= now; ++j)
        {
            W1[j] = W1[j - 1] + (dif > 0);
            --dif;
        }

        last = now;
    }
    for (int i = last + 1; i <= L; ++i)
        W1[i] = W1[i - 1];

    // A = (X - Y + T) / 2 => [0 or 1]

    v1 = 0, v2 = L;
    for (int i = 1; i <= N; ++i)
    {
        int64 need1 = (X[i] - Y[i] + T[i]) / 2;
        int64 need2 = (X[i + 1] - Y[i + 1] + T[i + 1]) / 2;

        int64 need = need1 - need2;
        int64 tm = ((T[i] - 1) / L) - ((T[i + 1] - 1) / L);

        int64 i1 = 0, i2 = gett(T[i]) - gett(T[i + 1]);

        // i1 <= need - tm * S <= i2
        constr(i1, i2, need, tm, v1, v2);

        // 0 <= need1 - tm * S <= S
        constr(0, (1LL << 60), need1, ((T[i] - 1) / L), v1, v2);
        constr(-(1LL << 60), 0, need1, ((T[i] - 1) / L) + 1, v1, v2);
    }

    if (v1 > v2)
    {
        cout << "NO\n";
        return 0;
    }

    last = 0;
    for (int i = N; i >= 1; --i)
    {
        int64 need = (X[i] - Y[i] + T[i]) / 2;
        W2[gett(T[i])] = need - v1 * ((T[i] - 1) / L);

        int now = gett(T[i]), dif = W2[now] - W2[last];
        for (int j = last + 1; j <= now; ++j)
        {
            W2[j] = W2[j - 1] + (dif > 0);
            --dif;
        }

        last = now;
    }
    for (int i = last + 1; i <= L; ++i)
        W2[i] = W2[i - 1];

    for (int i = 1; i <= L; ++i)
    {
        int sum = (W1[i] == W1[i - 1] ? -1 : 1);
        int dif = (W2[i] == W2[i - 1] ? -1 : 1);

        int gox = (sum + dif) / 2;
        int goy = sum - gox;

        if (gox == 1)
            cout << 'R';
        else if (gox == -1)
            cout << 'L';
        else if (goy == 1)
            cout << 'U';
        else
            cout << 'D';
    }
    cout << '\n';
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200010;
const int lMAX = 2000010;
const ll MAX = 4000000000000000000ll;

struct point
{
	ll t, x, y, r, mod, orz[2];
};

point p[N];
ll n, l, ans1[lMAX], ans2[lMAX], _x[N], _y[N];

bool compare(point a, point b)
{
	return a.mod < b.mod;
}

ll floor (ll a, ll b)
{
	ll ans = 0;
	if (a > 0 ^ b > 0 && a % b)
		ans = -1;
	ans += a / b;
	return ans;
}

ll ceil (ll a, ll b)
{
	ll ans = 0;
	if (!(a > 0 ^ b > 0) && a % b)
		ans = 1;
	ans += a / b;
	return ans;
}

void check(int type, ll *ans)
{
	ll smax = MAX, smin = -MAX;
	for (int i = 0; i <= n; i++)
		ans[i] = -1;
	for (int i = 0; i < n; i++)
	{
		ll dr = p[i + 1].r - p[i].r, dmod = p[i + 1].mod - p[i].mod, dx = p[i + 1].orz[type] - p[i].orz[type];
		if (!dr)
		{
			if (dmod < dx)
			{
				printf("NO");
				exit(0);
			}
			continue;
		}
		if (dr > 0)
		{
			smax = min(smax, floor(dx, dr));
			smin = max(smin, ceil(dx - dmod, dr));
		}
		else
		{
			smax = min(smax, floor(dx - dmod, dr));
			smin = max(smin, ceil(dx, dr));
		}
		if (smax < smin)
		{
			printf("NO");
			exit(0);
		}
	}
	if (smax == MAX && smin == -MAX)
		ans[l] = p[p[n].t].orz[type] + l - p[n].t;
	else
		ans[l] = smax;
	for (int i = 0; i <= n; i++)
		ans[p[i].mod] = p[i].orz[type] - ans[l] * p[i].r;
	int i = 0, j = 0;
	while (i < l)
	{
		j = i + 1;
		while (ans[j] == -1 && j < l)
			j++;
		ll cnt = ans[j] - ans[i];
		for (int k = i + 1; k < j; k++)
		{
			if (cnt)
			{
				ans[k] = ans[k - 1] + 1;
				cnt--;
			}
			else
				ans[k] = ans[k - 1];
		}
		i = j;
	}
	for (int k = 0; k <= l; k++)
		ans[k] = 2 * ans[k] - k;
}
int main()
{
	scanf("%I64d%I64d", &n, &l);
	p[0].t = p[0].x = p[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%I64d%I64d%I64d", &p[i].t, &p[i].x, &p[i].y);
		if (p[i].x + p[i].y + p[i].t & 1)
			return printf("NO"), 0;
		p[i].r = p[i].t / l;
		p[i].mod = p[i].t % l;
		p[i].orz[0] = p[i].x + p[i].y + p[i].t >> 1;
		p[i].orz[1] = p[i].x - p[i].y + p[i].t >> 1;
	}
	sort(p, p + n + 1, compare);
	check(0, ans1);
	check(1, ans2);
	for (int i = 1; i <= l; i++)
	{
		ll dx, dy;
		dx = ans1[i] + ans2[i] - ans1[i - 1] - ans2[i - 1] >> 1;
		dy = ans1[i] - ans2[i] - ans1[i - 1] + ans2[i - 1] >> 1;
		if (dx == 1)
			putchar('R');
		else if (dx == -1)
			putchar('L');
		else if (dy == 1)
			putchar('U');
		else
			putchar('D');
	}
	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#define db long double
#define PB push_back
#define ll long long
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); }
ll Abs(ll x) { return x>0?x:-x; }
db eps=1e-20;
int dcmp(db x) { return x>-eps?(x>eps):-1; }
const int N=2e6+10;
vector<int> pos;
struct node { ll t,x,y; }v[N];
ll val[N],ti[N];
int vis[N];
int m,n;
db lb,rb;
vector<char> S;
void modify(int p,ll x,ll delt) {
	if(Abs((delt*m+p)%2)^Abs(x%2)) {
//		if(curtest) cout<<"FUCK:"<<delt*m+p<<' '<<x<<endl;
		FAIL();
	}
	lb=max(lb,-(m-p)+(db)x);
	rb=min(rb,m-p+(db)x);
	if(delt==0) return;
	ll l=min(-p,p)-x,r=max(-p,p)-x; db 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)
		modify(pos[i+1]%m-pos[i],val[pos[i+1]]-val[pos[i]],ti[pos[i+1]]-ti[pos[i]]);

//	if(curtest) printf("%.10Lf %.10Lf\n",lb,rb);

	ll 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;
		ll 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.PB(d);
		if(len<0||(len&1)) {
//			if(curtest) printf("FUCK2: %d %d %d %lld %lld\n",l,r,len,(r==m?dx:val[r])-val[l]-(ti[r]-ti[l])*dx,x);
			FAIL();
		}
		while(len) ans.PB(1),ans.PB(-1),len-=2;
	}
}

ll dx,dy;
void solve(int l,int r,ll x,ll y,ll 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.PB(xx),r--;
	while(y--) S.PB(yy),r--;
	if(((r-l)&1)||r-l<0) FAIL();
	while(r-l) S.PB('U'),S.PB('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;
			}
			ll 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(n==99&&m==101&&v[2].t==1&&v[2].x==4&&v[2].y==-5) curtest=1;
//	if(n==200000&&m==2000000&&v[3].x==0&&v[3].y==1) curtest=1;

//	if(curtest) cout<<"flg="<<flg<<endl;

	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.PB(i);
		pos.PB(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;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#define Fail puts("NO") , exit(0)
using namespace std;
typedef long long ll;
inline ll read()
{
	ll x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{if(ch == '-')	f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 2e5 + 5;
const ll inf = 4e18;
int n , l;
struct node
{
	ll k , w , t , x , y;
	node(ll k = 0,ll w = 0,ll t = 0,ll x = 0,ll y = 0) : k(k) , w(w) , t(t) , x(x) , y(y) {}
	inline void Get()
	{
		t = read(); ll p = read() , q = read();
		if((t ^ p ^ q) & 1) Fail;
		x = (p + q + t) / 2; y = (q - p + t) / 2;
		k = t / l; w = t % l;
	}
	inline friend bool operator < (const node &a,const node &b) { return a.w < b.w;}
} e[N];
int main()
{
	n = read(); l = read();
	for(int i = 1;i <= n;i ++) e[i].Get();
	std::sort(e + 1,e + 1 + n);
	e[++ n] = node(-1,l);
	ll lx = -inf , rx = inf , ly = -inf , ry = inf;
	for(int i = 1;i <= n;i ++)
	{
		ll k = e[i].k - e[i - 1].k , w = e[i].w - e[i - 1].w;
		if(!k)
		{
			if(e[i].x - e[i - 1].x - w > 0 || e[i].x - e[i - 1].x < 0) Fail;
			if(e[i].y - e[i - 1].y - w > 0 || e[i].y - e[i - 1].y < 0) Fail;
		}
		else if(k > 0)
		{
			lx = max(lx,(ll)ceil((e[i].x - e[i - 1].x - w) / k));
			rx = min(rx,(ll)floor((e[i].x - e[i - 1].x) / k));
			ly = max(ly,(ll)ceil((e[i].y - e[i - 1].y - w) / k));
			ry = min(ry,(ll)floor((e[i].y - e[i - 1].y) / k));
		}
		else
		{
			lx = max(lx,(ll)ceil((e[i - 1].x - e[i].x) / -k));
			rx = min(rx,(ll)floor((e[i - 1].x - e[i].x + w) / -k));
			ly = max(ly,(ll)ceil((e[i - 1].y - e[i].y) / -k));
			ry = min(ry,(ll)floor((e[i - 1].y - e[i].y + w) / -k));
		}
	}
	if(lx > rx || ly > ry) Fail;
	for(int i = 1;i <= n;i ++)
	{
		ll dx = (e[i].x - e[i].k * lx) - (e[i - 1].x - e[i - 1].k * lx) , dy = (e[i].y - e[i].k * ly) - (e[i - 1].y - e[i - 1].k * ly) , T = e[i].w - e[i - 1].w , x = 0 , y = 0;
		while(T --> 0)
		{
			if(x < dx)
			{
				x ++;
				if(y < dy) putchar('U') , y ++;
				else putchar('R');
			}
			else
			{
				if(y < dy) putchar('L') , y ++;
				else putchar('D');
			}
		}
	}
	return 0;
}