QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#164257#6615. Cross the MazeLFCodeAC ✓32ms7548kbC++143.7kb2023-09-04 20:58:572023-09-04 20:58:57

Judging History

你现在查看的是最新测评结果

  • [2023-09-04 20:58:57]
  • 评测
  • 测评结果:AC
  • 用时:32ms
  • 内存:7548kb
  • [2023-09-04 20:58:57]
  • 提交

answer

#include<cstdio>
#include<cstdlib>
#define lg(x) (31-__builtin_clz(x))
#define llg(x) (63-__builtin_clzll(x))
const int N=114,P=100086,MOD=998244353,INF=1e9+7;
int n,a,b,qh,qt,s,t,tot,ax,ay;
int px[N],py[N],qx[N],qy[N],d[P],h[P],fir[P],q[P];
int xx[4]={-1,0,1,0},
    yy[4]={0,-1,0,1};
char ansl[N*3];
struct edge{int v,w,nxt;}e[5000086];
int Abs(int x){return x<0?-x:x;}
int lowbit(int x){return x&(-x);}
int Max(int a,int b){return a>b?a:b;}
int Min(int a,int b){return a<b?a:b;}
int Swap(int &a,int &b){a^=b^=a^=b;return true;}
int Add(int &a,int b){return(a+=b)>=MOD?a-=MOD:a;}
int vAdd(int a,int b){return(a+=b)>=MOD?a-=MOD:a;}
int Sub(int &a,int b){return(a-=b)<0?a+=MOD:a;}
int vSub(int a,int b){return(a-=b)<0?a+=MOD:a;}
int Mul(int a,int b){return 1ll*a*b%MOD;}
int qpow(int a,int b){
	int ret=1;
	while(b){if(b&1)ret=Mul(ret,a);a=Mul(a,a);b>>=1;}
	return ret;
}
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
bool add(int u,int v,int w){e[++tot].v=v;e[tot].w=w;e[tot].nxt=h[u];h[u]=tot;return true;}
bool otm(int x,int y){return x<1||x>a||y<1||y>b;}
int pos(int x,int y,int t,int flr){return (t*a*b+b*(x-1)+y)*2-flr;}
bool bfs(){
	for(int i=0;i<=t;i++)fir[i]=d[i]=0;
	d[q[qh=qt=1]=s]=1;fir[s]=h[s];
	while(qh<=qt){
		int np=q[qh++];
		for(int i=h[np];i;i=e[i].nxt){
			if(e[i].w==0||d[e[i].v])continue;
			d[e[i].v]=d[np]+1;
			fir[e[i].v]=h[e[i].v];
			q[++qt]=e[i].v;
			if(e[i].v==t){
				while(0);
				return true;
			}
		}
	}
	return false;
}
int dfs(int np,int flw){
	if(np==t)return flw;int rst=flw;
	for(int i=fir[np];i&&rst;i=e[i].nxt){
		fir[np]=i;
		if(e[i].w==0||d[e[i].v]!=d[np]+1)continue;
		int k=dfs(e[i].v,Min(rst,e[i].w));
		if(!k)d[e[i].v]=0;
		e[i].w-=k;e[i^1].w+=k;rst-=k;
	}
	return flw-rst;
}
int dinic(){
	int delta=0,ans=0;
	while(bfs())while(delta=dfs(s,INF))ans+=delta;
	return ans;
}
bool solve(int tme){
	s=0;t=(tme+1)*a*b*2+1;tot=1;
	for(int i=s;i<=t;i++)h[i]=0;
	for(int i=0;i<=tme;i++)
		for(int x=1;x<=a;x++)
			for(int y=1;y<=b;y++){
				add(pos(x,y,i,1),pos(x,y,i,0),1);
				add(pos(x,y,i,0),pos(x,y,i,1),0);
				if(i==tme)continue;
				add(pos(x,y,i,0),pos(x,y,i+1,1),1);
				add(pos(x,y,i+1,1),pos(x,y,i,0),0);
				for(int j=0;j<4;j++){
					if(otm(x+xx[j],y+yy[j]))continue;
					add(pos(x,y,i,0),pos(x+xx[j],y+yy[j],i+1,1),1);
					add(pos(x+xx[j],y+yy[j],i+1,1),pos(x,y,i,0),0);
				}
			}
	for(int i=1;i<=n;i++){
		add(0,pos(px[i],py[i],0,1),1);
		add(pos(px[i],py[i],0,1),0,0);
		add(pos(qx[i],qy[i],tme,0),t,1);
		add(t,pos(qx[i],qy[i],tme,0),0);
	}
	return dinic()==n;
}
bool getans(int x,int y,int t,int lim){
	if(t==lim){ax=x;ay=y;return true;}int np=pos(x,y,t,0);
	for(int i=h[np];i;i=e[i].nxt){
		if(e[i].w)continue;
		if(e[i].v==pos(x,y,t+1,1)){ansl[t]='S';return getans(x,y,t+1,lim);}
		if(y>1&&e[i].v==pos(x,y-1,t+1,1)){ansl[t]='L';return getans(x,y-1,t+1,lim);}
		if(y<b&&e[i].v==pos(x,y+1,t+1,1)){ansl[t]='R';return getans(x,y+1,t+1,lim);}
		if(x>1&&e[i].v==pos(x-1,y,t+1,1)){ansl[t]='U';return getans(x-1,y,t+1,lim);}
		if(x<a&&e[i].v==pos(x+1,y,t+1,1)){ansl[t]='D';return getans(x+1,y,t+1,lim);}
	}
	return false;
}
bool print(int x,int ans){
	getans(px[x],py[x],0,ans);
	printf("%d %d %d %d ",px[x],py[x],ax,ay);
	for(int i=0;i<ans;i++)putchar(ansl[i]);
	putchar('\n');
	return true;
}
int main(){
	n=read();a=read();b=read();
	for(int i=1;i<=n;i++){px[i]=read();py[i]=read();}
	for(int i=1;i<=n;i++){qx[i]=read();qy[i]=read();}
	int mx=a+b+n,np=0;
	for(int i=lg(mx);i+1;i--){
		if(np+(1<<i)>mx)continue;
		if(!solve(np+(1<<i)))np+=(1<<i);
	}
	solve(++np);printf("%d\n",np);
	for(int i=1;i<=n;i++)print(i,np);
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

input:

3 4 4
1 1
1 4
4 4
1 3
2 3
2 4

output:

2
1 1 1 3 RR
1 4 2 3 DL
4 4 2 4 UU

result:

ok answer 2

Test #2:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

3 2 2
1 1
1 2
2 2
1 1
2 1
2 2

output:

1
1 1 1 1 S
1 2 2 2 D
2 2 2 1 L

result:

ok answer 1

Test #3:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

2 3 3
1 1
1 3
1 2
2 2

output:

2
1 1 1 2 RS
1 3 2 2 DL

result:

ok answer 2

Test #4:

score: 0
Accepted
time: 1ms
memory: 1876kb

input:

2 10 10
2 9
3 8
10 5
10 10

output:

10
2 9 10 10 DRDDDDDDDS
3 8 10 5 DDDDDDDLLL

result:

ok answer 10

Test #5:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

6 10 10
4 9
4 2
3 6
10 1
10 10
4 1
6 8
5 10
6 3
5 1
2 9
3 2

output:

5
4 9 6 8 RDDLL
4 2 3 2 RRLLU
3 6 2 9 RRRUS
10 1 5 1 UUUUU
10 10 5 10 UUUUU
4 1 6 3 RRDDS

result:

ok answer 5

Test #6:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

8 10 10
5 1
6 8
6 3
6 4
3 10
9 5
6 7
4 1
3 8
7 3
1 2
8 6
5 8
7 6
9 4
4 1

output:

4
5 1 7 3 RRDD
6 8 7 6 LLDS
6 3 4 1 UULL
6 4 9 4 SDDD
3 10 3 8 DLLU
9 5 8 6 RRLU
6 7 5 8 RRLU
4 1 1 2 RUUU

result:

ok answer 4

Test #7:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1 10 10
8 3
8 4

output:

1
8 3 8 4 R

result:

ok answer 1

Test #8:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

1 10 10
10 1
6 6

output:

9
10 1 6 6 RRRRRUUUU

result:

ok answer 9

Test #9:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

8 10 10
7 8
4 6
10 9
4 7
4 3
10 6
3 3
2 7
3 7
2 10
3 8
1 9
6 1
3 10
10 2
6 4

output:

7
7 8 3 7 RLLUUUU
4 6 1 9 RRRUUUS
10 9 10 2 LLLLLLL
4 7 3 8 RRRLULS
4 3 6 1 RDDLLLS
10 6 6 4 UUUSLLU
3 3 3 10 RRRRRRR
2 7 2 10 RRRDDUU

result:

ok answer 7

Test #10:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

1 10 10
10 3
2 6

output:

11
10 3 2 6 RRRUUUUUUUU

result:

ok answer 11

Test #11:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

3 10 10
7 8
4 4
3 1
7 10
6 7
2 4

output:

5
7 8 7 10 RRDUS
4 4 6 7 RRRDD
3 1 2 4 RRRUS

result:

ok answer 5

Test #12:

score: 0
Accepted
time: 1ms
memory: 1776kb

input:

9 10 10
6 4
1 7
2 1
5 6
10 8
3 5
9 9
9 2
4 9
5 3
3 2
6 9
2 2
9 4
7 8
2 8
1 1
4 8

output:

5
6 4 3 2 UUULL
1 7 4 8 DDRDS
2 1 1 1 RRLLU
5 6 2 8 RRUUU
10 8 9 4 LLLLU
3 5 2 2 LUSLL
9 9 7 8 RLLUU
9 2 5 3 RUUUU
4 9 6 9 RDDLS

result:

ok answer 5

Test #13:

score: 0
Accepted
time: 0ms
memory: 5768kb

input:

2 10 10
9 8
3 3
5 8
4 9

output:

7
9 8 5 8 RLUUUUS
3 3 4 9 RRRRRRD

result:

ok answer 7

Test #14:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

8 10 10
10 5
8 4
2 8
2 4
10 8
6 6
1 7
10 1
8 6
10 5
10 2
5 9
8 10
10 4
3 9
4 2

output:

4
10 5 10 5 RLLR
8 4 10 4 RDDL
2 8 5 9 RDDD
2 4 4 2 DDLL
10 8 8 10 RRUU
6 6 8 6 RDDL
1 7 3 9 RRDD
10 1 10 2 RRLS

result:

ok answer 4

Test #15:

score: 0
Accepted
time: 0ms
memory: 1872kb

input:

1 10 10
1 9
2 10

output:

2
1 9 2 10 RD

result:

ok answer 2

Test #16:

score: 0
Accepted
time: 0ms
memory: 5692kb

input:

8 10 10
5 10
3 8
2 8
3 5
4 2
8 2
7 9
3 4
8 9
9 6
3 6
10 2
4 10
10 6
6 5
5 5

output:

6
5 10 8 9 DDDLSS
3 8 6 5 DDDLLL
2 8 4 10 DLRRRD
3 5 5 5 RDLRDL
4 2 10 2 DDDDDD
8 2 10 6 RRRRDD
7 9 9 6 DDLLSL
3 4 3 6 RRRRLL

result:

ok answer 6

Test #17:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

1 10 10
8 6
1 8

output:

9
8 6 1 8 RRUUUUUUU

result:

ok answer 9

Test #18:

score: 0
Accepted
time: 1ms
memory: 5744kb

input:

10 10 10
7 10
4 4
9 10
5 7
10 7
4 1
1 5
6 7
6 4
5 3
5 7
1 9
1 6
8 3
5 1
10 8
2 6
4 2
3 10
3 1

output:

5
7 10 3 10 UUSUU
4 4 4 2 RLSLL
9 10 10 8 LLUDD
5 7 1 6 LUUUU
10 7 5 7 UUUUU
4 1 3 1 RRLLU
1 5 1 9 RRRRS
6 7 2 6 LUUUU
6 4 8 3 RDDLL
5 3 5 1 RLLLS

result:

ok answer 5

Test #19:

score: 0
Accepted
time: 1ms
memory: 1780kb

input:

7 10 10
4 5
1 5
6 5
9 6
5 5
9 3
1 10
10 6
6 2
5 1
2 7
8 1
7 10
6 3

output:

6
4 5 6 2 DDLLLS
1 5 2 7 RRDDUS
6 5 6 3 RRLLLL
9 6 8 1 LLLLLU
5 5 5 1 RLLLLL
9 3 10 6 RRRRDL
1 10 7 10 DDDDDD

result:

ok answer 6

Test #20:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

6 10 10
9 7
4 1
9 1
7 9
2 6
9 5
5 1
4 1
2 10
4 10
3 1
1 7

output:

8
9 7 1 7 UUUUUUUU
4 1 4 1 RRRRLLLL
9 1 3 1 RLUUUUUU
7 9 2 10 RLUUUURU
2 6 4 10 RRRRDDDU
9 5 5 1 LLLLUUUU

result:

ok answer 8

Test #21:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

10 10 10
7 7
8 6
10 3
6 2
10 8
1 10
9 5
1 2
8 3
10 9
8 9
8 10
6 4
7 8
4 3
3 5
3 9
6 1
8 7
10 2

output:

5
7 7 6 4 LLULS
8 6 8 7 LSRRS
10 3 10 2 RRLLL
6 2 6 1 RRLLL
10 8 7 8 RUULU
1 10 3 9 DDDLU
9 5 8 9 RRRRU
1 2 3 5 RRRDD
8 3 4 3 UUUUS
10 9 8 10 RLRUU

result:

ok answer 5

Test #22:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

10 10 10
2 9
1 2
3 9
6 9
3 3
9 2
2 4
5 8
1 6
4 9
1 10
6 10
3 6
2 5
4 2
7 3
10 2
9 1
2 9
5 8

output:

8
2 9 1 10 LLSRRRUS
1 2 4 2 RRDDDLLS
3 9 2 5 RLLSLLLU
6 9 7 3 DLLLLLLS
3 3 9 1 DDDDDDLL
9 2 10 2 RRRDLLLS
2 4 3 6 RRDRRLLS
5 8 5 8 RDDDLUUU
1 6 2 9 RRRRDDLU
4 9 6 10 RDDDDUUS

result:

ok answer 8

Test #23:

score: 0
Accepted
time: 1ms
memory: 5768kb

input:

10 10 10
10 6
9 2
7 7
7 3
6 8
5 4
2 10
1 1
5 9
4 6
5 1
9 9
9 1
7 6
3 2
4 8
7 7
9 7
3 1
6 10

output:

4
10 6 7 7 UUUR
9 2 9 1 RLLS
7 7 9 7 RDDL
7 3 5 1 LLUU
6 8 9 9 RDDD
5 4 3 2 LLUU
2 10 4 8 DDLL
1 1 3 1 RDDL
5 9 6 10 RDDU
4 6 7 6 DSDD

result:

ok answer 4

Test #24:

score: 0
Accepted
time: 2ms
memory: 6164kb

input:

10 1 100
1 17
1 49
1 12
1 37
1 83
1 44
1 75
1 78
1 72
1 3
1 75
1 47
1 55
1 81
1 6
1 59
1 17
1 68
1 28
1 24

output:

13
1 17 1 24 RRRRRRRRRRLLL
1 49 1 47 RRRRRLLLLLLLS
1 12 1 17 RRRRRRRRRLLLL
1 37 1 28 RRLLLLLLLLLLL
1 83 1 75 LLSRLLSLLLLLS
1 44 1 55 RRRRRRRRRRRRL
1 75 1 68 RRRLLLLLLLLLL
1 78 1 81 RRLLLRRRRRRLL
1 72 1 59 LLLLLLLLLLLLL
1 3 1 6 RRRRRRRRLLLLL

result:

ok answer 13

Test #25:

score: 0
Accepted
time: 1ms
memory: 4292kb

input:

10 1 100
1 43
1 75
1 59
1 42
1 26
1 33
1 88
1 7
1 24
1 95
1 68
1 31
1 39
1 74
1 66
1 67
1 28
1 70
1 86
1 58

output:

25
1 43 1 66 RRRRRRRRRRRRRRRRRRRRRRRRL
1 75 1 68 RRRRRRRRLLLLLLLSLLLLLLLLS
1 59 1 70 RRRRRRRRRRRRRRRRRRLLLLLLL
1 42 1 67 RRRRRRRRRRRRRRRRRRRRRRRRR
1 26 1 28 RRRRRRRRRRRRSLLLLLLLLSLLS
1 33 1 58 RRRRRRRRRRRRRRRRRRRRRRRRR
1 88 1 74 RRRRRLLLLLLLLLLLLLLLLLLLS
1 7 1 31 RRRRRRRRRRRRRRRRRRRRRRRRS
1 24 1 39 ...

result:

ok answer 25

Test #26:

score: 0
Accepted
time: 2ms
memory: 4184kb

input:

10 1 100
1 88
1 38
1 43
1 99
1 63
1 24
1 44
1 31
1 47
1 52
1 6
1 14
1 55
1 15
1 82
1 57
1 73
1 74
1 97
1 51

output:

23
1 88 1 74 RRRRLLLLLLLLLLLLLLLLLSL
1 38 1 15 LLLLLLLLLLLLLLLLLLLLLLL
1 43 1 51 LLLLLLRRRRRRRRRRRRRRRLS
1 99 1 97 RLRLRLRLRLRLRLRLRLRLLLS
1 63 1 82 RRRRRRRRRRRRRRRRRRRRRLL
1 24 1 6 RRLLLLLLLLLLLLLLLLLLLLS
1 44 1 55 RRRRRRRRRRRRRRRRRLLLLLL
1 31 1 14 RRLLLSLLLLLLLLLLLLLLLLS
1 47 1 57 RRRRRRRRRRRRRRRR...

result:

ok answer 23

Test #27:

score: 0
Accepted
time: 2ms
memory: 5792kb

input:

10 100 1
6 1
96 1
41 1
76 1
97 1
72 1
94 1
82 1
23 1
40 1
31 1
33 1
84 1
77 1
41 1
24 1
39 1
68 1
8 1
82 1

output:

35
6 1 31 1 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDUUUUU
96 1 84 1 UUUUUUUDDDDDDDDDDDUUUUUUUUUUUUUUUUS
41 1 24 1 DDDDDDDDDUUUUUUUUUUUUUUUUUUUUUUUUUU
76 1 41 1 UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
97 1 82 1 USDDDDUDUDUDUDUDSUUUUUUUUUUUUUUUUUU
72 1 39 1 DUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
94 1 77 1 UUUUUUUUUUUD...

result:

ok answer 35

Test #28:

score: 0
Accepted
time: 0ms
memory: 4136kb

input:

10 100 1
19 1
23 1
29 1
11 1
44 1
87 1
68 1
56 1
35 1
34 1
34 1
63 1
40 1
90 1
8 1
69 1
81 1
41 1
18 1
82 1

output:

28
19 1 8 1 DDDDDDDDUUUSUUUUUUUUUUUUUUUU
23 1 18 1 DDDDDDDDDDDUUUUUSUUUUUUUUUUU
29 1 41 1 DDDDDDDDDDDDDDDDDDDDUUUUUUUU
11 1 34 1 DDDDDDDDDDDDDDDDDDDDDDDDDUUS
44 1 69 1 DDDDDDDDDDDDDDDDDDDDDDDDDDUS
87 1 81 1 DDDDDDDDDDDUUUUUUUUUUUUUUUUU
68 1 90 1 DDDDDDDDDDDDDDDDDDDDDDDDDUUU
56 1 82 1 DDDDDDDDDDDDDDD...

result:

ok answer 28

Test #29:

score: 0
Accepted
time: 2ms
memory: 4320kb

input:

10 100 1
42 1
4 1
64 1
31 1
92 1
45 1
60 1
24 1
8 1
35 1
57 1
70 1
42 1
17 1
72 1
51 1
56 1
87 1
52 1
88 1

output:

34
42 1 52 1 DDDDDDDDDDDDDDDDDDDDUUUUUUUUSUUUSD
4 1 17 1 DDDDDDDDDDDDDDDDDDDDDDDUUUUUUUUUUS
64 1 70 1 DDDDDDDDDDDDDDDDDDDUSUUUUUUUSUUUUU
31 1 51 1 DDDDDDDDDDDDDDDDDDDDDDDDDDDUUUUUUU
92 1 87 1 DDDDDDDDUDUDUDUDUDUDUUUUUUUUUSUUUU
45 1 72 1 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDUUUS
60 1 88 1 DDDDDDDDDDDDDDDDDD...

result:

ok answer 34

Test #30:

score: 0
Accepted
time: 0ms
memory: 6156kb

input:

50 10 10
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
3 10
4 1
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
4 10
5 1
5 2
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
6 1
6 2
6 3
6 4
6 5
6 6
6 7
6 8
6 9
6 10
7 1
7 2
7 3
7 4
7 5
7 6
7 7
7 8
7 9
7 10
8 1
...

output:

5
1 1 6 1 DDDDD
1 2 6 2 DDDDD
1 3 6 3 DDDDD
1 4 6 4 DDDDD
1 5 6 5 DDDDD
1 6 6 6 DDDDD
1 7 6 7 DDDDD
1 8 6 8 DDDDD
1 9 6 9 DDDDD
1 10 6 10 DDDDD
2 1 7 1 DDDDD
2 2 7 2 DDDDD
2 3 7 3 DDDDD
2 4 7 4 DDDDD
2 5 7 5 DDDDD
2 6 7 6 DDDDD
2 7 7 7 DDDDD
2 8 7 8 DDDDD
2 9 7 9 DDDDD
2 10 7 10 DDDDD
3 1 8 1 DDDDD
...

result:

ok answer 5

Test #31:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

1 1 2
1 1
1 2

output:

1
1 1 1 2 R

result:

ok answer 1

Test #32:

score: 0
Accepted
time: 2ms
memory: 6136kb

input:

1 1 100
1 1
1 100

output:

99
1 1 1 100 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

result:

ok answer 99

Test #33:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

2 2 50
1 1
2 50
1 50
2 1

output:

1
1 1 2 1 D
2 50 1 50 U

result:

ok answer 1

Test #34:

score: 0
Accepted
time: 1ms
memory: 6192kb

input:

2 1 100
1 23
1 54
1 67
1 26

output:

13
1 23 1 26 RRRRRRRRLLLLL
1 54 1 67 RRRRRRRRRRRRR

result:

ok answer 13

Test #35:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

2 2 50
1 21
1 41
2 36
1 11

output:

10
1 21 1 11 LLLLLLLLLL
1 41 2 36 RRDLLLLLLL

result:

ok answer 10

Test #36:

score: 0
Accepted
time: 1ms
memory: 1984kb

input:

2 3 33
3 17
2 13
1 23
1 24

output:

11
3 17 1 24 RRRRRRRRLUU
2 13 1 23 RRRRRRRRRRU

result:

ok answer 11

Test #37:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

2 4 25
3 15
2 22
1 22
1 11

output:

6
3 15 1 11 LLLLUU
2 22 1 22 RRLLUS

result:

ok answer 6

Test #38:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

2 5 20
2 18
5 2
5 7
3 8

output:

11
2 18 3 8 DLLLLLLLLLL
5 2 5 7 RRRRRRRRLLL

result:

ok answer 11

Test #39:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

2 6 16
5 12
6 4
1 11
5 15

output:

12
5 12 1 11 RRRLLLLUUUUS
6 4 5 15 RRRRRRRRRRRU

result:

ok answer 12

Test #40:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

2 7 14
3 14
7 1
1 12
6 4

output:

4
3 14 1 12 LLUU
7 1 6 4 RRRU

result:

ok answer 4

Test #41:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

2 8 12
8 4
1 4
5 12
2 6

output:

11
8 4 5 12 RRRRRRRRUUU
1 4 2 6 RRRRRRDLLLL

result:

ok answer 11

Test #42:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

2 9 11
1 7
3 4
4 3
7 6

output:

7
1 7 4 3 DDDLLLL
3 4 7 6 RRDDDDS

result:

ok answer 7

Test #43:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

2 10 10
4 5
10 7
4 2
2 10

output:

11
4 5 4 2 RRRRLLLLLLL
10 7 2 10 RRRUUUUUUUU

result:

ok answer 11

Test #44:

score: 0
Accepted
time: 1ms
memory: 2308kb

input:

5 100 1
94 1
75 1
91 1
13 1
65 1
76 1
89 1
86 1
92 1
19 1

output:

11
94 1 89 1 DDDUUUUUUUU
75 1 86 1 DDDDDDDDDDD
91 1 92 1 DDDDDDUUUUU
13 1 19 1 DDDDDDDDUUS
65 1 76 1 DDDDDDDDDDD

result:

ok answer 11

Test #45:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

5 50 2
33 1
12 2
39 1
36 1
19 2
6 1
41 2
32 2
34 2
9 2

output:

10
33 1 32 2 RDDDDUUUUU
12 2 6 1 DLUUUUUUUS
39 1 34 2 RDDUUUUUUU
36 1 41 2 RDDDDDDDUU
19 2 9 2 UUUUUUUUUU

result:

ok answer 10

Test #46:

score: 0
Accepted
time: 1ms
memory: 5684kb

input:

5 33 3
33 3
4 1
23 1
23 3
27 1
32 2
4 1
20 2
21 3
28 1

output:

4
33 3 32 2 LRLU
4 1 4 1 RRLL
23 1 20 2 RUUU
23 3 21 3 DUUU
27 1 28 1 RDLS

result:

ok answer 4

Test #47:

score: 0
Accepted
time: 1ms
memory: 2028kb

input:

5 25 4
23 3
22 3
9 4
18 3
1 3
23 4
9 2
7 3
19 3
13 2

output:

6
23 3 19 3 USUUUS
22 3 23 4 RUUDDD
9 4 9 2 DDLLUU
18 3 13 2 UUUUUL
1 3 7 3 DDDDDD

result:

ok answer 6

Test #48:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

5 20 5
11 5
15 3
16 5
12 2
15 2
20 2
8 2
19 1
3 2
15 5

output:

9
11 5 8 2 DLLLUUUUS
15 3 19 1 RDDDDLLLS
16 5 20 2 DDDDLRLLL
12 2 3 2 UUUUUUUUU
15 2 15 5 RRRDDDUUU

result:

ok answer 9

Test #49:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

5 16 6
13 2
5 2
2 6
16 2
3 4
3 4
2 3
14 2
1 4
1 2

output:

12
13 2 1 2 UUUUUUUUUUUU
5 2 1 4 RRRDDLUUUUUU
2 6 2 3 DDDDLLLUUUUS
16 2 14 2 RRRRLRLLLLUU
3 4 3 4 RRDDDDLLUUUU

result:

ok answer 12

Test #50:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

5 14 7
4 3
1 1
3 3
3 4
13 7
3 3
8 3
12 7
1 5
2 7

output:

4
4 3 8 3 DDDD
1 1 1 5 RRRR
3 3 3 3 RRLL
3 4 2 7 RRRU
13 7 12 7 DUUS

result:

ok answer 4

Test #51:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

5 12 8
12 7
11 8
1 7
4 8
11 4
7 6
5 8
6 3
10 4
2 1

output:

7
12 7 10 4 ULRLLLU
11 8 7 6 UUUSLLU
1 7 2 1 DLLLLLL
4 8 5 8 DDDUUDU
11 4 6 3 LUUUUUS

result:

ok answer 7

Test #52:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

5 11 9
3 3
1 1
10 6
1 4
10 4
7 3
2 6
4 5
6 7
1 4

output:

5
3 3 4 5 RRRDL
1 1 1 4 RRRRL
10 6 6 7 RUUUU
1 4 2 6 RRRDL
10 4 7 3 LUUUS

result:

ok answer 5

Test #53:

score: 0
Accepted
time: 1ms
memory: 5720kb

input:

5 10 10
2 2
1 3
9 9
7 4
6 5
9 5
6 5
10 6
2 5
1 10

output:

7
2 2 2 5 RRRRRLL
1 3 1 10 RRRRRRR
9 9 9 5 RLLLLLS
7 4 10 6 RRRDDDL
6 5 6 5 RRRLLLS

result:

ok answer 7

Test #54:

score: 0
Accepted
time: 2ms
memory: 4288kb

input:

10 1 100
1 67
1 1
1 86
1 24
1 75
1 82
1 55
1 84
1 26
1 40
1 4
1 62
1 73
1 77
1 5
1 14
1 42
1 98
1 48
1 38

output:

19
1 67 1 48 LLLLLLLLLLLLLLLLLLL
1 1 1 4 RRRRRRRRRRRLLLLLLLL
1 86 1 98 LRRRRRRRRRRRRRRRLLS
1 24 1 5 LLLLLLLLLLLLLLLLLLL
1 75 1 62 RRLLLLLLLLLSLLLLLLS
1 82 1 73 LLLLLLLLLLLLLSRRRRS
1 55 1 42 RRLLLLLLLSLLLLLLLLS
1 84 1 77 LRRRRRRLLLLLLLLLLLL
1 26 1 14 RRRLLLLLLLLLLLLSLLL
1 40 1 38 RRRRRRRRLLLLLLLLLLS

result:

ok answer 19

Test #55:

score: 0
Accepted
time: 2ms
memory: 5900kb

input:

10 2 50
2 47
1 48
1 33
1 22
1 10
2 5
1 49
1 11
2 11
1 47
2 48
2 42
1 48
2 17
1 23
1 12
2 23
1 6
2 29
1 32

output:

15
2 47 2 42 LLLLLLUSRRRDLLS
1 48 1 48 SRRDLRLRLRLRLLU
1 33 2 29 RRRRRDLLLLLLLLL
1 22 2 23 RRRRRRRLLLLLSDL
1 10 1 12 RRRRRRRRLLLLLLS
2 5 2 17 RRRRRRRRRRRRRLS
1 49 2 48 RDLLLRLRLRLRLSR
1 11 1 6 RRRRRLLLLLLLLLL
2 11 1 23 RRRRRRRRRRRRRLU
1 47 1 32 LLLLLLLLLLLLLLL

result:

ok answer 15

Test #56:

score: 0
Accepted
time: 0ms
memory: 4044kb

input:

10 3 33
1 16
1 4
1 30
2 8
1 8
2 16
3 33
2 12
2 20
1 15
2 10
3 10
3 28
3 33
1 18
2 11
3 9
2 2
2 6
3 31

output:

9
1 16 2 10 LLLLRDLLL
1 4 2 2 RRRDLLLLL
1 30 3 31 RRRDDLRLL
2 8 3 9 RRRRDLLLS
1 8 2 6 RRRLLDLLL
2 16 3 10 RDLLLLLLL
3 33 3 33 LRLRLRLRS
2 12 2 11 RRRRLLLLL
2 20 3 28 RRRRRRRRD
1 15 1 18 RRRRRRLLL

result:

ok answer 9

Test #57:

score: 0
Accepted
time: 1ms
memory: 2024kb

input:

10 4 25
4 13
2 1
1 6
2 2
2 15
3 12
3 19
4 18
4 23
4 10
3 3
4 4
2 13
2 6
2 18
2 4
1 22
3 7
4 15
1 24

output:

6
4 13 4 15 LSRRRS
2 1 2 4 RRRRLS
1 6 2 6 RRDLLS
2 2 3 3 RRRDLL
2 15 2 13 DLRLLU
3 12 3 7 LLLLLS
3 19 1 22 RRRUUS
4 18 2 18 RRLLUU
4 23 1 24 RRLUUU
4 10 4 4 LLLLLL

result:

ok answer 6

Test #58:

score: 0
Accepted
time: 0ms
memory: 4140kb

input:

10 5 20
3 4
2 18
4 11
3 16
5 13
5 20
1 7
5 4
3 14
2 1
1 9
2 11
3 7
1 12
2 6
5 8
1 20
4 2
3 17
3 1

output:

6
3 4 3 1 RLLLLS
2 18 3 17 DLSRLS
4 11 3 7 LLLLUS
3 16 2 11 LLLLLU
5 13 5 8 LLLLSL
5 20 1 20 LRUUUU
1 7 1 9 RRRRLL
5 4 4 2 RULLLS
3 14 1 12 LLUUSS
2 1 2 6 RRRRRS

result:

ok answer 6

Test #59:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

10 6 16
6 15
6 10
4 13
5 10
2 7
2 16
1 11
5 9
2 1
1 1
4 6
4 2
2 2
6 3
2 16
2 14
4 14
2 9
2 11
2 4

output:

7
6 15 4 14 LLUSRUS
6 10 6 3 LLLLLLL
4 13 2 11 LLUURLS
5 10 2 9 RLLUUUS
2 7 2 4 RRLLLLL
2 16 2 14 DDLLUUS
1 11 2 16 RRRRRDS
5 9 4 6 RLLLLUS
2 1 2 2 RRRRLLL
1 1 4 2 RRDDDLS

result:

ok answer 7

Test #60:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

10 7 14
7 4
4 10
4 8
6 12
2 13
1 5
4 1
2 9
5 4
6 14
6 11
3 7
7 5
3 9
2 4
7 1
3 12
6 13
2 7
4 5

output:

3
7 4 7 5 RUD
4 10 3 9 USL
4 8 4 5 LLL
6 12 6 11 RLL
2 13 3 12 DLS
1 5 2 7 RRD
4 1 7 1 DDD
2 9 3 7 DLL
5 4 2 4 UUU
6 14 6 13 DLU

result:

ok answer 3

Test #61:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

10 8 12
1 12
5 2
5 1
4 4
8 10
3 11
5 10
1 11
7 4
8 2
2 8
3 7
8 4
4 11
5 8
7 11
1 12
6 4
7 7
7 1

output:

4
1 12 1 12 SDUS
5 2 7 1 DDLS
5 1 6 4 RRRD
4 4 3 7 RRRU
8 10 7 11 RUUD
3 11 4 11 DDSU
5 10 5 8 RLLL
1 11 2 8 DLLL
7 4 7 7 RRRS
8 2 8 4 RRRL

result:

ok answer 4

Test #62:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

10 9 11
5 4
4 4
9 10
5 6
8 11
3 9
3 1
2 7
9 6
6 3
6 8
8 8
2 9
5 9
7 4
7 7
4 5
9 7
4 7
2 7

output:

5
5 4 7 4 RLDDS
4 4 2 7 RRRUU
9 10 7 7 LULUL
5 6 4 7 RRUSL
8 11 8 8 DLULL
3 9 5 9 RDDLS
3 1 4 5 RRRRD
2 7 2 9 RRRLS
9 6 9 7 RRRLL
6 3 6 8 RRRRR

result:

ok answer 5

Test #63:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

10 10 10
2 9
10 7
4 6
4 10
2 8
8 2
1 1
2 3
7 6
8 8
4 8
8 7
5 9
5 7
7 1
7 7
8 1
7 6
6 6
4 10

output:

7
2 9 4 8 LLLRRDD
10 7 6 6 RLLUUUU
4 6 5 7 RRRDLLS
4 10 4 10 DDDUSUU
2 8 5 9 RRDDDLS
8 2 7 6 RRRRRLU
1 1 8 1 DDDDDDD
2 3 7 1 DDDDDLL
7 6 7 7 RRRRLLL
8 8 8 7 RRDLLLU

result:

ok answer 7

Test #64:

score: 0
Accepted
time: 2ms
memory: 2420kb

input:

20 100 1
77 1
38 1
67 1
91 1
60 1
34 1
32 1
56 1
76 1
57 1
22 1
26 1
49 1
61 1
86 1
16 1
79 1
21 1
28 1
73 1
32 1
90 1
8 1
58 1
70 1
28 1
65 1
85 1
20 1
84 1
93 1
98 1
2 1
19 1
96 1
95 1
49 1
47 1
17 1
42 1

output:

17
77 1 85 1 DDDDDDDDDDDDUSUUU
38 1 42 1 UUUDDDDDDDDDUUDUS
67 1 84 1 DDDDDDDDDDDDDDDDD
91 1 95 1 DDDDDDDDDUDUUUUSU
60 1 49 1 UUDDDUUUUUUUUUUUU
34 1 32 1 SUUUUUUDDDDDDDUUU
32 1 20 1 DDUUUUUUUSUUUUUUU
56 1 47 1 DUUUUUUUUUUUUDDDU
76 1 93 1 DDDDDDDDDDDDDDDDD
57 1 58 1 DDDDDDDDUUUSUUUUS
22 1 28 1 DDDDUUU...

result:

ok answer 17

Test #65:

score: 0
Accepted
time: 3ms
memory: 2448kb

input:

20 50 2
8 1
23 2
17 2
46 1
38 1
47 1
33 1
45 2
24 1
16 1
18 1
44 1
25 1
13 1
40 1
15 1
45 1
32 1
27 1
26 1
5 1
38 1
16 1
15 2
19 2
16 2
47 2
27 2
37 1
8 1
28 2
21 2
26 1
8 2
14 2
19 1
10 1
22 2
29 2
10 2

output:

17
8 1 5 1 RDDDDDDLUUUUUUUUU
23 2 15 2 LRDDLUSUUURUUUUUU
17 2 10 2 LDDDDRUUUUUUUUUUU
46 1 47 2 RUUUUUUUDDDDDDDDS
38 1 26 1 RUUUDUUUUUUUUSULU
47 1 38 1 RUUUUUUUUUUDDDLUU
33 1 16 1 UUUUUUUUUUUUUUUUU
45 2 37 1 UUUUUUUUUUDDDDLUU
24 1 16 2 RDDDUUUDUUUUUUUUU
16 1 8 2 RDDDDUUUUUUUUUUUU
18 1 14 2 RDDDDDUDUU...

result:

ok answer 17

Test #66:

score: 0
Accepted
time: 2ms
memory: 4096kb

input:

20 33 3
32 1
20 2
18 2
32 2
3 2
23 3
2 2
8 3
8 1
28 2
23 1
17 1
7 3
16 1
27 1
1 2
24 1
19 3
30 2
28 1
5 1
25 2
30 2
17 3
4 2
12 1
12 3
4 1
13 2
19 2
8 2
19 1
21 1
9 3
31 3
10 1
33 1
15 3
22 2
10 3

output:

7
32 1 31 3 RRUUDDU
20 2 15 3 RUUSUUU
18 2 12 1 LUUUUUU
32 2 33 1 RUDDLLS
3 2 5 1 RDDDLLU
23 3 17 3 UUUUUUS
2 2 4 1 RDDDLLU
8 3 9 3 DDDDUUU
8 1 8 2 RRDDLUU
28 2 25 2 URUUUDL
23 1 19 2 RRUUULU
17 1 10 1 UUUUUUU
7 3 10 3 DDDDDUU
16 1 12 3 RRUUUUS
27 1 21 1 UUUUUUS
1 2 4 2 RDDDDLU
24 1 19 1 RUUUUUL
19 ...

result:

ok answer 7

Test #67:

score: 0
Accepted
time: 0ms
memory: 5820kb

input:

20 25 4
23 2
8 2
24 3
12 2
11 4
13 3
13 1
23 3
2 2
20 2
10 4
17 1
24 2
25 2
2 1
6 1
3 4
5 2
9 3
10 1
21 4
10 3
9 2
21 1
23 4
25 1
2 4
20 4
12 2
8 2
3 2
16 1
22 2
16 3
24 4
7 3
20 1
19 2
9 3
19 3

output:

7
23 2 21 1 RRLLLUU
8 2 10 3 RDDDDUU
24 3 25 1 RLRLLDL
12 2 19 2 DDDDDDD
11 4 9 2 DLLUUSU
13 3 19 3 DDDDDDS
13 1 20 1 DDDDDDD
23 3 20 4 RLRSUUU
2 2 3 2 RRDDLLU
20 2 22 2 RRDDLLS
10 4 16 3 DDDDDDL
17 1 21 4 RRRDDDD
24 2 23 4 RRDLRUU
25 2 24 4 RRLRLRU
2 1 2 4 RRRDDUU
6 1 8 2 RRDDDLU
3 4 7 3 DLRDDDL
5 ...

result:

ok answer 7

Test #68:

score: 0
Accepted
time: 0ms
memory: 4032kb

input:

20 20 5
16 1
5 2
7 4
12 5
10 5
16 5
9 1
1 3
11 5
12 1
15 5
15 3
6 3
8 1
14 1
3 3
11 3
7 1
4 2
10 4
19 2
15 3
6 2
13 1
2 1
14 4
8 4
11 5
9 1
13 3
3 4
5 5
18 4
7 4
8 1
3 5
5 4
14 5
17 5
18 3

output:

4
16 1 19 2 RDDD
5 2 2 1 LUUU
7 4 6 2 LLUS
12 5 14 5 DDLR
10 5 7 4 LUUU
16 5 18 3 DDLL
9 1 9 1 RRLL
1 3 3 4 RDSD
11 5 14 4 LDDD
12 1 13 3 RRDS
15 5 18 4 DDDL
15 3 17 5 RRDD
6 3 5 4 RRLU
8 1 8 1 RRLL
14 1 15 3 RRDS
3 3 3 5 RRLR
11 3 13 1 DDLL
7 1 8 4 RRRD
4 2 5 5 RRRD
10 4 11 5 RDDU

result:

ok answer 4

Test #69:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

20 16 6
6 5
5 6
1 2
3 6
8 5
14 3
1 1
4 1
5 2
10 1
13 1
6 3
13 5
1 4
2 5
8 2
2 1
16 2
12 2
14 6
14 1
2 5
10 1
16 1
12 3
3 2
1 6
13 1
12 1
13 3
7 2
1 1
10 4
10 3
16 3
11 3
3 3
15 2
4 4
3 4

output:

6
6 5 10 3 DDDDLL
5 6 7 2 DLDLLL
1 2 1 1 RRLLLS
3 6 4 4 DDLLSU
8 5 12 3 DDDDLL
14 3 14 1 RRLLLL
1 1 3 3 RRRDDL
4 1 3 2 RRRLLU
5 2 10 1 DDDDDL
10 1 12 1 RRDDLL
13 1 15 2 RRDDLS
6 3 11 3 DDDDDS
13 5 13 1 RLLLLL
1 4 1 6 RRDULR
2 5 3 4 RDDLLU
8 2 10 4 RRRDDL
2 1 2 5 RRRRRL
16 2 16 1 RRLLLS
12 2 13 3 RRR...

result:

ok answer 6

Test #70:

score: 0
Accepted
time: 1ms
memory: 4020kb

input:

20 14 7
3 6
3 1
12 6
10 6
6 1
13 2
8 2
12 3
1 2
11 5
5 4
7 4
4 1
11 4
5 3
1 3
6 6
12 1
11 7
11 2
11 1
9 5
7 4
7 6
8 4
14 5
11 4
11 5
12 2
6 3
13 4
4 5
5 1
9 7
6 2
1 1
11 6
11 7
6 5
4 1

output:

4
3 6 4 5 DLLR
3 1 6 2 RDDD
12 6 11 4 ULLS
10 6 8 4 LLUU
6 1 6 3 RRRL
13 2 12 2 RLUS
8 2 9 5 RRRD
12 3 14 5 RRDD
1 2 4 1 DDDL
11 5 11 1 LLLL
5 4 7 4 RDDL
7 4 7 6 RRRL
4 1 5 1 RDLS
11 4 11 5 RRSL
5 3 6 5 RRDS
1 3 1 1 RLLL
6 6 9 7 RDDD
12 1 13 4 RRRD
11 7 11 7 DDUU
11 2 11 6 RRRR

result:

ok answer 4

Test #71:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

20 12 8
6 6
12 1
3 6
7 6
8 4
4 5
5 1
5 5
10 3
9 4
8 2
5 8
7 4
5 3
12 2
8 5
10 7
6 4
6 7
8 6
7 6
7 3
5 1
2 3
1 3
12 1
3 2
3 4
1 2
11 2
3 1
3 3
5 8
2 7
12 4
9 7
2 4
9 8
8 4
7 1

output:

5
6 6 3 4 UULLU
12 1 12 4 RRRRL
3 6 2 4 RLLLU
7 6 5 8 USRRU
8 4 11 2 LDDDL
4 5 1 3 LLUUU
5 1 3 1 RLUUS
5 5 2 3 ULLUU
10 3 7 1 ULLUU
9 4 7 3 RUULL
8 2 5 1 LUUUS
5 8 2 7 LUUUS
7 4 3 3 UUULU
5 3 1 2 ULUUU
12 2 12 1 RRLLL
8 5 7 6 RUUSD
10 7 8 4 UULLL
6 4 3 2 ULLUU
6 7 9 7 RDDDL
8 6 9 8 RRDDU

result:

ok answer 5

Test #72:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

20 11 9
4 3
8 7
5 9
7 1
4 8
10 4
6 6
8 6
9 9
11 2
11 5
4 5
9 6
11 8
10 3
4 7
7 8
5 5
8 5
1 8
2 4
3 1
4 3
6 4
4 2
4 5
10 9
8 7
6 1
7 3
1 9
11 8
9 7
1 6
1 1
10 4
11 2
5 6
11 9
11 6

output:

5
4 3 1 1 LLUUU
8 7 6 4 ULULL
5 9 5 6 LLRLL
7 1 4 2 RUUUS
4 8 1 6 LLUUU
10 4 11 2 RDLLL
6 6 6 1 LLLLL
8 6 7 3 LLLUS
9 9 10 9 LSDSR
11 2 10 4 RRRLU
11 5 8 7 RRUUU
4 5 3 1 LLLLU
9 6 9 7 RURDL
11 8 11 8 RLRLS
10 3 11 6 RRRDS
4 7 2 4 LLLUU
7 8 11 9 RDDDD
5 5 4 3 RLULL
8 5 4 5 UUUUS
1 8 1 9 RDDUU

result:

ok answer 5

Test #73:

score: 0
Accepted
time: 1ms
memory: 5664kb

input:

20 10 10
7 9
3 1
1 8
1 7
9 9
8 4
2 5
4 2
4 4
2 4
8 3
8 2
4 6
6 10
8 1
3 6
9 2
5 2
9 3
10 8
6 9
5 2
4 2
5 3
9 6
10 5
7 3
7 5
7 6
7 7
2 4
1 6
10 2
6 5
3 2
2 8
7 2
2 6
2 10
4 3

output:

3
7 9 7 7 LLS
3 1 3 2 RRL
1 8 2 10 RRD
1 7 1 6 DLU
9 9 9 6 LLL
8 4 6 5 RUU
2 5 2 6 RRL
4 2 4 2 RLS
4 4 4 3 RLL
2 4 2 4 RLS
8 3 7 5 RRU
8 2 5 2 UUU
4 6 7 6 DDD
6 10 6 9 DLU
8 1 7 3 RRU
3 6 2 8 RRU
9 2 10 2 RDL
5 2 5 3 RRL
9 3 7 2 ULU
10 8 10 5 LLL

result:

ok answer 3

Test #74:

score: 0
Accepted
time: 3ms
memory: 5788kb

input:

30 1 100
1 85
1 59
1 11
1 17
1 95
1 98
1 38
1 47
1 5
1 92
1 33
1 30
1 26
1 50
1 8
1 86
1 64
1 49
1 93
1 35
1 21
1 77
1 65
1 54
1 60
1 56
1 70
1 6
1 44
1 55
1 48
1 84
1 75
1 26
1 53
1 6
1 80
1 49
1 31
1 51
1 72
1 41
1 45
1 83
1 73
1 93
1 8
1 16
1 24
1 20
1 37
1 14
1 39
1 85
1 43
1 42
1 34
1 87
1 86
1...

output:

8
1 85 1 83 RRRLLLLL
1 59 1 62 LLRRRRRS
1 11 1 8 RRLLLLLS
1 17 1 20 RRRRRLLS
1 95 1 87 LLLLLLLL
1 98 1 93 LLSRLLLL
1 38 1 39 RRRRLLLS
1 47 1 41 LLLLLLLR
1 5 1 6 RRRRLLLS
1 92 1 86 RLLLLLLL
1 33 1 34 RRRRLSLL
1 30 1 31 RRRRLLLS
1 26 1 26 RRRLLSLS
1 50 1 45 RLLLSLLL
1 8 1 16 RRRRRRRR
1 86 1 84 RRRLLLL...

result:

ok answer 8

Test #75:

score: 0
Accepted
time: 3ms
memory: 4380kb

input:

30 2 50
2 40
2 29
2 44
1 23
2 48
1 31
1 15
1 38
1 9
2 3
1 30
2 7
2 13
2 19
1 7
2 20
1 46
1 50
2 11
2 14
1 33
2 1
2 38
2 22
1 47
1 36
2 17
2 36
2 35
2 28
1 17
2 27
2 50
2 5
1 21
2 1
2 31
1 35
2 36
1 13
1 28
2 33
2 29
2 26
1 38
2 41
1 2
2 16
1 40
2 39
1 27
2 13
2 17
2 44
2 19
2 35
2 2
1 14
2 46
1 36

output:

6
2 40 2 35 SLLLLL
2 29 2 29 RRRLLL
2 44 2 39 LLLLLS
1 23 1 27 RRRRRL
2 48 2 44 LLLLLR
1 31 2 31 RRSDLL
1 15 2 16 DRRRLL
1 38 2 36 RSLDLL
1 9 1 13 LRRRRR
2 3 1 2 RRULLL
1 30 1 28 RRLLLL
2 7 2 5 RLLLRL
2 13 2 17 LRRRRR
2 19 1 17 RULLLS
1 7 2 2 DLLLLL
2 20 1 21 RRRLLU
1 46 1 40 LLLLLL
1 50 2 46 DLLLLS...

result:

ok answer 6

Test #76:

score: 0
Accepted
time: 0ms
memory: 4464kb

input:

30 3 33
1 14
2 12
3 24
2 29
1 30
1 22
1 29
1 9
3 28
3 7
3 11
1 17
1 23
2 21
2 6
3 6
1 21
1 20
3 15
1 8
3 21
3 32
2 23
2 17
3 9
2 20
3 31
1 27
1 6
1 5
2 25
1 33
2 4
1 4
3 3
2 5
1 20
3 19
3 26
3 24
1 7
1 31
2 15
3 18
3 8
3 25
3 4
3 29
3 6
2 21
3 30
3 32
3 23
2 20
2 2
1 17
3 15
1 1
2 14
1 13

output:

5
1 14 1 13 RRLLL
2 12 3 8 LLLLD
3 24 3 19 LLLLL
2 29 3 25 LLLDL
1 30 3 30 SRDDL
1 22 2 20 DRLLL
1 29 1 31 LRRRS
1 9 1 7 RLLSL
3 28 3 29 RRRLL
3 7 2 5 URLLL
3 11 3 6 LLLLL
1 17 2 14 DLLLS
1 23 1 20 LRLLL
2 21 3 18 LLDSL
2 6 2 2 LLLLS
3 6 3 3 RLLLL
1 21 1 17 LLLSL
1 20 3 23 RRRDD
3 15 2 15 RRLLU
1 8 ...

result:

ok answer 5

Test #77:

score: 0
Accepted
time: 0ms
memory: 2060kb

input:

30 4 25
4 1
1 7
3 12
3 4
4 9
3 22
3 7
1 20
2 17
4 21
4 4
1 14
1 1
2 22
1 25
2 4
1 13
3 18
3 20
4 3
1 3
2 2
2 21
3 14
1 6
4 16
1 2
1 24
1 4
4 14
1 22
4 7
2 4
3 13
2 10
1 8
4 6
1 16
3 18
1 7
4 4
3 6
2 24
3 24
1 10
1 4
2 25
4 14
3 8
1 21
2 19
1 5
1 20
2 11
1 3
4 10
4 2
3 15
2 16
3 19

output:

3
4 1 4 2 RRL
1 7 1 10 RRR
3 12 2 10 LLU
3 4 4 4 RLD
4 9 4 10 RRL
3 22 1 21 ULU
3 7 3 8 RRL
1 20 1 22 RRS
2 17 2 16 LUD
4 21 3 19 ULL
4 4 4 7 RRR
1 14 1 16 RSR
1 1 1 3 RRS
2 22 2 25 RRR
1 25 3 24 DDL
2 4 3 6 RRD
1 13 2 11 DLL
3 18 3 15 LLL
3 20 2 19 LUS
4 3 4 6 RRR
1 3 1 4 RRL
2 2 2 4 RRS
2 21 1 20 ...

result:

ok answer 3

Test #78:

score: 0
Accepted
time: 0ms
memory: 4008kb

input:

30 5 20
1 9
4 18
5 11
4 11
3 10
4 5
3 9
1 15
2 12
5 3
1 18
3 17
5 20
1 20
5 17
1 7
3 6
2 8
1 3
2 13
5 6
2 19
1 12
1 2
3 11
5 14
3 8
3 18
4 7
5 8
4 6
4 1
2 7
5 14
3 10
5 18
2 14
5 19
1 1
4 9
4 2
2 5
3 8
2 11
5 4
5 1
5 9
2 4
4 13
1 15
5 5
2 10
2 16
5 7
1 13
3 17
2 20
3 7
2 15
4 4

output:

4
1 9 2 7 SDLL
4 18 5 19 DRRL
5 11 4 9 LSLU
4 11 3 8 ULLL
3 10 3 10 LDRU
4 5 4 1 LLLL
3 9 3 7 ULDL
1 15 1 13 DLLU
2 12 2 10 RLLL
5 3 5 1 RLLL
1 18 2 15 LLLD
3 17 2 14 LLLU
5 20 5 18 LLLR
1 20 2 20 DDUS
5 17 5 14 LSLL
1 7 2 5 LLSD
3 6 4 4 DLLS
2 8 2 4 LLLL
1 3 1 1 RLLL
2 13 1 15 RRSU
5 6 5 5 LSRL
2 1...

result:

ok answer 4

Test #79:

score: 0
Accepted
time: 1ms
memory: 4044kb

input:

30 6 16
5 13
5 2
1 5
2 11
6 5
4 9
2 1
1 12
1 8
1 13
5 5
3 15
6 13
5 1
5 12
1 3
1 4
4 11
5 4
6 16
6 2
1 11
4 14
5 10
4 13
3 5
2 9
3 9
4 1
3 11
1 12
6 5
5 3
1 16
3 9
3 13
1 11
6 4
5 8
2 7
1 5
6 3
6 14
1 7
6 13
2 13
6 10
1 9
5 10
3 4
3 11
6 16
2 4
4 10
5 2
3 8
5 4
4 4
6 8
4 11

output:

3
5 13 5 10 LLL
5 2 5 3 RRL
1 5 2 7 RRD
2 11 3 9 DLL
6 5 6 5 RSL
4 9 5 8 DLS
2 1 2 4 RRR
1 12 1 9 LLL
1 8 1 7 RLL
1 13 1 11 SLL
5 5 5 4 RLL
3 15 1 16 RUU
6 13 6 10 LLL
5 1 5 2 RRL
5 12 4 10 LUL
1 3 3 4 RDD
1 4 1 5 RRL
4 11 3 13 RRU
5 4 6 4 RDL
6 16 6 16 LRS
6 2 6 3 RRL
1 11 1 12 RRL
4 14 6 13 DDL
5 ...

result:

ok answer 3

Test #80:

score: 0
Accepted
time: 2ms
memory: 4000kb

input:

30 7 14
7 2
7 11
1 6
5 4
2 10
3 11
7 9
5 2
5 14
5 13
2 3
3 10
7 8
2 2
4 9
5 10
2 6
6 8
2 7
3 12
7 4
1 1
6 13
6 5
6 9
6 14
1 3
4 11
4 5
5 8
2 11
2 9
1 6
5 10
3 1
7 2
2 14
6 14
7 4
4 2
4 4
7 1
2 8
3 11
5 11
1 5
4 12
3 7
5 4
3 6
5 8
3 14
7 3
6 9
6 11
5 12
3 9
4 13
3 5
1 1

output:

3
7 2 7 2 LSR
7 11 6 11 USS
1 6 1 5 RLL
5 4 7 4 DSD
2 10 2 9 LLR
3 11 2 11 SUS
7 9 6 9 RLU
5 2 4 4 RRU
5 14 3 14 USU
5 13 4 13 RLU
2 3 3 1 DLL
3 10 2 8 LUL
7 8 5 8 UUS
2 2 4 2 DDS
4 9 3 9 RLU
5 10 3 11 RUU
2 6 3 6 RDL
6 8 5 10 RRU
2 7 3 5 LLD
3 12 2 14 RRU
7 4 7 1 LLL
1 1 1 1 RLS
6 13 5 12 LUS
6 5 7...

result:

ok answer 3

Test #81:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

30 8 12
8 4
4 9
7 8
2 12
8 6
8 1
4 5
3 2
4 8
7 9
4 10
6 9
2 3
5 10
8 12
8 8
1 4
6 11
6 10
5 3
3 1
4 7
8 10
2 7
2 5
7 4
3 6
7 2
6 5
2 4
3 9
3 12
6 11
2 10
2 6
4 2
4 1
3 8
1 7
5 12
8 10
8 2
4 6
4 12
2 7
5 7
2 1
1 10
3 6
2 2
8 7
4 11
7 12
1 6
7 11
6 12
6 9
7 6
8 6
8 11

output:

3
8 4 7 6 RRU
4 9 4 12 RRR
7 8 6 9 RUS
2 12 3 12 DLR
8 6 8 7 RRL
8 1 8 2 RRL
4 5 3 6 RUS
3 2 2 1 LUS
4 8 4 11 RRR
7 9 6 11 RRU
4 10 1 10 UUU
6 9 3 9 UUU
2 3 2 6 RRR
5 10 6 12 RRD
8 12 7 12 UUD
8 8 8 10 RRS
1 4 1 6 RRS
6 11 7 11 RDL
6 10 5 12 RUR
5 3 4 1 LUL
3 1 2 2 RUS
4 7 4 6 RLL
8 10 8 11 RRL
2 7 ...

result:

ok answer 3

Test #82:

score: 0
Accepted
time: 0ms
memory: 5656kb

input:

30 9 11
3 1
2 10
8 8
9 6
2 1
9 11
5 10
2 8
1 7
7 6
3 9
9 1
3 6
4 2
3 8
9 8
1 10
9 3
7 11
4 4
4 5
5 8
9 7
5 2
6 6
1 11
3 2
8 11
8 9
7 8
2 2
7 3
2 5
5 4
7 5
3 6
6 7
8 4
1 4
8 10
8 2
6 8
1 6
1 2
4 8
6 10
1 5
4 7
6 11
8 7
9 1
9 3
3 8
2 8
5 3
6 9
4 3
5 10
3 11
4 1

output:

3
3 1 1 2 RUU
2 10 3 8 DLL
8 8 6 8 USU
9 6 8 4 LLU
2 1 2 2 RRL
9 11 6 11 UUU
5 10 5 10 LRS
2 8 2 5 LLL
1 7 1 6 RLL
7 6 7 3 LLL
3 9 4 8 SLD
9 1 9 1 RLS
3 6 1 5 LUU
4 2 4 1 RLL
3 8 3 6 LLS
9 8 8 7 ULS
1 10 2 8 DLL
9 3 9 3 RLS
7 11 6 9 LLU
4 4 1 4 UUU
4 5 4 3 SLL
5 8 4 7 LUS
9 7 6 7 UUU
5 2 8 2 DDD
6 6...

result:

ok answer 3

Test #83:

score: 0
Accepted
time: 2ms
memory: 5808kb

input:

30 10 10
9 4
1 8
5 8
8 4
8 3
10 2
4 1
5 2
9 7
4 5
8 9
7 7
8 10
7 5
2 8
6 3
8 5
7 2
9 5
6 7
8 1
6 10
4 2
1 1
1 9
2 6
4 3
2 10
6 5
6 8
1 9
7 4
10 6
8 1
5 10
3 4
5 4
7 3
1 3
1 2
10 1
10 3
4 10
3 6
3 2
1 1
1 6
2 6
7 7
6 9
8 3
6 2
4 3
6 5
1 5
10 5
6 4
9 3
5 1
4 9

output:

3
9 4 10 3 DSL
1 8 1 5 LLL
5 8 4 10 RRU
8 4 8 1 LLL
8 3 7 3 RUL
10 2 10 1 RLL
4 1 1 1 UUU
5 2 3 2 UUS
9 7 10 5 LDL
4 5 2 6 RUU
8 9 7 7 LLU
7 7 7 4 LLL
8 10 6 9 UUL
7 5 5 4 LUU
2 8 1 6 ULL
6 3 4 3 UUS
8 5 10 6 RDD
7 2 5 1 UUL
9 5 8 3 LUL
6 7 6 4 LLL
8 1 9 3 RRD
6 10 4 9 ULU
4 2 3 4 RRU
1 1 1 2 RRL
1 ...

result:

ok answer 3

Test #84:

score: 0
Accepted
time: 9ms
memory: 4964kb

input:

40 100 1
11 1
51 1
65 1
63 1
1 1
31 1
4 1
66 1
7 1
43 1
42 1
59 1
83 1
40 1
85 1
77 1
45 1
41 1
29 1
37 1
13 1
23 1
98 1
91 1
62 1
30 1
81 1
22 1
72 1
49 1
12 1
47 1
88 1
73 1
28 1
79 1
84 1
54 1
76 1
18 1
91 1
28 1
20 1
89 1
76 1
25 1
12 1
79 1
66 1
70 1
49 1
37 1
17 1
24 1
95 1
64 1
98 1
48 1
84 1...

output:

10
11 1 12 1 DUUDDDDUUS
51 1 58 1 UDDDDDDDDS
65 1 73 1 DDDDDDUDDD
63 1 66 1 DDDDDDUSUU
1 1 1 1 DDDDDUUUUU
31 1 27 1 DDDUUUUUUU
4 1 3 1 DDDDSUUUUU
66 1 76 1 DDDDDDDDDD
7 1 2 1 DDUUSUUUUU
43 1 45 1 UUUDDDDDDU
42 1 48 1 UDDDDDDDDU
59 1 65 1 DDDDDDDDUU
83 1 86 1 DDDSUUUDDD
40 1 40 1 UUUUUDDDDD
85 1 95 1...

result:

ok answer 10

Test #85:

score: 0
Accepted
time: 4ms
memory: 2572kb

input:

40 50 2
28 1
32 2
20 2
49 2
43 2
1 1
49 1
28 2
48 2
40 1
30 2
47 2
25 1
5 2
33 1
46 1
12 2
8 2
21 2
14 2
47 1
16 1
13 2
14 1
10 1
15 2
15 1
41 1
39 2
17 1
18 2
25 2
26 2
9 2
23 2
3 2
35 2
26 1
8 1
4 2
41 1
47 1
9 1
6 1
46 2
8 2
25 2
43 1
5 2
21 1
40 2
36 1
42 2
48 2
25 1
48 1
44 2
45 1
47 2
30 1
6 2...

output:

9
28 1 36 2 RDDDDDDDD
32 2 39 1 LDDDDDDDS
20 2 21 1 SUUDDDDLU
49 2 45 1 DLUUUUURL
43 2 42 2 DDLSURUUS
1 1 1 2 RDDDDUUUU
49 1 43 1 DUUUUUUUS
28 2 36 1 DDDDDDDDL
48 2 44 1 DDLUUUUUU
40 1 41 1 DDDDDUUUU
30 2 38 1 DDDDDDDDL
47 2 46 2 DDDLUUUUR
25 1 27 2 RUUUDDDDD
5 2 5 2 DDDLURUUS
33 1 40 2 RDDDDDDDS
46...

result:

ok answer 9

Test #86:

score: 0
Accepted
time: 4ms
memory: 4524kb

input:

40 33 3
23 3
14 1
32 2
28 2
21 3
26 1
9 2
9 1
7 3
19 3
14 3
12 1
3 3
4 2
16 3
33 1
29 1
11 3
8 3
5 2
29 3
25 3
3 2
27 1
5 1
1 3
25 2
9 3
28 3
16 1
22 3
4 3
17 3
30 1
23 1
24 1
24 2
26 3
4 1
1 1
24 2
22 3
30 2
2 3
4 3
6 3
6 1
11 2
33 3
10 1
7 1
11 3
20 3
14 3
14 1
26 2
15 1
1 3
2 1
10 2
8 1
23 1
13 2...

output:

8
23 3 15 3 UUUUUUUU
14 1 8 1 RLUUUUUU
32 2 33 3 RUSUDDDS
28 2 27 3 SURUDDUS
21 3 14 3 UUUUUUSU
26 1 22 3 RRUUDUUU
9 2 10 1 DDDUUDUL
9 1 10 2 RDDDUUUD
7 3 6 3 DDDUUUUS
19 3 12 2 UUUUUULU
14 3 11 2 DLUULUUR
12 1 12 3 RRDUDDUU
3 3 2 1 LLRDLUUS
4 2 2 2 RLDDUUUU
16 3 14 1 DDUULLUU
33 1 32 1 RRUSDLLU
29 ...

result:

ok answer 8

Test #87:

score: 0
Accepted
time: 3ms
memory: 4468kb

input:

40 25 4
9 1
5 4
25 1
1 2
2 3
24 3
19 1
8 2
19 3
5 3
8 1
8 4
8 3
15 3
7 3
18 4
5 1
25 4
12 4
24 2
23 3
3 1
19 4
5 2
13 4
17 4
18 3
11 1
23 4
17 2
18 1
14 4
25 3
3 4
6 2
7 2
21 1
24 4
20 4
9 4
22 4
4 2
15 4
25 1
9 4
19 1
8 4
16 2
10 4
14 1
16 1
17 3
21 1
17 1
19 3
9 1
23 1
18 1
21 3
24 3
6 3
20 3
9 2
...

output:

4
9 1 12 1 DDDS
5 4 4 2 SULL
25 1 23 1 RLUU
1 2 1 1 RLLS
2 3 4 3 RDDL
24 3 20 3 UUUU
19 1 17 1 RLUU
8 2 9 1 DRLL
19 3 18 2 DUUL
5 3 8 4 DRDD
8 1 10 1 RDDL
8 4 10 4 DDDU
8 3 9 2 RDLL
15 3 16 2 DDLU
7 3 9 3 RDDL
18 4 17 3 DUUL
5 1 5 3 RRRL
25 4 24 3 UDLU
12 4 15 4 DDDS
24 2 21 1 ULUU
23 3 21 3 UURL
3 ...

result:

ok answer 4

Test #88:

score: 0
Accepted
time: 2ms
memory: 2476kb

input:

40 20 5
2 2
13 3
6 2
15 1
2 3
12 2
9 1
13 1
10 5
4 5
14 1
17 1
10 1
2 5
8 3
16 5
6 5
5 3
4 2
11 2
9 3
7 2
18 5
4 3
6 3
7 4
12 4
17 2
9 4
20 1
3 4
8 4
16 4
12 5
9 2
13 5
11 3
1 4
17 4
1 2
8 4
19 4
3 5
15 4
14 4
17 3
13 3
17 4
15 2
11 5
9 5
1 3
20 3
11 3
3 2
1 1
9 4
12 3
2 4
4 2
2 2
6 4
17 5
4 4
12 1
...

output:

2
2 2 2 2 RL
13 3 12 2 UL
6 2 6 2 DU
15 1 16 2 RD
2 3 1 3 US
12 2 10 2 UU
9 1 9 1 RL
13 1 14 2 RD
10 5 9 4 LU
4 5 4 4 LS
14 1 15 2 RD
17 1 17 3 RR
10 1 10 1 RL
2 5 2 4 LS
8 3 8 1 LL
16 5 15 4 LU
6 5 6 4 LS
5 3 7 3 DD
4 2 4 2 RL
11 2 12 1 DL
9 3 11 3 DD
7 2 7 2 RL
18 5 19 4 DL
4 3 3 2 UL
6 3 6 1 LL
7...

result:

ok answer 2

Test #89:

score: 0
Accepted
time: 2ms
memory: 4132kb

input:

40 16 6
10 6
7 5
5 1
8 1
7 3
16 3
9 1
15 6
16 2
7 2
12 5
4 5
11 3
4 2
9 3
9 4
10 2
15 5
2 1
5 4
2 4
1 6
2 2
6 3
6 5
14 6
7 4
1 2
8 4
11 5
13 5
11 4
10 3
5 2
1 4
15 2
2 5
1 3
12 6
4 6
1 4
7 2
2 4
11 6
9 4
9 6
4 3
5 4
8 6
9 5
1 3
14 3
11 1
11 5
16 2
8 5
2 1
12 3
16 5
8 3
12 2
15 4
3 6
6 3
11 3
15 5
7 ...

output:

3
10 6 12 5 DDL
7 5 9 6 DRD
5 1 7 1 DDS
8 1 11 1 DDD
7 3 7 2 LDU
16 3 15 5 RUR
9 1 12 1 DDD
15 6 16 4 DLL
16 2 16 2 RLS
7 2 9 1 DDL
12 5 12 2 LLL
4 5 5 4 DLS
11 3 14 3 DDD
4 2 4 1 RLL
9 3 11 3 DDS
9 4 9 5 RRL
10 2 13 2 DDD
15 5 16 3 DLL
2 1 3 2 RDS
5 4 8 4 DDD
2 4 4 3 LDD
1 6 1 4 SLL
2 2 2 1 DLU
6 3...

result:

ok answer 3

Test #90:

score: 0
Accepted
time: 0ms
memory: 1948kb

input:

40 14 7
6 4
3 6
6 2
5 6
7 4
7 5
3 3
13 4
9 5
12 3
9 6
8 6
10 6
9 2
4 2
14 5
11 6
11 3
5 2
5 1
2 6
4 4
4 6
9 1
8 3
13 1
3 1
4 5
12 5
12 6
4 7
13 7
8 4
11 2
14 7
7 2
11 7
6 5
1 2
1 3
2 7
5 4
12 2
2 1
14 4
2 6
5 1
14 2
2 4
10 4
1 2
7 2
11 3
6 1
9 7
5 2
13 6
7 5
14 3
9 5
7 4
14 7
2 2
7 1
10 5
6 4
9 1
12...

output:

3
6 4 6 1 LLL
3 6 2 6 DUU
6 2 7 1 DLS
5 6 5 4 LLS
7 4 7 3 ULD
7 5 7 2 LLL
3 3 1 2 UUL
13 4 14 3 LSD
9 5 10 5 UDD
12 3 12 2 RLL
9 6 7 5 UUL
8 6 7 4 ULL
10 6 10 4 LLS
9 2 9 1 RLL
4 2 3 1 LUS
14 5 14 2 LLL
11 6 9 7 RUU
11 3 11 3 RSL
5 2 2 2 UUU
5 1 5 2 RRL
2 6 2 7 RDU
4 4 3 3 LUS
4 6 6 7 RDD
9 1 8 3 RR...

result:

ok answer 3

Test #91:

score: 0
Accepted
time: 2ms
memory: 5964kb

input:

40 12 8
2 3
10 7
4 5
10 1
11 6
2 7
8 5
8 4
4 7
12 2
3 6
5 5
4 4
7 4
8 7
4 1
3 7
9 4
10 3
5 2
3 1
6 6
5 3
2 4
1 1
11 1
6 5
6 2
5 1
12 6
9 6
4 3
3 5
9 3
3 2
6 8
12 7
7 3
1 7
7 1
5 6
10 5
5 1
4 3
2 3
9 7
12 2
2 2
6 5
1 6
9 3
3 5
10 8
4 4
4 6
12 5
10 4
4 7
2 6
7 6
7 3
3 3
2 7
12 6
9 2
8 1
8 5
12 4
1 1
7...

output:

2
2 3 2 3 RL
10 7 10 8 RS
4 5 6 5 DD
10 1 9 2 RU
11 6 11 5 LS
2 7 2 7 RL
8 5 9 6 RD
8 4 9 5 DR
4 7 4 7 UD
12 2 12 4 RR
3 6 1 6 UU
5 5 5 6 RS
4 4 3 3 LU
7 4 7 4 SS
8 7 9 7 SD
4 1 2 1 UU
3 7 4 8 RD
9 4 10 5 RD
10 3 10 4 RS
5 2 4 3 RU
3 1 2 2 RU
6 6 7 6 SD
5 3 4 4 RU
2 4 3 5 RD
1 1 1 1 RL
11 1 12 2 RD
...

result:

ok answer 2

Test #92:

score: 0
Accepted
time: 2ms
memory: 5928kb

input:

40 11 9
3 4
5 7
6 3
4 8
7 8
4 4
2 7
7 1
8 5
1 8
5 4
10 3
2 8
3 2
11 6
4 7
7 5
1 6
10 2
5 6
11 8
2 4
9 8
8 6
4 5
3 5
9 4
2 1
4 6
1 2
6 7
3 7
2 2
2 9
8 3
2 5
4 2
5 5
8 7
3 8
9 2
5 5
8 3
4 8
5 2
7 5
1 9
1 4
2 1
10 7
3 3
4 3
8 9
4 4
4 6
8 7
3 1
7 2
8 4
11 6
10 9
2 6
7 7
7 4
5 6
9 5
11 7
6 5
8 2
3 6
9 4
...

output:

3
3 4 4 2 DLL
5 7 7 6 DLD
6 3 8 2 DDL
4 8 7 8 DDD
7 8 8 8 DRL
4 4 6 3 DDL
2 7 4 6 DLD
7 1 9 2 RDD
8 5 8 7 RRS
1 8 1 9 DRU
5 4 5 2 LLS
10 3 8 4 RUU
2 8 2 9 RLR
3 2 3 1 RLL
11 6 11 6 RLS
4 7 5 5 LDL
7 5 8 3 LLD
1 6 2 6 DRL
10 2 9 4 RRU
5 6 7 5 DDL
11 8 11 7 RLL
2 4 4 4 DSD
9 8 10 9 RDS
8 6 8 9 RRR
4 5...

result:

ok answer 3

Test #93:

score: 0
Accepted
time: 2ms
memory: 4072kb

input:

40 10 10
9 6
10 8
2 10
7 1
4 1
4 9
5 5
1 10
8 5
5 1
6 10
10 7
8 4
1 9
8 10
8 7
2 1
2 9
4 10
1 3
9 8
10 5
2 2
8 2
1 1
9 7
9 4
6 4
2 7
5 3
8 3
10 10
6 6
6 8
5 8
3 10
1 4
3 6
3 5
9 2
5 7
8 10
10 5
10 7
10 1
4 9
10 10
4 7
3 8
2 4
6 10
3 2
10 2
10 3
5 6
2 1
7 9
3 5
6 5
9 2
8 2
4 4
7 5
7 1
9 4
5 9
4 1
7 2...

output:

3
9 6 9 5 LLR
10 8 10 8 LSR
2 10 4 9 DDL
7 1 7 1 RLS
4 1 4 4 RRR
4 9 5 7 LDL
5 5 5 2 LLL
1 10 2 8 DLL
8 5 7 4 ULS
5 1 4 1 RLU
6 10 8 10 DDS
10 7 10 5 LLS
8 4 9 2 LDL
1 9 3 8 DDL
8 10 9 8 DLL
8 7 7 5 LLU
2 1 2 1 RLS
2 9 5 9 DDD
4 10 4 7 LLL
1 3 2 4 RSD
9 8 10 7 SLD
10 5 10 2 LLL
2 2 3 4 RRD
8 2 10 1 ...

result:

ok answer 3

Test #94:

score: 0
Accepted
time: 10ms
memory: 5088kb

input:

50 1 100
1 86
1 2
1 25
1 77
1 98
1 59
1 57
1 76
1 38
1 55
1 43
1 64
1 54
1 91
1 16
1 13
1 93
1 26
1 9
1 78
1 42
1 89
1 32
1 23
1 14
1 69
1 63
1 94
1 7
1 46
1 84
1 71
1 41
1 65
1 48
1 17
1 8
1 22
1 39
1 99
1 72
1 73
1 5
1 31
1 83
1 44
1 100
1 15
1 75
1 10
1 42
1 75
1 19
1 43
1 100
1 77
1 40
1 87
1 61...

output:

10
1 86 1 78 LRLLLLLLLL
1 2 1 2 RRRRRLLLLL
1 25 1 33 RRRRRRRRRL
1 77 1 71 LRLLLLLRLL
1 98 1 93 LLLLLLLSRR
1 59 1 56 RRLLSLLLRL
1 57 1 52 RRLSLLLLLL
1 76 1 70 RRLLLLLLLL
1 38 1 34 RRRLLLLLLL
1 55 1 51 RRLLLLLLLR
1 43 1 47 RRRRRLRRLL
1 64 1 64 RRRRLLLLLR
1 54 1 46 LLLLSLSLLL
1 91 1 83 LLLLLLLLRL
1 16 ...

result:

ok answer 10

Test #95:

score: 0
Accepted
time: 3ms
memory: 4380kb

input:

50 2 50
2 29
2 27
1 19
2 24
2 38
1 41
1 44
1 47
1 35
2 8
1 45
2 20
1 7
1 13
2 48
2 36
2 11
2 7
2 49
1 48
2 1
1 34
2 33
1 12
1 31
2 35
1 16
1 15
2 14
2 50
1 1
2 16
2 32
1 49
2 39
1 40
1 38
1 23
2 46
1 5
1 25
1 26
1 42
1 33
1 10
1 39
1 37
2 43
1 21
1 9
2 17
1 16
2 43
2 49
2 28
2 13
1 49
1 17
1 24
1 27...

output:

6
2 29 1 24 LLLLLU
2 27 1 22 LLLLUL
1 19 2 14 LLLLLD
2 24 2 20 RLLLLL
2 38 2 37 LRRSLL
1 41 1 41 LLLRRR
1 44 2 43 LLLRRD
1 47 1 45 LLLLRR
1 35 1 30 LLLLLS
2 8 2 9 RRRSLL
1 45 1 43 LLLLRR
2 20 2 19 RLLRLS
1 7 1 11 RRRRRL
1 13 2 10 RLLDLL
2 48 2 50 LRRRLR
2 36 2 31 LLLLLS
2 11 2 11 RRRLLL
2 7 1 4 RLLL...

result:

ok answer 6

Test #96:

score: 0
Accepted
time: 2ms
memory: 6344kb

input:

50 3 33
2 20
1 33
1 14
2 25
3 6
2 5
1 18
3 24
2 26
1 13
3 9
2 22
2 30
3 30
1 10
1 6
3 19
3 31
2 15
3 4
1 4
3 32
1 17
3 28
3 17
3 21
1 25
3 14
2 4
1 30
3 15
3 22
2 3
2 10
3 16
3 2
1 9
2 28
1 11
2 6
1 8
3 10
2 17
3 18
2 2
2 9
1 1
3 26
1 20
1 19
1 2
3 16
3 1
1 32
2 11
2 28
2 5
2 1
3 7
1 11
3 9
1 24
1 6...

output:

4
2 20 2 22 URRD
1 33 1 32 LLSR
1 14 1 14 LLRR
2 25 1 27 RRUS
3 6 3 7 RRSL
2 5 1 6 RLRU
1 18 2 19 DRRL
3 24 2 27 RRRU
2 26 2 30 RRRR
1 13 1 11 DLLU
3 9 3 9 RRLL
2 22 2 25 RRRS
2 30 1 31 RRUL
3 30 2 31 RURL
1 10 2 11 RLRD
1 6 1 7 RLRS
3 19 2 20 RRUL
3 31 1 33 RRUU
2 15 2 17 RRRL
3 4 2 5 RRLU
1 4 1 2 ...

result:

ok answer 4

Test #97:

score: 0
Accepted
time: 4ms
memory: 4488kb

input:

50 4 25
2 15
2 1
3 15
4 15
3 20
2 14
3 13
1 11
4 19
1 21
2 9
1 14
2 24
3 18
3 3
1 20
2 10
4 25
1 10
2 20
2 18
4 22
4 23
4 12
1 1
3 7
4 1
4 14
1 12
1 3
1 9
1 22
1 18
1 17
1 23
2 22
2 2
4 17
2 16
1 2
3 5
3 25
1 16
4 5
4 16
4 9
3 9
1 13
4 3
2 5
2 15
4 16
2 25
3 16
3 1
2 20
4 14
4 13
3 17
1 16
2 11
4 19...

output:

3
2 15 2 12 LLL
2 1 3 1 RDL
3 15 3 13 LLS
4 15 4 12 LLL
3 20 4 22 DRR
2 14 2 11 LLL
3 13 3 10 LLL
1 11 1 14 RRR
4 19 3 19 LRU
1 21 2 20 LSD
2 9 2 10 RRL
1 14 1 11 LLL
2 24 1 24 LRU
3 18 4 16 LDL
3 3 2 3 RUL
1 20 2 18 LLD
2 10 2 9 RLL
4 25 3 23 ULL
1 10 1 7 LLL
2 20 2 19 LLR
2 18 3 17 DLS
4 22 4 21 R...

result:

ok answer 3

Test #98:

score: 0
Accepted
time: 4ms
memory: 4516kb

input:

50 5 20
4 11
1 18
3 13
3 17
2 14
4 17
1 8
2 5
2 12
2 20
1 2
1 5
4 6
3 3
3 4
3 2
2 3
1 20
2 6
1 19
3 7
5 20
3 11
5 17
5 11
2 16
1 1
4 13
5 14
3 19
3 18
4 4
1 9
5 18
5 1
4 15
4 5
4 10
4 3
5 16
2 1
2 18
3 14
3 10
1 4
2 9
5 3
3 8
5 5
5 8
4 10
1 14
1 5
1 11
4 9
4 12
4 2
1 12
4 11
3 20
4 6
2 16
4 18
3 7
2...

output:

3
4 11 4 8 LLL
1 18 1 17 DLU
3 13 4 12 DSL
3 17 2 17 LUR
2 14 1 14 RUL
4 17 4 17 LRS
1 8 1 11 RRR
2 5 2 8 RRR
2 12 2 13 RRL
2 20 4 19 DDL
1 2 1 1 RLL
1 5 1 6 RRL
4 6 4 9 RRR
3 3 3 2 RLL
3 4 3 7 RRR
3 2 3 1 DLU
2 3 4 2 DDL
1 20 2 20 DLR
2 6 2 3 LLL
1 19 1 18 RLL
3 7 3 8 RUD
5 20 5 20 LRS
3 11 3 12 RR...

result:

ok answer 3

Test #99:

score: 0
Accepted
time: 3ms
memory: 2544kb

input:

50 6 16
1 4
3 11
4 3
5 5
2 13
4 14
2 14
3 10
2 8
5 10
4 9
2 16
1 8
3 1
1 14
3 13
6 6
3 9
6 4
2 11
2 2
3 7
6 13
4 11
3 16
5 13
4 7
1 16
1 2
5 9
3 12
1 10
5 15
5 16
2 15
5 11
5 4
1 15
4 6
2 1
4 1
4 15
3 14
1 12
4 13
3 15
4 5
5 7
5 6
2 7
3 16
6 5
5 13
5 9
6 13
6 16
4 2
3 9
3 11
6 9
1 10
4 1
3 15
4 7
4 ...

output:

4
1 4 2 4 RSLD
3 11 5 9 LDLD
4 3 3 2 RULL
5 5 5 3 RLLL
2 13 1 10 LLUL
4 14 5 16 SRRD
2 14 2 10 LLLL
3 10 4 7 LLLD
2 8 2 7 RLLS
5 10 6 7 LLLD
4 9 5 6 LLLD
2 16 6 16 DDDD
1 8 2 6 DLLS
3 1 3 1 RRLL
1 14 3 14 LRDD
3 13 3 9 LLLL
6 6 6 3 SLLL
3 9 4 6 DLLL
6 4 6 2 RLLL
2 11 2 11 LLRR
2 2 2 2 RRLL
3 7 4 4 L...

result:

ok answer 4

Test #100:

score: 0
Accepted
time: 3ms
memory: 6088kb

input:

50 7 14
2 9
7 11
3 7
5 9
1 7
1 5
2 13
1 4
3 11
2 12
5 14
4 4
4 3
4 13
3 3
4 11
7 14
6 12
6 13
5 10
3 1
4 9
2 4
6 8
3 8
4 1
6 3
1 6
5 13
7 9
5 3
2 10
3 10
4 10
3 6
4 2
7 5
5 7
2 2
5 6
6 11
6 1
6 9
2 5
5 2
5 4
2 1
5 8
2 3
4 8
3 1
3 7
6 1
7 14
7 6
7 5
6 2
3 4
4 7
4 1
6 5
2 7
4 5
6 14
7 8
1 13
5 5
5 10
...

output:

2
2 9 2 11 RR
7 11 5 11 UU
3 7 3 5 LL
5 9 5 7 LL
1 7 3 7 DD
1 5 2 4 LD
2 13 2 14 RS
1 4 1 4 RL
3 11 2 12 RU
2 12 1 13 RU
5 14 5 13 LS
4 4 4 6 RR
4 3 4 5 RR
4 13 2 13 UU
3 3 3 4 RS
4 11 4 13 RR
7 14 7 14 UD
6 12 7 13 RD
6 13 6 12 LS
5 10 5 10 LR
3 1 3 1 RL
4 9 4 11 RR
2 4 2 6 RR
6 8 6 10 RR
3 8 4 9 R...

result:

ok answer 2

Test #101:

score: 0
Accepted
time: 3ms
memory: 4488kb

input:

50 8 12
6 7
5 5
3 2
4 9
6 10
8 10
8 9
1 5
5 2
7 12
5 7
2 9
4 10
2 8
1 2
7 5
6 1
2 11
3 5
4 1
5 6
2 12
2 6
7 4
5 12
8 11
1 11
4 12
5 9
1 3
7 2
7 10
4 11
7 6
8 4
1 10
4 7
8 1
1 4
7 11
5 11
3 4
2 4
6 8
4 2
1 7
6 3
1 6
3 1
5 4
5 8
2 3
3 9
4 8
8 12
5 11
3 10
5 1
5 2
2 8
6 2
6 3
1 11
7 5
1 9
2 4
7 12
4 9
...

output:

3
6 7 6 4 LLL
5 5 6 3 DLL
3 2 2 4 RRU
4 9 4 8 LRL
6 10 5 8 LUL
8 10 5 10 UUU
8 9 8 6 LLL
1 5 1 6 RRL
5 2 4 2 RLU
7 12 5 11 ULU
5 7 4 7 UUD
2 9 1 11 RUR
4 10 4 9 LUD
2 8 2 8 RLS
1 2 2 2 RDL
7 5 7 2 LLL
6 1 5 1 RLU
2 11 2 10 RLL
3 5 2 5 RLU
4 1 3 1 RLU
5 6 5 3 LLL
2 12 3 10 DLL
2 6 2 7 RLR
7 4 6 5 RSU...

result:

ok answer 3

Test #102:

score: 0
Accepted
time: 3ms
memory: 5980kb

input:

50 9 11
3 11
7 6
4 8
3 9
9 6
2 10
8 1
4 7
9 9
3 1
7 10
1 7
5 8
2 11
7 4
9 5
9 3
6 10
9 11
2 6
2 7
8 3
1 1
9 7
2 8
7 5
5 11
2 5
1 2
5 10
2 3
7 3
9 4
1 9
6 7
3 4
5 1
1 5
1 6
5 7
5 5
7 11
5 9
5 6
6 6
7 8
2 4
4 9
1 3
8 4
4 5
6 6
5 3
6 4
9 9
5 9
7 8
1 10
9 10
6 3
2 2
1 8
6 11
1 3
9 1
7 11
1 4
1 7
2 6
6 5...

output:

2
3 11 4 10 LD
7 6 7 4 LL
4 8 2 8 UU
3 9 1 9 UU
9 6 9 6 LR
2 10 1 10 US
8 1 8 3 RR
4 7 2 7 UU
9 9 9 8 SL
3 1 3 3 RR
7 10 7 10 LR
1 7 1 5 LL
5 8 5 9 SR
2 11 3 10 DL
7 4 6 4 SU
9 5 9 7 RR
9 3 9 1 LL
6 10 5 11 UR
9 11 9 10 LS
2 6 2 4 LL
2 7 3 8 RD
8 3 6 3 UU
1 1 3 1 DD
9 7 9 9 RR
2 8 2 6 LL
7 5 6 5 US
...

result:

ok answer 2

Test #103:

score: 0
Accepted
time: 3ms
memory: 5876kb

input:

50 10 10
7 4
8 5
10 2
6 7
8 10
9 5
7 6
8 7
7 3
9 8
6 1
10 7
3 5
4 10
9 7
10 6
8 3
7 7
5 1
9 3
1 3
2 7
7 2
6 2
10 4
7 9
2 8
5 2
2 9
3 7
1 4
3 9
3 10
8 8
5 3
7 1
8 9
1 8
2 10
9 10
1 10
9 1
2 6
10 5
5 4
6 5
10 1
5 7
10 8
10 3
8 6
8 8
7 8
7 1
10 9
2 4
7 5
10 5
7 9
6 1
10 6
10 2
7 4
4 1
3 7
2 3
6 10
2 6
...

output:

2
7 4 7 4 LR
8 5 9 5 DS
10 2 10 2 RL
6 7 5 7 US
8 10 7 9 UL
9 5 8 4 UL
7 6 8 5 LD
8 7 8 6 LS
7 3 7 5 RR
9 8 7 8 UU
6 1 4 1 UU
10 7 8 7 UU
3 5 2 4 LU
4 10 6 10 DD
9 7 9 8 RS
10 6 9 7 RU
8 3 8 3 RL
7 7 7 7 RL
5 1 3 1 UU
9 3 9 3 RL
1 3 2 2 DL
2 7 2 6 LS
7 2 8 1 LD
6 2 6 4 RR
10 4 10 6 RR
7 9 5 9 UU
2 8...

result:

ok answer 2

Test #104:

score: 0
Accepted
time: 23ms
memory: 6076kb

input:

60 100 1
65 1
1 1
55 1
98 1
4 1
96 1
91 1
64 1
88 1
62 1
99 1
12 1
18 1
87 1
84 1
6 1
22 1
59 1
66 1
61 1
89 1
24 1
10 1
80 1
9 1
54 1
40 1
78 1
90 1
75 1
74 1
27 1
51 1
56 1
60 1
70 1
86 1
35 1
95 1
41 1
29 1
67 1
30 1
69 1
44 1
34 1
39 1
48 1
85 1
92 1
3 1
58 1
77 1
49 1
43 1
47 1
73 1
16 1
83 1
6...

output:

18
65 1 50 1 UUDUUUUUUUUUUUUUUS
1 1 1 1 DDDDDDDDDUUUUUUUUU
55 1 37 1 UUUUUUUUUUUUUUUUUU
98 1 96 1 UUUDDDDDUDUDUDUUUU
4 1 4 1 DDDDDDDDDUUUUUUUUU
96 1 89 1 UUUUUDDDDUUUUUUUSD
91 1 99 1 UUUDDUDDDDDDDDDDDU
64 1 52 1 UUUUUUUUDUUDUUUUUD
88 1 81 1 UUUUUSUUUUUDDDDDUU
62 1 48 1 UUUUUUUUUDUUSUUSUU
99 1 88 1 U...

result:

ok answer 18

Test #105:

score: 0
Accepted
time: 7ms
memory: 4444kb

input:

60 50 2
6 1
2 2
1 2
41 2
20 1
2 1
4 2
48 1
37 1
43 2
40 1
42 1
6 2
36 1
48 2
32 1
7 1
33 1
30 2
27 2
40 2
12 2
17 2
15 2
10 2
11 2
49 2
8 1
28 1
42 2
13 1
46 2
24 2
15 1
46 1
50 1
21 2
29 1
47 2
39 1
35 2
1 1
30 1
37 2
14 2
25 1
25 2
24 1
26 2
45 1
7 2
38 1
3 2
29 2
19 2
12 1
28 2
19 1
49 1
35 1
38 ...

output:

5
6 1 5 1 RDLUU
2 2 2 1 DDLUU
1 2 3 1 LRDDL
41 2 39 2 SUDUU
20 1 17 1 RUULU
2 1 4 2 RDDDU
4 2 5 2 DLRDU
48 1 48 1 URDLS
37 1 33 2 RUUUU
43 2 40 2 LUURU
40 1 38 2 RUUUD
42 1 39 1 RUUUL
6 2 4 1 LRLUU
36 1 32 1 SUUUU
48 2 49 2 UUDDD
32 1 29 1 URUUL
7 1 7 2 RDUDU
33 1 28 1 UUUUU
30 2 27 2 DUUUU
27 2 22 ...

result:

ok answer 5

Test #106:

score: 0
Accepted
time: 5ms
memory: 2488kb

input:

60 33 3
11 2
19 3
30 1
33 3
31 3
1 1
2 1
28 2
15 3
23 2
10 1
12 2
30 2
25 2
25 3
15 2
12 1
9 3
8 1
7 1
16 3
13 3
12 3
9 2
28 3
29 3
6 3
27 3
4 2
6 2
22 3
19 1
3 3
9 1
26 1
3 1
11 1
30 3
26 3
24 1
15 1
32 2
13 1
21 2
17 2
7 3
14 2
5 2
8 2
13 2
18 3
29 2
20 3
20 1
6 1
24 2
27 1
32 3
33 1
20 2
22 1
26 ...

output:

4
11 2 13 2 DRDL
19 3 19 1 ULDL
30 1 27 2 UURU
33 3 31 1 ULLU
31 3 29 1 ULLU
1 1 2 1 RDLS
2 1 3 2 RRDL
28 2 28 1 DULS
15 3 19 3 DDDD
23 2 20 1 LUUU
10 1 12 1 UDDD
12 2 15 3 DRDD
30 2 29 2 LURS
25 2 26 2 RLDS
25 3 23 3 UDUU
15 2 15 2 RDLU
12 1 13 1 DRLS
9 3 9 2 DLUS
8 1 5 2 UURU
7 1 3 1 UUUU
16 3 18 ...

result:

ok answer 4

Test #107:

score: 0
Accepted
time: 3ms
memory: 4512kb

input:

60 25 4
22 4
10 3
22 1
4 2
16 4
24 2
22 3
17 1
5 4
15 2
16 3
21 3
10 1
25 1
9 3
1 1
20 3
8 1
19 1
18 4
20 4
21 4
10 4
18 2
24 1
12 2
11 1
3 2
11 2
23 3
4 4
20 2
8 3
8 4
13 1
21 1
7 4
6 2
11 3
15 3
3 1
22 2
16 1
25 3
3 4
6 3
1 3
17 3
16 2
6 1
19 2
23 1
12 4
15 4
2 2
5 2
3 3
13 3
19 4
23 4
1 1
3 3
6 4...

output:

3
22 4 21 3 SUL
10 3 9 3 RLU
22 1 20 2 UUR
4 2 4 1 RLL
16 4 13 4 UUU
24 2 22 1 LUU
22 3 23 1 DLL
17 1 17 2 RRL
5 4 4 2 ULL
15 2 12 2 UUU
16 3 15 1 ULL
21 3 20 3 RLU
10 1 10 2 RUD
25 1 24 1 RLU
9 3 9 1 LLS
1 1 3 2 RDD
20 3 19 4 RUS
8 1 8 3 RRS
19 1 18 2 RSU
18 4 15 4 UUU
20 4 17 4 UUU
21 4 21 1 LLL
1...

result:

ok answer 3

Test #108:

score: 0
Accepted
time: 3ms
memory: 2480kb

input:

60 20 5
6 2
15 5
3 1
2 5
15 2
3 2
10 2
6 5
1 3
9 1
15 3
13 4
11 4
5 1
9 2
17 3
18 1
9 5
3 3
20 2
4 2
4 3
1 1
5 2
17 2
3 5
7 3
7 5
2 1
9 3
7 4
15 1
8 2
6 4
8 3
14 5
10 4
19 4
16 5
14 1
7 2
20 4
18 4
11 1
12 5
12 3
8 4
17 4
16 4
12 4
2 4
2 2
4 4
10 5
2 3
6 3
8 1
4 5
19 5
8 5
20 4
19 2
16 2
3 2
12 4
9 ...

output:

4
6 2 7 2 RSLD
15 5 18 4 DDDL
3 1 4 1 DRLS
2 5 2 3 ULLD
15 2 15 2 RDLU
3 2 3 2 RRLL
10 2 11 2 RLDS
6 5 7 4 LDLR
1 3 1 4 RRSL
9 1 8 1 RULS
15 3 16 1 DLLS
13 4 14 4 DSLR
11 4 13 4 LRDD
5 1 5 2 RRLS
9 2 12 3 RDDD
17 3 20 2 DDDL
18 1 19 2 RRDL
9 5 11 3 DLLD
3 3 1 2 LUUS
20 2 19 1 LURL
4 2 1 3 RUUU
4 3 4...

result:

ok answer 4

Test #109:

score: 0
Accepted
time: 4ms
memory: 6148kb

input:

60 16 6
1 3
7 1
13 3
10 5
4 2
14 3
6 4
1 4
8 3
12 2
10 3
5 6
2 4
7 3
11 1
6 1
13 2
16 3
5 3
13 5
3 1
2 1
2 5
15 1
2 6
14 5
9 5
15 4
8 2
5 5
4 1
8 6
8 1
13 6
3 5
14 2
2 2
3 6
6 5
1 5
16 6
10 2
3 4
9 6
11 4
10 4
6 3
8 5
11 2
7 2
1 6
7 6
15 2
4 3
16 5
3 2
16 2
12 4
4 4
7 4
1 3
16 5
12 3
3 3
8 5
15 1
9 ...

output:

3
1 3 2 3 DRL
7 1 10 1 DDD
13 3 15 2 LDD
10 5 12 4 LDD
4 2 5 1 DSL
14 3 15 1 LDL
6 4 7 5 DSR
1 4 1 3 DLU
8 3 11 3 DDD
12 2 14 3 RDD
10 3 12 2 DDL
5 6 8 6 DDD
2 4 1 2 ULL
7 3 8 1 LDL
11 1 14 1 DDD
6 1 7 1 RDL
13 2 14 2 RLD
16 3 16 2 RLL
5 3 7 2 DDL
13 5 14 5 LDR
3 1 4 1 DDU
2 1 2 1 RLS
2 5 1 5 DUU
15...

result:

ok answer 3

Test #110:

score: 0
Accepted
time: 4ms
memory: 2576kb

input:

60 14 7
14 1
3 5
8 5
7 7
2 4
9 4
14 3
11 7
6 2
1 4
9 6
3 6
12 3
7 4
12 2
13 6
14 4
13 1
2 1
1 6
11 3
12 6
4 2
11 2
14 7
2 2
7 6
11 5
6 4
9 1
10 7
4 3
10 1
14 5
4 7
14 6
10 3
7 3
12 4
5 4
4 1
8 7
4 5
3 1
6 3
6 7
8 2
2 5
9 7
10 6
13 3
13 2
3 3
7 1
9 2
8 4
12 1
7 5
6 5
10 4
12 7
7 6
6 4
6 1
8 3
7 1
13 ...

output:

3
14 1 14 2 RRL
3 5 2 5 RUL
8 5 6 4 LUU
7 7 7 6 LRL
2 4 1 4 RUL
9 4 8 3 LSU
14 3 11 3 UUU
11 7 12 7 UDD
6 2 3 2 UUU
1 4 1 3 RLL
9 6 8 4 LLU
3 6 2 7 RSU
12 3 10 4 RUU
7 4 6 2 LLU
12 2 9 2 UUU
13 6 11 5 UUL
14 4 13 4 RUL
13 1 10 1 UUU
2 1 2 2 RRL
1 6 2 6 RLD
11 3 9 4 RUU
12 6 10 5 ULU
4 2 2 3 RUU
11 2...

result:

ok answer 3

Test #111:

score: 0
Accepted
time: 2ms
memory: 6020kb

input:

60 12 8
11 4
6 6
9 3
10 8
7 5
9 2
5 8
11 8
8 8
9 6
5 1
12 4
9 8
7 2
2 1
7 4
8 6
8 5
12 1
1 8
12 8
4 8
2 7
7 7
12 7
9 4
7 3
6 1
4 1
2 8
11 7
2 5
8 7
11 2
1 6
4 4
2 4
8 4
6 2
4 2
10 6
7 1
5 6
12 6
3 6
5 2
4 7
9 1
2 6
4 6
10 2
3 2
3 1
8 3
12 5
10 4
4 3
1 2
6 4
6 7
1 4
2 3
6 6
4 2
7 1
10 6
12 7
4 4
11 3...

output:

2
11 4 12 5 RD
6 6 5 6 US
9 3 11 3 DD
10 8 11 7 DL
7 5 6 6 UR
9 2 10 3 RD
5 8 4 7 LU
11 8 11 8 DU
8 8 9 7 LD
9 6 11 6 DD
5 1 4 2 RU
12 4 12 2 LL
9 8 8 7 UL
7 2 9 2 DD
2 1 2 1 RL
7 4 8 3 LD
8 6 7 7 UR
8 5 6 5 UU
12 1 12 1 RL
1 8 1 8 LR
12 8 12 6 LL
4 8 6 8 DD
2 7 2 7 RL
7 7 8 8 RD
12 7 12 7 LR
9 4 9 ...

result:

ok answer 2

Test #112:

score: 0
Accepted
time: 4ms
memory: 5844kb

input:

60 11 9
1 5
1 1
6 1
5 7
10 8
3 2
5 4
5 5
10 6
1 9
11 8
6 8
8 3
7 6
9 9
2 8
1 7
8 7
10 1
3 6
5 6
4 1
2 7
3 4
8 6
5 9
10 3
10 7
5 3
8 2
6 3
10 2
1 8
9 3
6 7
4 6
7 1
4 9
3 5
3 8
9 6
6 9
11 3
4 7
2 9
9 8
4 8
4 2
5 8
2 5
10 5
2 3
6 5
5 1
7 2
9 1
7 8
7 4
1 2
8 9
4 6
7 9
6 3
10 5
3 5
6 8
7 8
10 7
9 5
11 2
...

output:

2
1 5 1 7 RR
1 1 1 3 RR
6 1 7 1 DS
5 7 5 7 UD
10 8 9 9 UR
3 2 2 1 LU
5 4 4 4 US
5 5 6 4 LD
10 6 9 5 UL
1 9 3 9 DD
11 8 10 7 LU
6 8 8 8 DD
8 3 8 1 LL
7 6 8 6 DS
9 9 11 9 DD
2 8 2 6 LL
1 7 1 9 RR
8 7 8 7 DU
10 1 10 1 RL
3 6 4 5 LD
5 6 6 6 SD
4 1 4 1 RL
2 7 1 8 RU
3 4 3 2 LL
8 6 9 7 RD
5 9 7 9 DD
10 3 ...

result:

ok answer 2

Test #113:

score: 0
Accepted
time: 4ms
memory: 5804kb

input:

60 10 10
3 1
10 10
7 3
3 4
10 5
9 7
6 1
4 1
3 5
1 6
7 8
2 10
5 6
1 3
8 4
4 5
3 9
10 6
2 3
8 9
8 6
8 8
6 8
8 10
3 10
7 4
2 6
7 7
1 10
10 8
1 4
9 9
10 1
3 3
3 8
4 3
6 3
7 10
2 2
1 2
8 7
5 3
7 1
2 9
6 5
7 6
2 8
8 5
4 9
9 5
3 7
10 2
1 5
2 7
9 3
9 4
8 2
5 10
2 1
9 8
5 8
6 3
9 4
5 1
8 3
8 1
1 3
3 5
6 6
2 ...

output:

2
3 1 2 2 RU
10 10 10 9 SL
7 3 6 2 UL
3 4 3 3 LS
10 5 9 4 LU
9 7 8 6 LU
6 1 5 1 US
4 1 5 2 RD
3 5 5 5 DD
1 6 1 5 LS
7 8 7 6 LL
2 10 2 8 LL
5 6 5 4 LL
1 3 1 3 RL
8 4 7 3 UL
4 5 3 6 RU
3 9 5 9 DD
10 6 10 5 LS
2 3 3 4 RD
8 9 8 7 LL
8 6 7 5 LU
8 8 8 8 UD
6 8 6 8 RL
8 10 10 10 DD
3 10 2 9 LU
7 4 6 5 UR
2...

result:

ok answer 2

Test #114:

score: 0
Accepted
time: 19ms
memory: 6076kb

input:

70 100 1
100 1
38 1
87 1
80 1
90 1
60 1
61 1
15 1
40 1
20 1
12 1
66 1
88 1
92 1
11 1
64 1
34 1
28 1
55 1
26 1
72 1
1 1
76 1
3 1
98 1
67 1
69 1
7 1
44 1
24 1
30 1
56 1
79 1
93 1
47 1
29 1
46 1
5 1
49 1
77 1
74 1
73 1
25 1
99 1
33 1
19 1
18 1
51 1
86 1
48 1
9 1
70 1
52 1
4 1
94 1
50 1
14 1
91 1
27 1
2...

output:

5
100 1 99 1 UUDDU
38 1 37 1 DUUDU
87 1 84 1 DUUUU
80 1 76 1 UUUUS
90 1 86 1 UUSUU
60 1 57 1 DUUUU
61 1 64 1 DDDDU
15 1 11 1 USUUU
40 1 38 1 DUSUU
20 1 23 1 UDDDD
12 1 7 1 UUUUU
66 1 61 1 UUUUU
88 1 89 1 UUDDD
92 1 91 1 UUUDD
11 1 16 1 DDDDD
64 1 60 1 UUUSU
34 1 33 1 DDUUU
28 1 29 1 DDDUU
55 1 58 1 ...

result:

ok answer 5

Test #115:

score: 0
Accepted
time: 8ms
memory: 2452kb

input:

70 50 2
29 2
49 2
25 1
30 1
40 1
6 1
4 2
12 1
22 1
11 2
29 1
28 2
17 1
17 2
27 2
36 2
46 2
44 2
38 1
3 2
45 2
44 1
34 2
5 1
30 2
13 2
14 1
47 1
48 2
40 2
34 1
35 2
1 2
18 1
24 2
23 2
18 2
8 2
15 2
31 1
33 1
21 1
37 2
42 1
2 2
24 1
12 2
25 2
45 1
16 2
41 2
23 1
15 1
14 2
32 2
46 1
16 1
10 2
22 2
42 2...

output:

4
29 2 32 1 DDDL
49 2 48 1 UUDL
25 1 25 1 DUDU
30 1 33 1 DDSD
40 1 39 1 SRLU
6 1 5 2 RUUD
4 2 1 1 LUUU
12 1 9 1 SUUU
22 1 20 1 RUUL
11 2 9 2 LUUR
29 1 26 1 UUSU
28 2 29 2 DUSD
17 1 16 2 RUDU
17 2 15 1 LUUS
27 2 31 2 DDDD
36 2 38 2 DUDD
46 2 47 1 LRDL
44 2 42 1 USUL
38 1 37 1 DUUS
3 2 2 1 DLUU
45 2 4...

result:

ok answer 4

Test #116:

score: 0
Accepted
time: 3ms
memory: 5692kb

input:

70 33 3
16 3
31 1
5 2
23 2
4 1
28 2
19 3
29 3
22 2
1 3
20 2
25 2
12 3
3 3
31 2
19 1
16 1
17 2
8 1
5 1
28 1
14 2
32 2
6 2
31 3
5 3
13 3
32 1
12 2
21 1
14 3
1 2
15 2
17 1
6 1
20 3
21 3
7 1
11 3
13 1
27 1
29 1
20 1
2 3
22 1
18 1
26 2
24 1
23 3
1 1
21 2
15 1
33 2
3 1
6 3
13 2
26 3
30 2
12 1
17 3
22 3
27...

output:

2
16 3 16 3 UD
31 1 31 1 RL
5 2 6 3 DR
23 2 25 2 DD
4 1 5 2 RD
28 2 28 1 LS
19 3 19 3 UD
29 3 30 3 DS
22 2 23 1 LD
1 3 2 2 DL
20 2 19 1 LU
25 2 26 1 DL
12 3 11 2 UL
3 3 5 3 DD
31 2 32 1 LD
19 1 17 1 UU
16 1 16 1 RL
17 2 17 2 RL
8 1 9 2 RD
5 1 6 2 RD
28 1 27 2 RU
14 2 13 1 LU
32 2 33 1 DL
6 2 6 1 LS
...

result:

ok answer 2

Test #117:

score: 0
Accepted
time: 6ms
memory: 2516kb

input:

70 25 4
14 1
4 1
2 1
22 1
17 4
24 2
5 4
19 2
15 3
17 1
21 2
5 1
10 4
14 3
8 1
6 1
10 2
24 3
3 1
22 3
3 2
7 4
21 4
25 2
16 2
11 3
25 1
20 2
23 4
5 2
11 2
7 1
3 3
6 2
14 2
12 4
16 4
20 3
16 1
15 2
1 1
20 4
8 4
13 3
13 4
16 3
23 3
19 3
8 3
4 2
18 1
21 1
18 2
17 2
19 1
11 4
25 4
22 4
21 3
4 3
13 1
25 3
...

output:

2
14 1 15 1 DS
4 1 2 1 UU
2 1 1 1 US
22 1 22 1 RL
17 4 16 3 UL
24 2 23 1 LU
5 4 7 4 DD
19 2 20 1 DL
15 3 14 2 LU
17 1 19 1 DD
21 2 21 2 RL
5 1 5 3 RR
10 4 12 4 DD
14 3 15 4 RD
8 1 7 1 US
6 1 5 1 US
10 2 9 1 LU
24 3 24 3 RL
3 1 3 1 RL
22 3 22 3 DU
3 2 1 2 UU
7 4 7 2 LL
21 4 21 4 UD
25 2 23 2 UU
16 2 ...

result:

ok answer 2

Test #118:

score: 0
Accepted
time: 6ms
memory: 5980kb

input:

70 20 5
20 2
9 3
1 1
2 1
2 2
5 2
12 2
14 4
6 1
20 5
3 1
3 2
11 4
1 4
3 5
14 1
17 1
7 1
7 5
18 4
7 4
1 2
17 5
6 3
13 4
16 4
7 2
5 5
5 1
12 5
13 1
19 2
14 2
8 5
10 1
8 1
14 3
15 4
12 3
3 4
18 2
10 5
4 3
7 3
18 5
15 2
9 2
12 4
13 2
16 5
11 1
18 1
15 3
4 5
18 3
13 5
6 4
2 3
9 5
20 3
2 5
8 4
5 4
15 1
19 ...

output:

2
20 2 20 2 RL
9 3 9 3 LR
1 1 1 1 RL
2 1 4 1 DD
2 2 3 1 LD
5 2 6 1 LD
12 2 11 3 UR
14 4 14 2 LL
6 1 7 2 RD
20 5 20 4 SL
3 1 4 2 RD
3 2 5 2 DD
11 4 13 4 DD
1 4 1 2 LL
3 5 5 5 DD
14 1 15 2 DR
17 1 17 1 RL
7 1 8 2 RD
7 5 7 3 LL
18 4 19 4 DS
7 4 8 5 RD
1 2 2 1 DL
17 5 19 5 DD
6 3 6 4 RS
13 4 15 4 DD
16 ...

result:

ok answer 2

Test #119:

score: 0
Accepted
time: 6ms
memory: 6052kb

input:

70 16 6
3 6
3 4
1 2
16 4
8 1
11 4
9 4
10 4
8 2
13 6
6 4
7 4
9 5
4 1
1 6
5 1
16 6
8 3
12 4
10 3
14 5
6 5
13 5
4 4
11 6
1 4
10 6
7 6
10 5
5 3
11 1
12 2
2 2
14 3
6 2
2 6
8 4
16 5
15 6
11 5
1 3
12 1
7 1
12 6
4 2
13 4
3 3
2 3
15 5
1 5
15 4
14 1
12 5
14 6
6 1
10 1
9 1
4 5
13 3
7 3
5 5
3 2
11 3
4 3
2 4
15 ...

output:

2
3 6 3 4 LL
3 4 3 3 LS
1 2 2 3 RD
16 4 16 2 LL
8 1 7 2 UR
11 4 13 4 DD
9 4 10 3 LD
10 4 11 5 DR
8 2 10 2 DD
13 6 14 5 LD
6 4 5 4 SU
7 4 6 5 RU
9 5 9 5 UD
4 1 3 2 RU
1 6 1 4 LL
5 1 5 2 RS
16 6 16 4 LL
8 3 9 2 LD
12 4 13 5 DR
10 3 12 3 DD
14 5 15 6 DR
6 5 7 6 RD
13 5 14 4 DL
4 4 5 3 LD
11 6 12 5 LD
1...

result:

ok answer 2

Test #120:

score: 0
Accepted
time: 4ms
memory: 2528kb

input:

70 14 7
9 3
11 5
6 6
1 6
1 3
9 2
4 1
14 3
9 5
13 2
6 2
12 1
5 5
7 3
7 6
5 2
10 3
4 4
5 1
12 6
13 1
3 3
1 2
12 4
13 6
11 3
8 5
8 3
2 5
1 7
10 5
12 2
2 6
12 3
9 1
10 7
6 7
6 1
2 4
8 2
9 4
3 4
10 6
5 7
11 4
2 3
2 2
3 2
12 5
8 4
7 5
14 6
11 6
6 4
12 7
8 6
13 5
7 4
4 2
11 2
1 5
1 4
7 2
6 5
3 7
3 1
2 7
2 ...

output:

2
9 3 10 2 DL
11 5 11 5 LR
6 6 7 7 DR
1 6 1 6 LR
1 3 1 2 LS
9 2 9 2 RL
4 1 5 2 RD
14 3 13 2 LU
9 5 9 3 LL
13 2 12 1 LU
6 2 7 3 RD
12 1 12 2 RS
5 5 6 4 LD
7 3 7 1 LL
7 6 7 6 DU
5 2 6 3 RD
10 3 10 1 LL
4 4 4 5 RS
5 1 6 2 RD
12 6 12 6 LR
13 1 14 2 RD
3 3 4 4 RD
1 2 1 4 RR
12 4 12 4 LR
13 6 14 5 LD
11 3...

result:

ok answer 2

Test #121:

score: 0
Accepted
time: 2ms
memory: 6192kb

input:

70 12 8
4 6
2 7
12 6
8 4
10 8
6 6
3 3
4 1
12 5
9 6
2 1
6 1
6 8
11 4
11 5
6 2
9 3
3 7
5 6
5 2
3 1
11 2
4 4
1 5
7 1
10 2
1 4
10 3
1 6
10 6
2 3
10 5
1 3
12 2
6 4
1 8
12 1
12 3
9 8
1 1
8 2
2 4
12 4
4 8
9 5
8 7
2 6
11 6
2 8
7 4
8 6
12 7
2 2
8 1
3 2
9 7
6 7
6 3
9 2
1 7
4 7
5 1
3 8
11 1
7 3
11 8
8 5
7 2
3 ...

output:

2
4 6 4 5 SL
2 7 4 7 DD
12 6 12 6 RL
8 4 9 3 LD
10 8 12 8 DD
6 6 6 6 LR
3 3 4 4 DR
4 1 6 1 DD
12 5 11 4 LU
9 6 9 6 RL
2 1 3 1 DS
6 1 7 2 RD
6 8 8 8 DD
11 4 10 5 RU
11 5 11 5 RL
6 2 7 1 LD
9 3 10 2 LD
3 7 5 7 DD
5 6 5 6 DU
5 2 5 4 RR
3 1 4 2 RD
11 2 11 2 RL
4 4 5 5 RD
1 5 3 5 DD
7 1 8 2 RD
10 2 10 4 ...

result:

ok answer 2

Test #122:

score: 0
Accepted
time: 2ms
memory: 4568kb

input:

70 11 9
1 7
9 5
4 1
1 5
11 2
3 8
4 8
11 4
3 6
1 9
9 4
8 8
1 1
2 8
1 6
3 9
8 3
4 5
10 8
7 2
9 2
6 8
8 7
11 8
6 5
10 5
7 7
10 7
9 7
6 3
11 1
7 4
8 9
2 3
3 5
11 7
2 7
8 1
6 6
7 8
3 1
10 1
10 3
4 6
11 3
10 4
6 4
5 7
1 2
10 2
8 6
2 1
4 2
4 3
7 5
3 2
9 9
5 1
10 9
11 9
8 5
2 9
5 9
7 1
7 9
6 2
6 7
1 3
11 5
...

output:

2
1 7 2 7 DS
9 5 8 4 UL
4 1 5 2 RD
1 5 1 3 LL
11 2 10 1 LU
3 8 3 8 LR
4 8 5 8 SD
11 4 10 3 LU
3 6 3 4 LL
1 9 1 9 LR
9 4 9 5 SR
8 8 7 7 LU
1 1 1 1 RL
2 8 2 8 RL
1 6 1 8 RR
3 9 3 9 DU
8 3 8 1 LL
4 5 4 7 RR
10 8 10 7 LS
7 2 7 2 RL
9 2 9 3 RS
6 8 5 7 LU
8 7 8 7 LR
11 8 11 6 LL
6 5 5 6 RU
10 5 9 4 UL
7 7...

result:

ok answer 2

Test #123:

score: 0
Accepted
time: 5ms
memory: 6028kb

input:

70 10 10
7 9
3 1
6 2
9 10
8 7
2 4
5 9
10 6
3 9
7 8
4 4
2 6
5 4
6 1
8 9
7 6
10 8
9 7
1 10
6 8
3 4
8 4
1 2
1 5
7 4
6 3
2 5
2 9
3 7
6 5
6 10
5 5
3 10
1 7
9 2
8 5
4 2
3 2
5 10
10 3
1 9
5 7
6 9
9 6
5 8
7 3
1 4
9 8
7 7
2 7
10 4
9 4
1 3
6 6
4 3
3 6
1 6
9 5
3 8
7 5
8 8
7 10
5 6
1 8
6 7
9 9
7 2
7 1
4 8
8 6
8...

output:

2
7 9 7 9 LR
3 1 3 1 RL
6 2 5 1 LU
9 10 10 9 LD
8 7 8 5 LL
2 4 3 3 DL
5 9 4 8 UL
10 6 10 6 LR
3 9 1 9 UU
7 8 5 8 UU
4 4 3 5 RU
2 6 2 4 LL
5 4 4 3 LU
6 1 4 1 UU
8 9 6 9 UU
7 6 5 6 UU
10 8 8 8 UU
9 7 9 7 LR
1 10 2 9 DL
6 8 6 7 LS
3 4 3 2 LL
8 4 8 2 LL
1 2 1 2 RL
1 5 1 3 LL
7 4 8 3 LD
6 3 6 2 SL
2 5 2 ...

result:

ok answer 2

Test #124:

score: 0
Accepted
time: 26ms
memory: 6236kb

input:

80 1 100
1 41
1 75
1 13
1 62
1 25
1 89
1 45
1 40
1 10
1 81
1 100
1 26
1 97
1 30
1 42
1 96
1 19
1 80
1 38
1 61
1 11
1 68
1 44
1 84
1 98
1 49
1 20
1 83
1 27
1 37
1 93
1 52
1 23
1 14
1 86
1 67
1 43
1 99
1 56
1 53
1 88
1 28
1 87
1 95
1 74
1 50
1 79
1 64
1 18
1 54
1 12
1 36
1 94
1 31
1 82
1 63
1 91
1 51
...

output:

9
1 41 1 38 RLLRSLLLS
1 75 1 70 LLLLLLRRL
1 13 1 10 RRRLLLLLL
1 62 1 56 LLSLLLRLL
1 25 1 20 RLLLLLLRL
1 89 1 88 LLLLRRRLR
1 45 1 40 RLLRLLLLL
1 40 1 32 LLLLLLLLS
1 10 1 3 RLLLLLLLL
1 81 1 78 LLLLLLRRR
1 100 1 99 LLLLLRRRR
1 26 1 17 LLLLLLLLL
1 97 1 98 LLLLRRRRR
1 30 1 22 LLLLLLLLS
1 42 1 33 LLLLLLLL...

result:

ok answer 9

Test #125:

score: 0
Accepted
time: 18ms
memory: 5084kb

input:

80 2 50
1 34
2 37
2 2
2 19
1 37
2 3
2 31
1 45
2 44
1 22
1 44
2 17
2 6
2 21
2 29
2 36
1 48
1 30
1 13
1 43
1 18
1 50
1 23
2 8
1 2
1 28
2 15
1 20
2 23
1 11
1 8
2 48
1 31
1 17
1 21
1 9
1 35
1 16
2 47
2 12
2 42
2 11
2 26
2 49
2 18
2 9
1 33
2 35
2 30
2 40
1 49
2 38
1 42
1 41
1 25
2 50
2 24
1 5
2 28
2 20
1...

output:

2
1 34 2 35 RD
2 37 2 39 RR
2 2 2 2 RL
2 19 2 17 LL
1 37 2 36 DL
2 3 2 3 RL
2 31 2 33 RR
1 45 2 46 DR
2 44 2 44 LR
1 22 1 22 LR
1 44 2 45 RD
2 17 2 16 SL
2 6 2 5 SL
2 21 2 19 LL
2 29 2 31 RR
2 36 2 34 LL
1 48 1 48 LR
1 30 1 31 RS
1 13 2 14 RD
1 43 1 45 RR
1 18 1 18 LR
1 50 1 50 LR
1 23 1 23 LR
2 8 2...

result:

ok answer 2

Test #126:

score: 0
Accepted
time: 9ms
memory: 6252kb

input:

80 3 33
1 16
2 8
2 30
3 33
2 21
2 11
1 5
2 6
2 7
3 24
1 14
3 5
2 23
2 10
2 9
1 6
2 28
1 7
2 3
3 26
1 27
2 29
3 25
2 19
1 31
1 24
3 19
1 11
2 15
3 13
1 33
1 22
1 12
1 32
3 30
3 10
2 32
2 13
2 17
2 16
3 14
1 23
2 1
2 25
2 33
2 22
3 15
2 26
3 12
2 24
1 15
2 31
1 9
3 17
1 25
2 27
1 19
2 12
1 18
1 17
1 8...

output:

2
1 16 1 16 RL
2 8 2 6 LL
2 30 1 31 UR
3 33 3 31 LL
2 21 3 21 SD
2 11 2 10 LS
1 5 1 5 RL
2 6 2 4 LL
2 7 1 6 LU
3 24 2 23 LU
1 14 1 15 RS
3 5 3 5 RL
2 23 2 25 RR
2 10 3 9 LD
2 9 2 7 LL
1 6 1 4 LL
2 28 1 29 RU
1 7 1 7 RL
2 3 2 3 RL
3 26 3 26 RL
1 27 1 28 RS
2 29 2 30 RS
3 25 3 27 RR
2 19 3 18 LD
1 31 ...

result:

ok answer 2

Test #127:

score: 0
Accepted
time: 4ms
memory: 5912kb

input:

80 4 25
1 2
1 3
1 13
2 11
4 21
1 7
4 15
2 9
2 21
2 13
4 4
3 2
2 20
4 8
4 3
4 14
2 12
3 25
3 19
1 25
1 21
4 5
3 3
2 6
2 14
1 18
1 17
4 7
1 22
3 24
2 15
4 17
2 7
4 19
4 11
3 7
4 18
1 24
2 19
2 22
3 8
4 13
4 25
2 1
4 23
3 10
4 12
3 4
3 20
3 22
2 2
4 16
2 25
2 23
1 23
2 16
3 5
4 9
3 12
1 11
1 15
1 1
2 2...

output:

2
1 2 1 4 RR
1 3 1 3 RL
1 13 1 13 LR
2 11 1 10 LU
4 21 4 20 LS
1 7 1 7 RL
4 15 4 13 LL
2 9 2 9 LR
2 21 3 22 DR
2 13 2 12 LS
4 4 4 6 RR
3 2 3 2 RL
2 20 2 18 LL
4 8 3 7 UL
4 3 4 2 LS
4 14 4 12 LL
2 12 2 10 LL
3 25 3 25 LR
3 19 2 20 RU
1 25 1 25 LR
1 21 1 21 LR
4 5 4 3 LL
3 3 3 1 LL
2 6 2 6 RL
2 14 2 1...

result:

ok answer 2

Test #128:

score: 0
Accepted
time: 7ms
memory: 6260kb

input:

80 5 20
1 17
3 8
4 12
2 19
1 10
2 14
4 7
4 3
2 8
3 14
5 20
1 20
3 18
5 18
1 2
4 10
5 3
4 19
5 13
4 2
1 3
1 8
3 13
5 9
3 16
2 9
4 8
3 1
4 11
2 16
1 19
4 14
2 20
3 19
1 1
3 2
2 12
5 11
4 17
5 4
3 7
1 12
2 2
3 5
2 11
3 11
1 13
1 7
5 6
4 1
1 16
3 10
4 4
3 20
2 13
4 18
3 17
3 15
2 1
5 2
3 12
1 5
5 15
2 5...

output:

1
1 17 1 18 R
3 8 3 7 L
4 12 4 13 R
2 19 2 18 L
1 10 1 10 S
2 14 2 15 R
4 7 4 6 L
4 3 5 3 D
2 8 2 9 R
3 14 4 14 D
5 20 5 19 L
1 20 2 20 D
3 18 4 18 D
5 18 5 17 L
1 2 1 3 R
4 10 4 11 R
5 3 5 2 L
4 19 4 19 S
5 13 5 12 L
4 2 4 3 R
1 3 1 4 R
1 8 2 8 D
3 13 3 14 R
5 9 5 9 S
3 16 3 16 S
2 9 1 9 U
4 8 5 8 ...

result:

ok answer 1

Test #129:

score: 0
Accepted
time: 6ms
memory: 4460kb

input:

80 6 16
5 14
4 10
5 6
4 7
2 2
2 8
6 5
3 15
5 12
4 3
3 7
1 14
2 4
3 14
1 8
2 14
3 8
1 2
1 12
6 12
4 5
4 9
2 16
6 16
6 4
4 11
4 8
5 2
5 13
3 16
2 1
2 9
6 7
3 6
6 9
5 3
5 11
4 14
6 11
1 6
5 8
2 3
6 13
5 1
3 1
5 5
4 13
3 4
2 5
6 15
2 10
2 12
1 9
1 4
6 3
3 11
1 10
3 2
4 4
4 15
6 8
1 5
1 3
1 11
2 11
4 16
...

output:

1
5 14 5 15 R
4 10 4 11 R
5 6 4 6 U
4 7 3 7 U
2 2 2 3 R
2 8 2 7 L
6 5 5 5 U
3 15 3 14 L
5 12 6 12 D
4 3 4 2 L
3 7 3 6 L
1 14 1 15 R
2 4 2 5 R
3 14 3 13 L
1 8 1 7 L
2 14 1 14 U
3 8 2 8 U
1 2 1 3 R
1 12 1 11 L
6 12 6 13 R
4 5 4 4 L
4 9 3 9 U
2 16 2 15 L
6 16 6 15 L
6 4 6 4 S
4 11 4 12 R
4 8 3 8 U
5 2 ...

result:

ok answer 1

Test #130:

score: 0
Accepted
time: 6ms
memory: 4492kb

input:

80 7 14
7 13
3 14
4 1
4 9
2 8
3 10
7 7
6 8
6 12
5 3
2 1
4 5
7 8
3 1
7 3
4 12
4 14
6 14
7 1
1 3
2 5
1 8
5 2
2 11
7 10
5 12
3 3
3 8
2 10
3 13
4 3
7 2
2 12
1 7
1 2
6 13
3 11
3 4
2 9
4 8
1 1
2 14
3 2
4 11
1 12
3 6
6 1
6 5
4 4
3 5
1 9
5 6
1 10
7 9
1 6
7 4
2 6
7 11
5 7
1 11
5 10
6 6
4 10
5 4
7 5
2 4
1 13
...

output:

1
7 13 6 13 U
3 14 3 13 L
4 1 5 1 D
4 9 4 8 L
2 8 2 7 L
3 10 4 10 D
7 7 7 6 L
6 8 6 7 L
6 12 6 11 L
5 3 5 4 R
2 1 2 2 R
4 5 4 4 L
7 8 7 7 L
3 1 4 1 D
7 3 6 3 U
4 12 5 12 D
4 14 4 13 L
6 14 7 14 D
7 1 7 2 R
1 3 1 4 R
2 5 2 4 L
1 8 2 8 D
5 2 5 3 R
2 11 3 11 D
7 10 7 9 L
5 12 5 11 L
3 3 3 2 L
3 8 3 9 R...

result:

ok answer 1

Test #131:

score: 0
Accepted
time: 6ms
memory: 5876kb

input:

80 8 12
2 9
3 2
4 6
8 5
4 5
1 6
7 7
6 9
8 11
4 2
8 10
3 12
8 12
6 4
2 4
1 7
6 3
6 8
7 10
7 6
8 9
5 8
7 3
5 4
4 4
8 8
6 11
7 5
7 4
2 7
3 7
5 11
6 7
1 5
7 9
2 2
8 1
6 6
2 8
3 4
1 12
3 10
6 12
5 1
3 8
5 10
7 1
8 3
4 9
2 1
5 6
6 2
2 5
5 2
2 3
5 5
3 11
3 9
4 1
3 1
8 7
8 6
2 10
2 11
5 9
4 7
7 12
1 10
4 11...

output:

1
2 9 2 10 R
3 2 3 1 L
4 6 3 6 U
8 5 8 5 S
4 5 4 4 L
1 6 1 5 L
7 7 7 8 R
6 9 6 10 R
8 11 8 10 L
4 2 5 2 D
8 10 7 10 U
3 12 3 11 L
8 12 8 11 L
6 4 6 5 R
2 4 1 4 U
1 7 1 8 R
6 3 6 2 L
6 8 6 9 R
7 10 7 11 R
7 6 7 7 R
8 9 8 8 L
5 8 4 8 U
7 3 7 4 R
5 4 5 5 R
4 4 4 5 R
8 8 8 9 R
6 11 6 12 R
7 5 7 6 R
7 4 ...

result:

ok answer 1

Test #132:

score: 0
Accepted
time: 2ms
memory: 2552kb

input:

80 9 11
7 2
1 4
8 8
6 9
1 2
8 3
1 11
8 6
1 8
7 8
4 7
3 2
2 9
6 3
9 10
4 8
8 10
3 9
9 2
2 3
8 2
9 5
6 11
2 11
6 4
7 3
3 8
7 1
5 8
7 10
4 6
9 6
3 4
5 9
7 9
5 5
9 3
9 4
6 6
5 1
2 2
6 7
1 9
4 4
2 10
5 11
3 10
3 11
2 4
3 7
4 11
8 1
9 9
5 7
4 1
1 7
9 11
8 5
1 10
2 8
3 1
7 5
6 5
4 9
3 3
9 7
2 6
9 8
2 7
1 1...

output:

1
7 2 7 3 R
1 4 1 5 R
8 8 8 8 S
6 9 6 9 S
1 2 1 1 L
8 3 8 4 R
1 11 1 10 L
8 6 7 6 U
1 8 1 7 L
7 8 7 7 L
4 7 4 6 L
3 2 2 2 U
2 9 1 9 U
6 3 5 3 U
9 10 9 9 L
4 8 4 8 S
8 10 7 10 U
3 9 4 9 D
9 2 9 1 L
2 3 2 4 R
8 2 8 3 R
9 5 9 4 L
6 11 6 10 L
2 11 2 10 L
6 4 6 4 S
7 3 6 3 U
3 8 3 9 R
7 1 7 1 S
5 8 5 9 R...

result:

ok answer 1

Test #133:

score: 0
Accepted
time: 5ms
memory: 6252kb

input:

80 10 10
4 5
10 2
4 1
1 10
2 1
7 5
1 9
5 9
9 1
5 6
5 10
8 2
5 4
7 8
7 1
9 2
10 4
2 9
4 7
6 10
8 7
6 6
5 7
7 7
3 4
4 4
5 5
4 10
7 4
7 9
8 8
3 1
3 2
9 4
6 4
1 1
6 1
9 9
10 8
10 3
3 5
8 6
1 4
3 10
5 1
6 3
10 1
1 5
6 7
3 8
4 3
6 2
10 10
8 10
3 6
2 8
8 9
10 7
10 6
9 8
1 7
3 7
2 10
6 8
7 6
9 6
2 6
2 2
1 6...

output:

1
4 5 4 6 R
10 2 10 3 R
4 1 3 1 U
1 10 2 10 D
2 1 2 1 S
7 5 7 4 L
1 9 1 8 L
5 9 4 9 U
9 1 8 1 U
5 6 5 5 L
5 10 5 9 L
8 2 8 3 R
5 4 5 3 L
7 8 7 9 R
7 1 6 1 U
9 2 9 2 S
10 4 10 5 R
2 9 2 8 L
4 7 4 8 R
6 10 6 10 S
8 7 7 7 U
6 6 6 5 L
5 7 5 8 R
7 7 7 6 L
3 4 2 4 U
4 4 4 3 L
5 5 4 5 U
4 10 5 10 D
7 4 7 3...

result:

ok answer 1

Test #134:

score: 0
Accepted
time: 25ms
memory: 6316kb

input:

90 100 1
89 1
74 1
85 1
59 1
91 1
88 1
93 1
78 1
63 1
52 1
37 1
28 1
51 1
42 1
79 1
4 1
81 1
31 1
25 1
60 1
2 1
40 1
99 1
48 1
54 1
72 1
68 1
29 1
87 1
6 1
9 1
71 1
47 1
46 1
12 1
15 1
65 1
36 1
50 1
64 1
5 1
69 1
11 1
35 1
21 1
73 1
95 1
83 1
44 1
26 1
97 1
57 1
39 1
70 1
67 1
77 1
96 1
100 1
66 1
...

output:

4
89 1 89 1 UUDD
74 1 72 1 UUDU
85 1 85 1 UUDD
59 1 59 1 UUDD
91 1 91 1 UUDD
88 1 88 1 UUDD
93 1 96 1 SDDD
78 1 76 1 UUDU
63 1 63 1 UUDD
52 1 52 1 UUDD
37 1 33 1 UUUU
28 1 24 1 UUUU
51 1 51 1 DUUD
42 1 40 1 UUUD
79 1 79 1 UUDD
4 1 4 1 DDUU
81 1 81 1 UUDD
31 1 27 1 UUUU
25 1 25 1 DDUU
60 1 58 1 UUDU
...

result:

ok answer 4

Test #135:

score: 0
Accepted
time: 17ms
memory: 6052kb

input:

90 50 2
30 2
22 1
22 2
31 2
29 2
39 2
11 2
2 1
26 2
1 2
44 1
17 2
41 1
35 1
44 2
14 1
25 1
3 1
15 1
45 2
35 2
23 2
36 2
19 1
26 1
49 2
6 1
29 1
40 2
19 2
2 2
27 1
34 2
16 2
32 2
49 1
9 2
43 1
11 1
13 2
28 1
37 1
10 2
5 1
8 2
20 1
34 1
12 1
36 1
32 1
30 1
18 2
21 1
21 2
24 2
5 2
33 1
39 1
18 1
7 2
15...

output:

1
30 2 29 2 U
22 1 21 1 U
22 2 22 1 L
31 2 31 1 L
29 2 28 2 U
39 2 39 1 L
11 2 11 1 L
2 1 3 1 D
26 2 25 2 U
1 2 1 1 L
44 1 43 1 U
17 2 17 1 L
41 1 42 1 D
35 1 34 1 U
44 2 45 2 D
14 1 13 1 U
25 1 24 1 U
3 1 2 1 U
15 1 14 1 U
45 2 45 1 L
35 2 35 1 L
23 2 22 2 U
36 2 37 2 D
19 1 20 1 D
26 1 25 1 U
49 2...

result:

ok answer 1

Test #136:

score: 0
Accepted
time: 11ms
memory: 5680kb

input:

90 33 3
5 3
5 2
3 1
25 1
10 1
7 3
1 2
32 3
9 3
18 1
22 3
16 3
4 2
26 3
19 3
19 1
7 2
23 2
13 2
8 1
20 3
14 1
6 2
26 2
23 3
29 3
29 2
6 1
31 2
24 2
11 3
7 1
21 2
25 3
15 3
6 3
28 3
12 2
14 3
32 1
30 1
18 2
24 3
17 2
1 1
32 2
31 1
18 3
1 3
28 1
15 2
33 2
2 3
2 2
9 1
23 1
22 1
16 1
14 2
12 3
28 2
9 2
3...

output:

1
5 3 4 3 U
5 2 4 2 U
3 1 2 1 U
25 1 24 1 U
10 1 9 1 U
7 3 6 3 U
1 2 1 3 R
32 3 31 3 U
9 3 8 3 U
18 1 19 1 D
22 3 22 2 L
16 3 16 2 L
4 2 4 1 L
26 3 25 3 U
19 3 18 3 U
19 1 18 1 U
7 2 6 2 U
23 2 23 1 L
13 2 12 2 U
8 1 7 1 U
20 3 20 2 L
14 1 13 1 U
6 2 6 1 L
26 2 27 2 D
23 3 22 3 U
29 3 28 3 U
29 2 29...

result:

ok answer 1

Test #137:

score: 0
Accepted
time: 10ms
memory: 5832kb

input:

90 25 4
13 1
2 4
17 1
22 4
16 1
21 3
8 1
9 3
13 3
18 4
23 4
22 1
20 2
8 2
17 4
1 3
9 1
22 3
13 4
12 3
14 1
1 1
9 4
22 2
7 1
11 1
16 2
25 3
5 3
19 2
5 4
1 4
6 2
11 4
15 2
8 3
25 1
15 4
11 3
5 2
16 3
20 1
18 1
11 2
18 3
21 2
8 4
6 4
10 3
20 4
21 1
4 1
23 2
2 1
14 3
20 3
2 3
15 1
24 1
12 2
4 3
19 3
24 ...

output:

1
13 1 12 1 U
2 4 2 3 L
17 1 17 1 S
22 4 22 3 L
16 1 15 1 U
21 3 20 3 U
8 1 7 1 U
9 3 8 3 U
13 3 14 3 D
18 4 17 4 U
23 4 22 4 U
22 1 23 1 D
20 2 19 2 U
8 2 7 2 U
17 4 17 3 L
1 3 1 4 R
9 1 8 1 U
22 3 22 2 L
13 4 12 4 U
12 3 11 3 U
14 1 14 1 S
1 1 1 1 S
9 4 8 4 U
22 2 21 2 U
7 1 6 1 U
11 1 10 1 U
16 2...

result:

ok answer 1

Test #138:

score: 0
Accepted
time: 10ms
memory: 4580kb

input:

90 20 5
2 5
8 4
16 4
7 3
6 2
8 3
12 4
10 2
12 5
18 2
12 3
16 1
2 1
19 5
19 3
14 4
13 2
15 2
17 1
20 5
15 3
7 1
4 4
8 5
6 3
18 4
1 3
16 5
17 2
11 4
2 2
18 5
13 1
3 1
1 5
20 1
14 1
3 4
14 3
15 5
7 2
12 1
7 5
5 4
2 3
19 2
19 1
9 1
7 4
14 2
10 5
8 2
8 1
16 3
6 1
15 1
11 5
16 2
5 2
2 4
13 5
11 1
9 4
18 3...

output:

1
2 5 2 5 S
8 4 7 4 U
16 4 15 4 U
7 3 6 3 U
6 2 6 1 L
8 3 7 3 U
12 4 11 4 U
10 2 10 1 L
12 5 12 4 L
18 2 18 1 L
12 3 11 3 U
16 1 15 1 U
2 1 3 1 D
19 5 18 5 U
19 3 18 3 U
14 4 13 4 U
13 2 13 1 L
15 2 16 2 D
17 1 17 2 R
20 5 20 4 L
15 3 14 3 U
7 1 7 2 R
4 4 4 3 L
8 5 8 4 L
6 3 6 2 L
18 4 19 4 D
1 3 2 ...

result:

ok answer 1

Test #139:

score: 0
Accepted
time: 6ms
memory: 6252kb

input:

90 16 6
14 5
1 1
4 6
9 2
11 2
14 2
5 6
5 5
7 1
2 6
13 2
8 4
1 4
15 5
16 6
7 3
11 3
13 3
3 3
2 1
1 6
16 2
13 1
12 6
2 2
8 3
14 6
14 3
9 1
10 1
7 4
11 6
2 5
8 6
6 5
1 3
8 1
10 6
7 6
3 4
5 3
4 2
9 5
12 5
3 1
15 4
7 2
6 6
3 5
11 1
12 3
15 3
10 5
15 6
9 3
5 4
3 6
8 2
4 5
11 4
5 1
6 1
13 4
2 3
14 1
3 2
15...

output:

1
14 5 14 6 R
1 1 1 2 R
4 6 5 6 D
9 2 10 2 D
11 2 12 2 D
14 2 14 1 L
5 6 5 5 L
5 5 6 5 D
7 1 7 1 S
2 6 3 6 D
13 2 13 1 L
8 4 8 3 L
1 4 1 3 L
15 5 15 4 L
16 6 16 6 S
7 3 7 3 S
11 3 11 3 S
13 3 13 4 R
3 3 3 3 S
2 1 2 2 R
1 6 1 5 L
16 2 16 1 L
13 1 13 2 R
12 6 13 6 D
2 2 2 1 L
8 3 9 3 D
14 6 15 6 D
14 ...

result:

ok answer 1

Test #140:

score: 0
Accepted
time: 8ms
memory: 6028kb

input:

90 14 7
14 4
10 7
13 6
12 3
6 5
14 2
11 4
11 3
13 1
14 1
8 7
10 6
2 7
11 7
2 4
11 6
7 5
9 4
7 6
12 5
12 4
3 2
3 4
1 2
1 3
4 1
9 1
2 6
12 6
13 7
3 1
10 4
12 7
14 7
14 5
14 3
6 6
10 3
3 3
7 2
6 7
6 4
9 6
13 5
3 6
3 5
5 3
3 7
5 1
7 4
7 7
4 3
14 6
1 6
9 5
11 5
12 1
4 6
9 7
4 4
10 2
5 2
9 2
8 4
2 3
9 3
1...

output:

1
14 4 14 5 R
10 7 9 7 U
13 6 13 5 L
12 3 12 2 L
6 5 6 4 L
14 2 14 3 R
11 4 11 5 R
11 3 11 2 L
13 1 14 1 D
14 1 14 2 R
8 7 8 6 L
10 6 10 5 L
2 7 2 6 L
11 7 11 6 L
2 4 1 4 U
11 6 11 7 R
7 5 7 4 L
9 4 9 3 L
7 6 6 6 U
12 5 12 4 L
12 4 12 3 L
3 2 3 1 L
3 4 2 4 U
1 2 1 3 R
1 3 1 2 L
4 1 4 2 R
9 1 9 2 R
2...

result:

ok answer 1

Test #141:

score: 0
Accepted
time: 5ms
memory: 4532kb

input:

90 12 8
12 2
3 3
2 4
5 8
9 5
8 8
5 4
11 1
3 8
6 8
8 6
5 5
11 2
8 4
5 1
4 1
6 1
2 8
9 6
9 1
7 8
12 6
9 4
7 7
7 1
9 3
4 3
12 1
2 5
11 8
3 7
6 2
2 1
2 3
8 7
3 1
6 3
10 8
4 2
3 4
1 8
1 7
1 2
8 5
9 2
12 5
7 3
11 6
12 4
1 3
11 7
4 4
5 3
12 7
7 5
10 5
10 2
10 4
11 4
1 6
11 5
10 6
3 2
6 5
8 3
2 7
10 7
4 6
4...

output:

1
12 2 12 1 L
3 3 2 3 U
2 4 2 5 R
5 8 5 7 L
9 5 9 4 L
8 8 7 8 U
5 4 6 4 D
11 1 10 1 U
3 8 3 7 L
6 8 5 8 U
8 6 8 5 L
5 5 5 5 S
11 2 11 3 R
8 4 8 3 L
5 1 4 1 U
4 1 3 1 U
6 1 5 1 U
2 8 3 8 D
9 6 9 7 R
9 1 8 1 U
7 8 7 7 L
12 6 11 6 U
9 4 8 4 U
7 7 6 7 U
7 1 6 1 U
9 3 9 2 L
4 3 4 4 R
12 1 11 1 U
2 5 2 6 ...

result:

ok answer 1

Test #142:

score: 0
Accepted
time: 7ms
memory: 4532kb

input:

90 11 9
2 8
5 4
7 3
7 8
1 5
5 2
2 6
8 8
9 4
6 4
9 7
1 6
3 2
1 7
4 7
6 6
2 1
8 2
11 2
11 5
9 2
6 7
10 9
2 9
4 9
1 1
4 4
6 1
10 3
6 5
7 7
11 1
3 7
10 8
8 4
9 1
11 9
1 2
11 8
1 3
1 9
9 3
9 6
7 2
5 8
3 3
7 9
8 6
3 5
4 3
10 5
6 2
5 3
4 1
5 5
11 6
4 2
2 7
5 1
2 2
3 1
7 5
10 7
8 3
8 7
2 5
4 5
3 6
10 1
11 4...

output:

1
2 8 2 9 R
5 4 5 3 L
7 3 7 2 L
7 8 7 7 L
1 5 1 5 S
5 2 5 1 L
2 6 2 7 R
8 8 8 7 L
9 4 8 4 U
6 4 6 3 L
9 7 9 6 L
1 6 1 6 S
3 2 3 1 L
1 7 1 8 R
4 7 5 7 D
6 6 6 5 L
2 1 2 2 R
8 2 8 2 S
11 2 11 1 L
11 5 11 6 R
9 2 9 1 L
6 7 6 8 R
10 9 9 9 U
2 9 3 9 D
4 9 4 8 L
1 1 2 1 D
4 4 4 5 R
6 1 6 2 R
10 3 9 3 U
6 ...

result:

ok answer 1

Test #143:

score: 0
Accepted
time: 7ms
memory: 6056kb

input:

90 10 10
4 5
9 9
4 10
2 2
6 9
1 1
6 1
1 4
7 7
6 2
9 5
9 6
8 7
5 4
10 7
9 10
6 5
8 1
4 3
6 10
9 3
10 4
2 3
3 5
9 8
1 3
3 8
7 2
2 7
5 7
8 2
7 9
10 5
5 6
1 5
3 3
3 2
6 3
7 5
8 8
10 2
10 1
8 10
10 3
7 10
5 9
1 6
4 4
7 8
7 6
3 10
2 8
1 10
5 5
3 7
4 6
10 10
2 10
5 3
8 3
10 6
1 7
5 2
2 9
6 6
6 4
7 4
4 1
9 ...

output:

1
4 5 4 4 L
9 9 9 8 L
4 10 4 9 L
2 2 2 3 R
6 9 5 9 U
1 1 1 2 R
6 1 6 2 R
1 4 1 3 L
7 7 7 6 L
6 2 6 1 L
9 5 10 5 D
9 6 9 7 R
8 7 8 8 R
5 4 5 3 L
10 7 10 8 R
9 10 8 10 U
6 5 5 5 U
8 1 7 1 U
4 3 3 3 U
6 10 5 10 U
9 3 9 4 R
10 4 10 3 L
2 3 2 2 L
3 5 3 6 R
9 8 9 9 R
1 3 1 4 R
3 8 3 9 R
7 2 7 3 R
2 7 2 8 ...

result:

ok answer 1

Test #144:

score: 0
Accepted
time: 24ms
memory: 6076kb

input:

99 1 100
1 62
1 15
1 97
1 31
1 78
1 51
1 48
1 89
1 4
1 16
1 47
1 33
1 88
1 87
1 55
1 22
1 11
1 44
1 43
1 73
1 7
1 74
1 1
1 36
1 20
1 92
1 95
1 64
1 85
1 61
1 42
1 75
1 3
1 49
1 82
1 72
1 70
1 77
1 17
1 28
1 30
1 90
1 9
1 57
1 58
1 98
1 25
1 76
1 13
1 19
1 14
1 23
1 40
1 71
1 96
1 27
1 50
1 94
1 32
1...

output:

1
1 62 1 61 L
1 15 1 14 L
1 97 1 96 L
1 31 1 30 L
1 78 1 79 R
1 51 1 50 L
1 48 1 47 L
1 89 1 88 L
1 4 1 5 R
1 16 1 15 L
1 47 1 46 L
1 33 1 32 L
1 88 1 89 R
1 87 1 86 L
1 55 1 54 L
1 22 1 21 L
1 11 1 10 L
1 44 1 43 L
1 43 1 42 L
1 73 1 73 S
1 7 1 6 L
1 74 1 75 R
1 1 1 1 S
1 36 1 35 L
1 20 1 19 L
1 92...

result:

ok answer 1

Test #145:

score: 0
Accepted
time: 32ms
memory: 7256kb

input:

99 2 50
2 18
1 20
2 6
2 9
1 3
2 30
2 4
1 33
2 43
2 21
1 31
2 24
1 10
1 42
1 4
1 45
2 28
1 27
1 24
2 47
1 47
1 13
2 40
1 18
1 22
1 36
2 5
2 16
1 37
1 49
1 50
2 31
2 32
1 17
1 14
1 19
2 35
1 44
2 29
2 23
1 12
1 6
2 17
1 9
2 8
1 7
2 11
2 38
2 10
2 26
2 44
1 8
1 40
1 34
1 26
2 36
2 22
1 32
2 48
2 27
2 4...

output:

1
2 18 2 17 L
1 20 1 19 L
2 6 2 5 L
2 9 2 10 R
1 3 1 4 R
2 30 2 29 L
2 4 2 3 L
1 33 1 32 L
2 43 2 44 R
2 21 2 22 R
1 31 1 30 L
2 24 2 23 L
1 10 1 9 L
1 42 1 41 L
1 4 1 3 L
1 45 1 44 L
2 28 2 27 L
1 27 1 26 L
1 24 1 23 L
2 47 2 48 R
1 47 1 47 S
1 13 1 14 R
2 40 2 39 L
1 18 1 17 L
1 22 1 21 L
1 36 1 3...

result:

ok answer 1

Test #146:

score: 0
Accepted
time: 30ms
memory: 7432kb

input:

98 3 33
2 19
3 20
3 10
1 33
1 17
1 7
3 8
1 3
3 6
3 7
3 18
1 22
2 3
3 30
3 31
3 3
1 26
1 21
1 27
1 31
3 17
2 12
3 13
2 26
2 28
3 15
2 1
2 30
2 18
1 1
3 11
3 33
3 21
1 30
2 20
1 28
1 32
2 4
2 7
1 11
1 18
2 17
3 12
1 14
1 10
2 9
3 16
3 22
3 26
1 4
3 23
1 20
1 8
2 32
3 32
1 19
2 10
1 13
1 29
2 8
3 4
2 2...

output:

1
2 19 2 20 R
3 20 3 21 R
3 10 3 11 R
1 33 1 32 L
1 17 1 16 L
1 7 1 6 L
3 8 3 9 R
1 3 1 2 L
3 6 3 7 R
3 7 3 6 L
3 18 3 19 R
1 22 1 23 R
2 3 2 4 R
3 30 3 29 L
3 31 3 30 L
3 3 3 2 L
1 26 1 27 R
1 21 1 20 L
1 27 1 26 L
1 31 1 30 L
3 17 3 16 L
2 12 2 13 R
3 13 3 12 L
2 26 2 27 R
2 28 2 29 R
3 15 3 14 L
...

result:

ok answer 1

Test #147:

score: 0
Accepted
time: 26ms
memory: 7548kb

input:

99 4 25
1 25
3 11
1 2
4 1
4 19
3 5
4 5
1 12
2 1
3 4
1 23
2 18
4 15
4 13
4 11
2 23
3 1
2 7
4 6
4 20
2 16
1 17
2 10
4 18
3 3
2 22
2 6
3 8
1 19
4 12
3 20
4 2
1 21
3 17
4 16
3 16
4 23
3 15
3 12
1 18
4 10
3 9
1 15
3 21
1 6
3 18
1 20
1 13
4 17
3 2
2 19
2 4
1 4
3 14
3 25
3 19
4 8
4 9
1 11
4 3
3 7
4 4
2 14
...

output:

1
1 25 1 24 L
3 11 3 12 R
1 2 1 3 R
4 1 3 1 U
4 19 4 18 L
3 5 3 6 R
4 5 4 4 L
1 12 1 13 R
2 1 1 1 U
3 4 3 5 R
1 23 1 22 L
2 18 2 17 L
4 15 4 14 L
4 13 4 12 L
4 11 4 10 L
2 23 2 22 L
3 1 3 2 R
2 7 2 6 L
4 6 4 5 L
4 20 4 19 L
2 16 2 15 L
1 17 1 16 L
2 10 2 9 L
4 18 4 17 L
3 3 3 4 R
2 22 2 21 L
2 6 2 5...

result:

ok answer 1

Test #148:

score: 0
Accepted
time: 12ms
memory: 2600kb

input:

99 5 20
4 11
2 13
1 20
2 18
2 6
2 17
4 12
4 1
5 6
2 4
4 4
1 9
5 18
2 8
5 19
5 3
4 15
1 4
1 13
5 17
4 19
3 19
5 4
4 10
3 15
1 3
3 3
5 14
3 17
2 10
4 13
3 13
5 11
4 3
1 11
4 14
1 10
4 9
3 9
4 18
4 7
3 18
5 8
3 10
3 6
5 16
4 8
1 7
5 7
3 20
5 13
2 3
5 15
2 7
3 11
4 20
1 17
3 16
3 8
1 14
4 16
1 15
3 5
2 ...

output:

1
4 11 4 10 L
2 13 2 14 R
1 20 1 19 L
2 18 2 17 L
2 6 2 7 R
2 17 2 18 R
4 12 4 13 R
4 1 3 1 U
5 6 5 5 L
2 4 2 5 R
4 4 4 5 R
1 9 1 10 R
5 18 5 17 L
2 8 2 9 R
5 19 5 18 L
5 3 5 2 L
4 15 4 14 L
1 4 1 3 L
1 13 1 14 R
5 17 5 16 L
4 19 4 18 L
3 19 2 19 U
5 4 5 3 L
4 10 4 11 R
3 15 3 16 R
1 3 1 4 R
3 3 3 4...

result:

ok answer 1

Test #149:

score: 0
Accepted
time: 10ms
memory: 4500kb

input:

95 6 16
2 8
1 4
6 7
1 10
5 3
5 13
2 15
6 12
4 12
1 13
2 6
4 2
2 2
4 6
2 10
2 11
5 2
5 14
3 14
3 9
5 8
6 1
1 12
1 11
6 13
6 5
4 9
5 10
6 2
5 4
1 3
3 10
4 3
5 9
4 4
1 9
6 10
1 1
1 7
3 15
4 14
3 3
3 2
2 5
2 3
3 11
2 1
4 8
5 5
4 16
6 6
1 8
4 5
6 14
1 2
3 7
4 13
3 12
1 5
1 6
6 8
2 13
3 8
3 16
2 16
2 4
5 ...

output:

1
2 8 2 9 R
1 4 1 5 R
6 7 6 6 L
1 10 1 11 R
5 3 5 4 R
5 13 5 12 L
2 15 2 14 L
6 12 6 11 L
4 12 4 13 R
1 13 1 14 R
2 6 2 7 R
4 2 4 1 L
2 2 2 3 R
4 6 4 5 L
2 10 2 11 R
2 11 2 10 L
5 2 5 3 R
5 14 5 13 L
3 14 3 13 L
3 9 3 8 L
5 8 6 8 D
6 1 5 1 U
1 12 1 13 R
1 11 1 12 R
6 13 6 14 R
6 5 6 4 L
4 9 4 9 S
5 ...

result:

ok answer 1

Test #150:

score: 0
Accepted
time: 7ms
memory: 5936kb

input:

97 7 14
7 1
6 6
1 7
3 8
5 1
6 1
6 5
4 1
1 5
4 3
3 7
3 9
4 11
6 4
1 6
6 13
7 5
6 14
4 14
6 12
2 1
7 7
5 6
5 5
6 10
4 7
5 2
6 2
4 5
4 6
7 6
3 10
1 13
7 3
3 13
7 12
7 2
1 11
4 8
4 9
7 4
3 14
5 3
7 13
6 11
3 11
1 3
1 12
4 2
6 9
2 2
2 4
7 8
2 11
3 1
1 8
1 10
3 3
4 12
5 8
4 4
1 14
3 5
1 1
4 13
3 4
2 3
1 2...

output:

1
7 1 7 2 R
6 6 6 5 L
1 7 1 8 R
3 8 3 9 R
5 1 5 2 R
6 1 5 1 U
6 5 6 4 L
4 1 4 1 S
1 5 1 6 R
4 3 4 2 L
3 7 3 6 L
3 9 3 8 L
4 11 4 10 L
6 4 6 3 L
1 6 1 7 R
6 13 6 12 L
7 5 7 6 R
6 14 6 13 L
4 14 4 13 L
6 12 6 11 L
2 1 1 1 U
7 7 7 8 R
5 6 5 7 R
5 5 5 6 R
6 10 6 9 L
4 7 4 6 L
5 2 5 3 R
6 2 6 1 L
4 5 4 4...

result:

ok answer 1

Test #151:

score: 0
Accepted
time: 9ms
memory: 5668kb

input:

95 8 12
3 4
7 8
6 7
2 7
7 10
3 12
8 10
4 1
8 1
5 10
7 9
2 12
3 11
6 12
5 3
5 8
8 9
7 4
6 8
1 12
7 6
4 2
6 5
4 10
5 5
1 1
2 5
1 2
6 4
8 6
5 2
6 2
1 10
2 1
6 10
4 7
6 3
8 3
8 7
4 8
4 12
1 3
3 1
4 5
3 5
8 4
4 9
4 4
8 2
2 10
1 8
8 5
3 2
8 11
7 2
5 6
2 3
1 9
3 6
4 3
2 11
6 1
2 6
7 11
1 6
3 7
4 6
3 10
7 5...

output:

1
3 4 3 3 L
7 8 7 7 L
6 7 6 8 R
2 7 2 8 R
7 10 7 11 R
3 12 3 11 L
8 10 8 9 L
4 1 4 2 R
8 1 8 2 R
5 10 5 9 L
7 9 7 8 L
2 12 2 11 L
3 11 3 12 R
6 12 6 11 L
5 3 5 4 R
5 8 5 7 L
8 9 7 9 U
7 4 7 3 L
6 8 6 7 L
1 12 1 11 L
7 6 7 5 L
4 2 4 3 R
6 5 6 6 R
4 10 3 10 U
5 5 5 6 R
1 1 1 2 R
2 5 2 6 R
1 2 1 1 L
6 ...

result:

ok answer 1

Test #152:

score: 0
Accepted
time: 10ms
memory: 4576kb

input:

98 9 11
6 3
1 1
9 4
7 10
9 6
4 9
6 10
9 8
4 7
9 2
1 5
3 10
8 2
6 4
9 10
1 4
5 7
8 9
5 4
5 11
5 6
2 1
6 5
6 8
1 3
1 7
4 11
3 9
8 5
9 11
4 10
3 2
9 7
1 2
6 7
2 5
2 6
5 9
5 1
1 10
6 1
2 7
9 5
6 6
8 8
9 1
2 11
7 3
2 8
3 5
8 3
8 6
1 8
4 5
8 7
3 6
7 5
3 1
5 5
2 2
1 6
7 2
4 4
5 10
1 9
8 1
5 3
5 2
3 8
4 1
4...

output:

1
6 3 6 4 R
1 1 1 2 R
9 4 9 3 L
7 10 7 9 L
9 6 9 5 L
4 9 5 9 D
6 10 6 9 L
9 8 9 7 L
4 7 4 6 L
9 2 9 1 L
1 5 1 6 R
3 10 2 10 U
8 2 8 3 R
6 4 6 3 L
9 10 9 9 L
1 4 1 5 R
5 7 5 8 R
8 9 8 10 R
5 4 5 3 L
5 11 5 10 L
5 6 5 5 L
2 1 1 1 U
6 5 6 6 R
6 8 6 7 L
1 3 1 4 R
1 7 1 8 R
4 11 4 10 L
3 9 3 8 L
8 5 8 6 ...

result:

ok answer 1

Test #153:

score: 0
Accepted
time: 11ms
memory: 4576kb

input:

99 10 10
9 10
9 2
6 5
7 2
10 7
5 5
1 9
5 10
1 7
1 10
7 6
9 8
10 10
2 2
7 9
5 4
3 4
5 9
9 9
5 3
10 2
3 3
8 7
6 3
6 10
10 9
10 5
7 4
7 5
5 1
1 2
3 2
2 6
2 3
6 8
3 5
8 1
8 4
4 9
2 5
2 10
2 8
3 6
9 7
1 8
6 4
4 10
6 2
5 6
7 3
9 3
2 7
1 6
8 5
3 7
9 5
9 1
6 1
7 7
4 5
3 10
1 4
5 2
10 8
3 8
7 8
4 6
4 2
8 10
...

output:

1
9 10 9 9 L
9 2 9 3 R
6 5 6 6 R
7 2 7 1 L
10 7 10 6 L
5 5 5 4 L
1 9 2 9 D
5 10 6 10 D
1 7 1 8 R
1 10 1 9 L
7 6 7 5 L
9 8 10 8 D
10 10 9 10 U
2 2 2 1 L
7 9 7 8 L
5 4 5 3 L
3 4 3 5 R
5 9 5 8 L
9 9 9 8 L
5 3 5 2 L
10 2 10 3 R
3 3 3 4 R
8 7 8 8 R
6 3 6 4 R
6 10 6 9 L
10 9 10 10 R
10 5 10 4 L
7 4 7 3 L
...

result:

ok answer 1