QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#771853#6615. Cross the Mazeucup-team3161#AC ✓4ms50772kbC++174.2kb2024-11-22 16:01:512024-11-22 16:01:51

Judging History

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

  • [2024-11-22 16:01:51]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:50772kb
  • [2024-11-22 16:01:51]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;

const int maxn = 4000005;
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mkp make_pair

int n,m,k;
int sx[maxn],sy[maxn],tx[maxn],ty[maxn];

namespace F{
    int n,s,t;
    struct edge{
        int to,nxt,w;
    }e[maxn<<1];
    int tot=1,head[maxn],dep[maxn],cur[maxn];
    void adde(int u,int v,int w){
        e[++tot]=(edge){v,head[u],w};
        head[u]=tot;
    }
    void add(int u,int v,int w){
        adde(u,v,w),adde(v,u,0);
    }
    int q[maxn],hd,tl;
    bool bfs(int s,int t){
        For(i,0,n)cur[i]=head[i],dep[i]=inf;
        dep[s]=0; q[tl=1]=s;
        For(_,1,tl){
            int u=q[_];
            for(int i=head[u];i;i=e[i].nxt){
                int v=e[i].to;
                if(dep[v]==inf && e[i].w){
                    dep[v]=dep[u]+1;
                    if(v==t)return 1;
                    q[++tl]=v;
                }
            }
        }
        return dep[t]<inf;
    }
    int dfs(int u,int t,int mn){
        if(!mn||u==t)return mn;
        int res=0;
        for(int i=cur[u];i;i=e[i].nxt){
            int v=e[i].to;
            cur[u]=i;
            if(dep[v]!=dep[u]-1)continue;
            int fl=dfs(v,t,min(mn,e[i^1].w));
            if(!fl) continue;
            res+=fl,mn-=fl;
            e[i^1].w-=fl,e[i].w+=fl;
            if(!mn) break;
        }
        if(!res) dep[u]=-1;
        return res;
    }
    int dinic(int s,int t){
        int mxf=0,fl=0;
        while(bfs(s,t)){
            int fl=dfs(t,s,inf);
            mxf+=fl;
            if(!fl)exit(233);
        }
        return mxf;
    }
    void init(int nn,int ss,int tt){
        n=nn,s=ss,t=tt;
    }
}

string opt="DRULS";
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};

int eid[305][105][105][5],id[305][105][105][2],idx,gos[105];

int main(){
    cin>>k>>n>>m;
    For(i,1,k)cin>>sx[i]>>sy[i];
    For(i,1,k)cin>>tx[i]>>ty[i];
    int s=0,t=1; idx=1; F::tot=1;
    For(i,1,n) For(j,1,m) id[0][i][j][1]=++idx;

    int L=idx+1;
    For(i,1,k) gos[i]=++idx;
    int R=idx;

    For(i,1,k) F::add(gos[i],t,1);
    For(i,1,k) F::add(s,id[0][sx[i]][sy[i]][1],1);
    int res=0;
    for(int tim=1; ;++tim){
        //cout<<"tim "<<tim<<"\n";
        For(i,1,n)
            For(j,1,m){
                For(o,0,1) id[tim][i][j][o]=++idx;
                F::add(id[tim][i][j][0],id[tim][i][j][1],1);
            }
        For(i,1,n)
            For(j,1,m){
                For(d,0,4){
                    int x=i+dx[d],y=j+dy[d];
                    if(x>=1 && y>=1 && x<=n && y<=m){
                        F::add(id[tim-1][i][j][1],id[tim][x][y][0],inf);
                        eid[tim][i][j][d]=F::tot;
                    }
                }
            }
        For(i,1,k){
            F::add(id[tim][tx[i]][ty[i]][1],gos[i],1);
        }
        F::init(idx,s,t);
        res+=F::dinic(s,t);
       // cout<<"res "<<res<<"\n";
        if(res==k){
            cout<<tim<<"\n";
            For(i,1,k){
                string ans;
                int x=sx[i],y=sy[i];

                For(j,1,tim){
                    For(d,0,4) {
                        int id=eid[j][x][y][d];
                        if(F::e[id].w) {
                            x+=dx[d],y+=dy[d];
                            ans+=opt[d];
                            break;
                        }
                    }
                    //cout<<"ti,x,y "<<j<<" "<<x<<" "<<y<<"\n";
                    int u=id[j][x][y][1];
                    bool ok=0;
                    for(int p=F::head[u]; p; p=F::e[p].nxt)
                        if((F::e[p].to>=L&&F::e[p].to<=R) && F::e[p].w==0) {
                            For(_,j+1,tim) ans+='P';
                            ok=1;
                            cout<<sx[i]<<" "<<sy[i]<<" "<<x<<" "<<y<<" "<<ans<<endl;
                            break;
                        }
                    if(ok)break;
                }
            }
            exit(0);
        }
    }
    return 0;
}
/*
1 2 2
1 1
2 2
*/

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3ms
memory: 22044kb

input:

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

output:

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

result:

ok answer 1

Test #3:

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

input:

2 3 3
1 1
1 3
1 2
2 2

output:

2
1 1 2 2 DR
1 3 1 2 LP

result:

ok answer 2

Test #4:

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

input:

2 10 10
2 9
3 8
10 5
10 10

output:

10
2 9 10 10 DDDDDDDDRP
3 8 10 5 DDDDDDDLLL

result:

ok answer 10

Test #5:

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

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 2 9 UUPPP
4 2 6 3 DDRPP
3 6 6 8 DDDRR
10 1 5 1 UUUUU
10 10 5 10 UUUUU
4 1 3 2 RRULP

result:

ok answer 5

Test #6:

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

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 4 1 UPPP
6 8 5 8 UPPP
6 3 7 3 DPPP
6 4 7 6 DRRP
3 10 3 8 LLPP
9 5 9 4 LPPP
6 7 8 6 DLDP
4 1 1 2 RUUU

result:

ok answer 4

Test #7:

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

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: 0ms
memory: 26280kb

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: 3ms
memory: 24116kb

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 2 10 UUUURRU
4 6 3 7 RUPPPPP
10 9 10 2 LLLLLLL
4 7 3 10 URRRPPP
4 3 6 1 DDLLPPP
10 6 6 4 LLUUUUP
3 3 3 8 DRRRRRU
2 7 1 9 RRUPPPP

result:

ok answer 7

Test #10:

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

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: 22340kb

input:

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

output:

5
7 8 7 10 LRRRP
4 4 6 7 DDRRR
3 1 2 4 RRRUP

result:

ok answer 5

Test #12:

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

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 LULUU
1 7 2 8 DRPPP
2 1 1 1 UPPPP
5 6 5 3 LLLPP
10 8 7 8 UUUPP
3 5 2 2 LLLUP
9 9 6 9 UUUPP
9 2 9 4 RRPPP
4 9 4 8 LPPPP

result:

ok answer 5

Test #13:

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

input:

2 10 10
9 8
3 3
5 8
4 9

output:

7
9 8 5 8 UUUUPPP
3 3 4 9 DRRRRRR

result:

ok answer 7

Test #14:

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

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 LRPP
8 4 10 4 DDPP
2 8 5 9 DRDD
2 4 4 2 DDLL
10 8 8 10 RRUU
6 6 8 6 DDPP
1 7 3 9 DDRR
10 1 10 2 RPPP

result:

ok answer 4

Test #15:

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

input:

1 10 10
1 9
2 10

output:

2
1 9 2 10 DR

result:

ok answer 2

Test #16:

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

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 DDDLPP
3 8 3 6 LLPPPP
2 8 4 10 DDRRPP
3 5 6 5 DDDPPP
4 2 10 2 DDDDDD
8 2 10 6 DDRRRR
7 9 9 6 DDLLLP
3 4 5 5 DDRPPP

result:

ok answer 6

Test #17:

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

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: 3ms
memory: 22108kb

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 UUUUP
4 4 4 2 LLPPP
9 10 10 8 DLLPP
5 7 1 6 LUUUU
10 7 5 7 UUUUU
4 1 3 1 UPPPP
1 5 1 9 RRRRP
6 7 2 6 ULUUU
6 4 8 3 DDLPP
5 3 5 1 LLPPP

result:

ok answer 5

Test #19:

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

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 3 DDLLPP
1 5 2 7 DRRPPP
6 5 6 2 LLLPPP
9 6 10 6 DPPPPP
5 5 5 1 LLLLPP
9 3 8 1 LLUPPP
1 10 7 10 DDDDDD

result:

ok answer 6

Test #20:

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

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 4 10 RRRUUUUU
4 1 3 1 UPPPPPPP
9 1 4 1 UUUUUPPP
7 9 2 10 RUUUUUPP
2 6 1 7 RUPPPPPP
9 5 5 1 LLLLUUUU

result:

ok answer 8

Test #21:

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

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 7 8 RPPPP
8 6 8 7 RPPPP
10 3 10 2 LPPPP
6 2 6 1 LPPPP
10 8 8 9 RUUPP
1 10 3 9 DDLPP
9 5 6 4 LUUUP
1 2 3 5 DDRRR
8 3 4 3 UUUUP
10 9 8 10 UURPP

result:

ok answer 5

Test #22:

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

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 RUPPPPPP
1 2 4 2 DDDPPPPP
3 9 2 9 UPPPPPPP
6 9 6 10 RPPPPPPP
3 3 10 2 DDDDDDDL
9 2 9 1 LPPPPPPP
2 4 2 5 RPPPPPPP
5 8 7 3 SDDLLLLL
1 6 3 6 DDPPPPPP
4 9 5 8 DLPPPPPP

result:

ok answer 8

Test #23:

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

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 9 7 RUPP
9 2 9 1 LPPP
7 7 7 6 SLPP
7 3 5 1 LLUU
6 8 7 7 DLPP
5 4 3 2 LLUU
2 10 6 10 DDDD
1 1 3 1 DDPP
5 9 9 9 DDDD
4 6 4 8 RRPP

result:

ok answer 4

Test #24:

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

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 RRRRRRRPPPPPP
1 49 1 55 RRRRRRPPPPPPP
1 12 1 17 RRRRRPPPPPPPP
1 37 1 28 LLLLLLLLLPPPP
1 83 1 81 LLPPPPPPPPPPP
1 44 1 47 RRRPPPPPPPPPP
1 75 1 75 SPPPPPPPPPPPP
1 78 1 68 LLLLLLLLLLPPP
1 72 1 59 LLLLLLLLLLLLL
1 3 1 6 RRRPPPPPPPPPP

result:

ok answer 13

Test #25:

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

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 68 RRRRRRRRRRRRRRRRRRRRRRRRR
1 75 1 70 LLLLLPPPPPPPPPPPPPPPPPPPP
1 59 1 67 LRRRRRRRRRPPPPPPPPPPPPPPP
1 42 1 66 RRRRRRRRRRRRRRRRRRRRRRRRP
1 26 1 28 RRPPPPPPPPPPPPPPPPPPPPPPP
1 33 1 58 RRRRRRRRRRRRRRRRRRRRRRRRR
1 88 1 74 LLLLLLLLLLLLLLPPPPPPPPPPP
1 7 1 31 RRRRRRRRRRRRRRRRRRRRRRRRP
1 24 1 39 ...

result:

ok answer 25

Test #26:

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

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 82 LLLLLLPPPPPPPPPPPPPPPPP
1 38 1 15 LLLLLLLLLLLLLLLLLLLLLLL
1 43 1 57 RRRRRRRRRRRRRRPPPPPPPPP
1 99 1 97 LLPPPPPPPPPPPPPPPPPPPPP
1 63 1 74 RRRRRRRRRRRPPPPPPPPPPPP
1 24 1 6 LLLLLLLLLLLLLLLLLLPPPPP
1 44 1 51 RRRRRRRPPPPPPPPPPPPPPPP
1 31 1 14 LLLLLLLLLLLLLLLLLPPPPPP
1 47 1 55 RRRRRRRRPPPPPPPP...

result:

ok answer 23

Test #27:

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

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 8 1 DDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
96 1 68 1 UUUUUUUUUUUUUUUUUUUUUUUUUUUUPPPPPPP
41 1 33 1 SUUUUUUUUPPPPPPPPPPPPPPPPPPPPPPPPPP
76 1 41 1 UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
97 1 77 1 UUUUUUUUUUUUUUUUUUUUPPPPPPPPPPPPPPP
72 1 39 1 UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUPP
94 1 84 1 UUUUUUUUUUPPP...

result:

ok answer 35

Test #28:

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

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 18 1 UPPPPPPPPPPPPPPPPPPPPPPPPPPP
23 1 40 1 DDDDDDDDDDDDDDDDDPPPPPPPPPPP
29 1 41 1 DDDDDDDDDDDDPPPPPPPPPPPPPPPP
11 1 8 1 UUUPPPPPPPPPPPPPPPPPPPPPPPPP
44 1 69 1 DDDDDDDDDDDDDDDDDDDDDDDDDPPP
87 1 90 1 DDDPPPPPPPPPPPPPPPPPPPPPPPPP
68 1 81 1 DDDDDDDDDDDDDPPPPPPPPPPPPPPP
56 1 82 1 DDDDDDDDDDDDDDD...

result:

ok answer 28

Test #29:

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

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 72 1 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPPP
4 1 17 1 DDDDDDDDDDDDDPPPPPPPPPPPPPPPPPPPPP
64 1 70 1 DDDDDDPPPPPPPPPPPPPPPPPPPPPPPPPPPP
31 1 51 1 DDDDDDDDDDDDDDDDDDDDPPPPPPPPPPPPPP
92 1 88 1 UUUUPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
45 1 57 1 DDDDDDDDDDDDPPPPPPPPPPPPPPPPPPPPPP
60 1 87 1 UUUDDDDDDDDDDDDDDD...

result:

ok answer 34

Test #30:

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

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: 21980kb

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: 50772kb

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: 3ms
memory: 22032kb

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: 0ms
memory: 24104kb

input:

2 1 100
1 23
1 54
1 67
1 26

output:

13
1 23 1 26 RRRPPPPPPPPPP
1 54 1 67 RRRRRRRRRRRRR

result:

ok answer 13

Test #35:

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

input:

2 2 50
1 21
1 41
2 36
1 11

output:

10
1 21 1 11 LLLLLLLLLL
1 41 2 36 DLLLLLPPPP

result:

ok answer 10

Test #36:

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

input:

2 3 33
3 17
2 13
1 23
1 24

output:

11
3 17 1 24 RRRRRRUURPP
2 13 1 23 RRRRRRRRRRU

result:

ok answer 11

Test #37:

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

input:

2 4 25
3 15
2 22
1 22
1 11

output:

6
3 15 1 11 LLLLUU
2 22 1 22 UPPPPP

result:

ok answer 6

Test #38:

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

input:

2 5 20
2 18
5 2
5 7
3 8

output:

11
2 18 3 8 DLLLLLLLLLL
5 2 5 7 RRRRRPPPPPP

result:

ok answer 11

Test #39:

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

input:

2 6 16
5 12
6 4
1 11
5 15

output:

12
5 12 5 15 RRRPPPPPPPPP
6 4 1 11 RRRRRRRUUUUU

result:

ok answer 12

Test #40:

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

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: 0ms
memory: 26392kb

input:

2 8 12
8 4
1 4
5 12
2 6

output:

11
8 4 5 12 RRRRRRRRUUU
1 4 2 6 DRRPPPPPPPP

result:

ok answer 11

Test #42:

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

input:

2 9 11
1 7
3 4
4 3
7 6

output:

7
1 7 7 6 DDDDDDL
3 4 4 3 DLPPPPP

result:

ok answer 7

Test #43:

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

input:

2 10 10
4 5
10 7
4 2
2 10

output:

11
4 5 4 2 LLLPPPPPPPP
10 7 2 10 RRRUUUUUUUU

result:

ok answer 11

Test #44:

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

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 92 1 UUPPPPPPPPP
75 1 86 1 DDDDDDDDDDD
91 1 89 1 UUPPPPPPPPP
13 1 19 1 DDDDDDPPPPP
65 1 76 1 DDDDDDDDDDD

result:

ok answer 11

Test #45:

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

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 RUPPPPPPPP
12 2 6 1 UUULUUUPPP
39 1 41 2 DDRPPPPPPP
36 1 34 2 RUUPPPPPPP
19 2 9 2 UUUUUUUUUU

result:

ok answer 10

Test #46:

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

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 LUPP
4 1 4 1 SPPP
23 1 20 2 RUUU
23 3 21 3 UUPP
27 1 28 1 DPPP

result:

ok answer 4

Test #47:

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

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 23 4 RPPPPP
22 3 19 3 UUUPPP
9 4 9 2 LLPPPP
18 3 13 2 LUUUUU
1 3 7 3 DDDDDD

result:

ok answer 6

Test #48:

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

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 LLLUUUPPP
15 3 20 2 DDDDDLPPP
16 5 15 5 UPPPPPPPP
12 2 3 2 UUUUUUUUU
15 2 19 1 DDDDLPPPP

result:

ok answer 9

Test #49:

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

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 2 3 RUUUUUUUUUUU
5 2 1 2 UUUUPPPPPPPP
2 6 1 4 LLUPPPPPPPPP
16 2 14 2 UUPPPPPPPPPP
3 4 3 4 SPPPPPPPPPPP

result:

ok answer 12

Test #50:

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

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 SPPP
3 4 2 7 RURR
13 7 12 7 UPPP

result:

ok answer 4

Test #51:

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

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 LLLUUPP
11 8 5 8 UUUUUUP
1 7 2 1 DLLLLLL
4 8 7 6 DDDLLPP
11 4 6 3 ULUUUUP

result:

ok answer 7

Test #52:

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

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 DRRPP
1 1 1 4 RRRPP
10 6 6 7 RUUUU
1 4 2 6 DRRPP
10 4 7 3 LUUUP

result:

ok answer 5

Test #53:

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

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 RRRPPPP
1 3 1 10 RRRRRRR
9 9 10 6 DLLLPPP
7 4 9 5 DDRPPPP
6 5 6 5 SPPPPPP

result:

ok answer 7

Test #54:

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

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 RRRPPPPPPPPPPPPPPPP
1 86 1 98 RRRRRRRRRRRRPPPPPPP
1 24 1 5 LLLLLLLLLLLLLLLLLLL
1 75 1 62 RLLLLLLLLLLLLLLPPPP
1 82 1 77 LLLLLPPPPPPPPPPPPPP
1 55 1 42 LLLLLLLLLLLLLPPPPPP
1 84 1 73 LLLLLLLLLLLPPPPPPPP
1 26 1 14 RRRLLLLLLLLLLLLLLLP
1 40 1 38 LLLLLLLRRRRRPPPPPPP

result:

ok answer 19

Test #55:

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

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 LLLLLPPPPPPPPPP
1 48 2 48 DPPPPPPPPPPPPPP
1 33 2 29 LDLLLPPPPPPPPPP
1 22 1 23 RPPPPPPPPPPPPPP
1 10 2 17 DRRRRRRRPPPPPPP
2 5 1 6 RUPPPPPPPPPPPPP
1 49 1 48 LPPPPPPPPPPPPPP
1 11 1 12 RPPPPPPPPPPPPPP
2 11 2 23 RRRRRRRRRRRRPPP
1 47 1 32 LLLLLLLLLLLLLLL

result:

ok answer 15

Test #56:

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

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 1 18 RRPPPPPPP
1 4 2 2 DLLPPPPPP
1 30 3 31 DDRPPPPPP
2 8 2 6 LLPPPPPPP
1 8 3 9 DDRPPPPPP
2 16 2 11 LLLLLPPPP
3 33 3 33 SPPPPPPPP
2 12 3 10 LLDPPPPPP
2 20 3 28 DRRRRRRRR
1 15 2 10 LLLLLDPPP

result:

ok answer 9

Test #57:

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

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 RRPPPP
2 1 3 3 DRRPPP
1 6 2 6 DPPPPP
2 2 2 4 RRPPPP
2 15 2 13 LLPPPP
3 12 3 7 LLLLLP
3 19 1 22 RRRUUP
4 18 2 18 UUPPPP
4 23 1 24 RUUUPP
4 10 4 4 LLLLLL

result:

ok answer 6

Test #58:

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

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 7 RRRPPP
2 18 1 20 RRUPPP
4 11 1 9 UULLUP
3 16 2 11 LLLLLU
5 13 5 8 LLLLLP
5 20 3 17 LLLUUP
1 7 2 6 DLPPPP
5 4 4 2 LLUPPP
3 14 1 12 LLUUPP
2 1 3 1 DPPPPP

result:

ok answer 6

Test #59:

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

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 LUUPPPP
6 10 6 3 LLLLLLL
4 13 2 14 RUUPPPP
5 10 2 9 LUUUPPP
2 7 2 4 LLLPPPP
2 16 2 16 SPPPPPP
1 11 2 11 DPPPPPP
5 9 4 6 ULLLPPP
2 1 4 2 RDDPPPP
1 1 2 2 DRPPPPP

result:

ok answer 7

Test #60:

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

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 RPP
4 10 3 9 LUP
4 8 3 7 LUP
6 12 6 11 LPP
2 13 3 12 DLP
1 5 2 4 DLP
4 1 7 1 DDD
2 9 2 7 LLP
5 4 4 5 RUP
6 14 6 13 LPP

result:

ok answer 3

Test #61:

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

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 SPPP
5 2 6 4 DRRP
5 1 7 1 DDPP
4 4 3 7 RRRU
8 10 7 11 RUPP
3 11 4 11 DPPP
5 10 5 8 LLPP
1 11 2 8 DLLL
7 4 7 7 RRRP
8 2 8 4 RRPP

result:

ok answer 4

Test #62:

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

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 6 8 RDRRR
4 4 4 7 RRRPP
9 10 9 7 LLLPP
5 6 5 9 RRRPP
8 11 8 8 LLLPP
3 9 2 9 UPPPP
3 1 4 5 DRRRR
2 7 2 7 SPPPP
9 6 7 7 RUUPP
6 3 7 4 DRPPP

result:

ok answer 5

Test #63:

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

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 5 9 DDDPPPP
10 7 8 7 UUPPPPP
4 6 5 7 DRPPPPP
4 10 4 10 SPPPPPP
2 8 4 8 DDPPPPP
8 2 8 1 LPPPPPP
1 1 7 1 DDDDDDP
2 3 6 6 DDDDRRR
7 6 7 6 UDPPPPP
8 8 7 7 LUPPPPP

result:

ok answer 7

Test #64:

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

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 93 1 DDDDDDDDDDDDDDDDP
38 1 42 1 DDDDPPPPPPPPPPPPP
67 1 84 1 DDDDDDDDDDDDDDDDD
91 1 95 1 UDDDDDPPPPPPPPPPP
60 1 70 1 DDDDDDDDDDPPPPPPP
34 1 28 1 UUUUUUPPPPPPPPPPP
32 1 32 1 SPPPPPPPPPPPPPPPP
56 1 49 1 UUUUUUUPPPPPPPPPP
76 1 90 1 DDDDDDDDDDDDDDPPP
57 1 58 1 DPPPPPPPPPPPPPPPP
22 1 8 1 UUUUUUUU...

result:

ok answer 17

Test #65:

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

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 8 2 RPPPPPPPPPPPPPPPP
23 2 8 1 UUUULUUUUUUUUUUUP
17 2 10 2 UUUUUUUPPPPPPPPPP
46 1 37 1 UUUUUUUUUPPPPPPPP
38 1 27 2 URUUUUUUUUUUPPPPP
47 1 47 2 RPPPPPPPPPPPPPPPP
33 1 22 2 RUUUUUUUUUUUPPPPP
45 2 29 2 UUUUUUUUUUUUUUUUP
24 1 15 2 RUUUUUUUUUPPPPPPP
16 1 16 1 SPPPPPPPPPPPPPPPP
18 1 5 1 DUUUUUUUUUU...

result:

ok answer 17

Test #66:

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

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 33 1 DPPPPPP
20 2 13 2 UUUUUUU
18 2 12 1 UUUUULU
32 2 31 3 RUPPPPP
3 2 5 1 DLDPPPP
23 3 17 3 UUUUUUP
2 2 4 1 DDLPPPP
8 3 10 3 DDPPPPP
8 1 8 2 RPPPPPP
28 2 25 2 UUUPPPP
23 1 19 2 RUUUUPP
17 1 10 1 UUUUUUU
7 3 9 3 DDPPPPP
16 1 12 3 RUUURUP
27 1 21 1 UUUUUUP
1 2 4 2 DDDPPPP
24 1 19 1 DUUUUUU
19 ...

result:

ok answer 7

Test #67:

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

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 ULUPPPP
8 2 9 2 SDPPPPP
24 3 24 4 RPPPPPP
12 2 19 2 DDDDDDD
11 4 16 3 LDDDDDP
13 3 19 3 DDDDDDP
13 1 20 1 DDDDDDD
23 3 23 4 RPPPPPP
2 2 3 2 DPPPPPP
20 2 20 4 UDRRPPP
10 4 10 3 LSPPPPP
17 1 21 4 DDDDRRR
24 2 22 2 UUPPPPP
25 2 25 1 LPPPPPP
2 1 7 3 DDDDDRR
6 1 12 2 DDDDDDR
3 4 2 4 UPPPPPP
5...

result:

ok answer 7

Test #68:

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

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 5 4 RRPP
7 4 7 4 SPPP
12 5 14 4 DDLP
10 5 11 5 DPPP
16 5 18 4 DDLP
9 1 8 1 UPPP
1 3 3 4 DDRP
11 5 14 5 DDDP
12 1 13 1 DPPP
15 5 17 5 DDPP
15 3 18 3 DDDP
6 3 5 5 RRUP
8 1 9 1 DPPP
14 1 15 3 RRDP
3 3 3 5 RRPP
11 3 13 3 DDPP
7 1 6 2 RUPP
4 2 2 1 LUUP
10 4 8 4 UUPP

result:

ok answer 4

Test #69:

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

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 4 LDDDDP
5 6 4 4 LLUPPP
1 2 3 2 DDPPPP
3 6 3 4 LLPPPP
8 5 11 3 DDLDLP
14 3 13 3 UUDSPP
1 1 1 1 SPPPPP
4 1 3 3 RRUPPP
5 2 10 1 DDDDDL
10 1 16 1 DDDDDD
13 1 14 1 DPPPPP
6 3 10 3 DDDDPP
13 5 13 1 LLLLPP
1 4 1 6 RRPPPP
2 5 2 5 SPPPPP
8 2 12 3 DDRDDP
2 1 7 2 DDDDDR
16 2 15 2 UPPPPP
12 2 12 1 LPP...

result:

ok answer 6

Test #70:

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

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 DLPP
3 1 6 2 DDDR
12 6 11 6 UPPP
10 6 9 7 RUPP
6 1 7 4 RDRR
13 2 12 2 UPPP
8 2 8 4 RRPP
12 3 13 4 DRPP
1 2 4 1 LDDD
11 5 14 5 DDDP
5 4 6 5 RDPP
7 4 9 5 DDRP
4 1 5 1 DPPP
11 4 11 5 RPPP
5 3 6 3 DPPP
1 3 1 1 LLPP
6 6 7 6 DPPP
12 1 11 1 UPPP
11 7 11 7 SPPP
11 2 11 4 RRPP

result:

ok answer 4

Test #71:

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

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 LLUUU
12 1 12 1 SPPPP
3 6 1 3 LLULU
7 6 7 6 SPPPP
8 4 7 1 LLLUP
4 5 3 2 LLLUP
5 1 3 1 SUUPP
5 5 2 4 UUULP
10 3 11 2 DLPPP
9 4 8 4 UPPPP
8 2 5 1 LUUUP
5 8 5 8 SPPPP
7 4 3 3 UUUUL
5 3 1 2 UUUUL
12 2 12 4 RRPPP
8 5 7 3 ULLPP
10 7 9 8 URPPP
6 4 2 3 UUULU
6 7 2 7 UUUUP
8 6 9 7 DRPPP

result:

ok answer 5

Test #72:

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

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 8 7 SPPPP
5 9 1 9 UUUUP
7 1 3 1 UUUUP
4 8 4 5 LLLPP
10 4 10 4 SPPPP
6 6 6 1 LLLLL
8 6 11 6 DDDPP
9 9 10 9 DPPPP
11 2 11 2 SPPPP
11 5 11 8 RRRPP
4 5 2 4 LUUPP
9 6 9 7 RPPPP
11 8 11 9 RPPPP
10 3 7 3 UUUPP
4 7 4 3 LLLLP
7 8 5 6 LLUUP
5 5 4 2 ULLLP
8 5 6 4 RLLUU
1 8 1 6 RLLLP

result:

ok answer 5

Test #73:

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

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 LLP
3 1 3 2 RPP
1 8 2 10 DRR
1 7 1 6 LPP
9 9 9 6 LLL
8 4 7 6 RUR
2 5 2 6 RPP
4 2 4 2 SPP
4 4 4 3 LPP
2 4 2 4 SPP
8 3 7 5 URR
8 2 5 2 UUU
4 6 6 5 DDL
6 10 6 9 LPP
8 1 7 2 RUP
3 6 2 8 RRU
9 2 10 2 DPP
5 2 5 3 RPP
9 3 7 3 UUP
10 8 10 5 LLL

result:

ok answer 3

Test #74:

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

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 SLLPPPPP
1 59 1 53 LLLLLLPP
1 11 1 16 RRRRRPPP
1 17 1 20 LRRRRPPP
1 95 1 87 LLLLLLLL
1 98 1 93 LLLLLPPP
1 38 1 39 RPPPPPPP
1 47 1 42 LLLLLPPP
1 5 1 6 RPPPPPPP
1 92 1 86 LLLLLLPP
1 33 1 34 RPPPPPPP
1 30 1 31 RPPPPPPP
1 26 1 26 SPPPPPPP
1 50 1 45 LLLLLPPP
1 8 1 14 RRRRRRPP
1 86 1 84 SLLPPP...

result:

ok answer 8

Test #75:

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

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 1 40 UPPPPP
2 29 2 29 SPPPPP
2 44 2 39 LLLLLP
1 23 1 27 RRRRPP
2 48 2 46 LLPPPP
1 31 2 31 DPPPPP
1 15 1 17 RRPPPP
1 38 1 38 SPPPPP
1 9 1 13 RRRRPP
2 3 2 2 LPPPPP
1 30 1 28 LLPPPP
2 7 2 5 LLPPPP
2 13 1 14 URPPPP
2 19 2 19 SPPPPP
1 7 1 2 LLLLLP
2 20 1 21 RUPPPP
1 46 2 41 DLLLLL
1 50 2 50 DPPPPP...

result:

ok answer 6

Test #76:

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

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 LPPPP
2 12 3 8 DLLLL
3 24 3 25 RPPPP
2 29 3 29 DPPPP
1 30 1 33 RRRPP
1 22 1 20 LLPPP
1 29 1 31 RRPPP
1 9 1 7 LLPPP
3 28 3 26 LLPPP
3 7 3 4 LLLPP
3 11 3 6 LLLLL
1 17 2 14 DLLLP
1 23 3 23 DDPPP
2 21 2 20 LPPPP
2 6 2 4 LLPPP
3 6 3 3 LLLPP
1 21 2 21 DPPPP
1 20 1 17 LLLPP
3 15 3 15 SPPPP
1 8 ...

result:

ok answer 5

Test #77:

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

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 4 RRR
1 7 1 10 RRR
3 12 2 10 LUL
3 4 3 6 RRP
4 9 4 10 RPP
3 22 3 24 RRP
3 7 3 8 RPP
1 20 1 20 SPP
2 17 3 15 DLL
4 21 3 19 LLU
4 4 4 7 RRR
1 14 1 16 RRP
1 1 1 3 RRP
2 22 1 22 UPP
1 25 2 25 DPP
2 4 2 4 SPP
1 13 2 11 DLL
3 18 3 18 SPP
3 20 2 19 LUP
4 3 4 6 RRR
1 3 1 4 RPP
2 2 4 2 DDP
2 21 1 21 ...

result:

ok answer 3

Test #78:

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

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 DLLP
4 18 5 18 DPPP
5 11 5 9 LLPP
4 11 3 10 LUPP
3 10 3 7 LLLP
4 5 4 1 LLLL
3 9 4 9 DPPP
1 15 2 14 DLPP
2 12 2 10 LLPP
5 3 5 1 LLPP
1 18 1 15 LLLP
3 17 2 16 LUPP
5 20 5 19 LPPP
1 20 2 20 DPPP
5 17 5 14 LLLP
1 7 2 4 LLLD
3 6 4 4 LDLP
2 8 2 5 LLLP
1 3 4 2 DDDL
2 13 2 11 RLLL
5 6 5 4 LLPP
2 1...

result:

ok answer 4

Test #79:

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

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 6 13 DPP
5 2 5 4 RRP
1 5 1 7 RRP
2 11 3 11 DPP
6 5 6 8 RRR
4 9 5 8 DLP
2 1 2 4 RRR
1 12 1 12 SPP
1 8 2 7 LDP
1 13 2 13 DPP
5 5 6 5 DPP
3 15 1 16 RUU
6 13 6 14 RPP
5 1 5 3 RRP
5 12 5 10 LLP
1 3 1 5 RRP
1 4 4 4 DDD
4 11 4 10 LPP
5 4 6 4 DPP
6 16 6 16 SPP
6 2 6 3 RPP
1 11 1 11 SPP
4 14 3 13 LUP
...

result:

ok answer 3

Test #80:

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

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 1 LPP
7 11 6 11 UPP
1 6 1 6 LRP
5 4 5 4 SPP
2 10 2 8 LLP
3 11 2 11 UPP
7 9 5 10 URU
5 2 7 2 DDP
5 14 3 14 UUP
5 13 4 13 UPP
2 3 4 2 DDL
3 10 3 11 RPP
7 8 6 9 RUP
2 2 3 1 DLP
4 9 2 9 UUP
5 10 5 11 RPP
2 6 3 6 DPP
6 8 5 8 UPP
2 7 3 5 DLL
3 12 2 14 RUR
7 4 7 3 LPP
1 1 1 1 SPP
6 13 5 12 LUP
6 5 ...

result:

ok answer 3

Test #81:

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

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 8 6 RRP
4 9 2 10 URU
7 8 6 9 RUP
2 12 3 12 DPP
8 6 8 7 RPP
8 1 8 2 RPP
4 5 4 6 RPP
3 2 2 2 UPP
4 8 4 11 RRR
7 9 7 11 RRP
4 10 1 10 UUU
6 9 6 11 RRP
2 3 2 6 RRR
5 10 4 12 RUR
8 12 7 12 UPP
8 8 8 10 RRP
1 4 1 6 RRP
6 11 5 12 RUP
6 10 6 12 RRP
5 3 4 1 LUL
3 1 2 1 UPP
4 7 3 9 RRU
8 10 8 11 RPP
2 7...

result:

ok answer 3

Test #82:

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

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 4 1 DPP
2 10 3 8 LLD
8 8 6 8 UUP
9 6 8 4 LLU
2 1 1 2 URP
9 11 8 10 LUP
5 10 5 10 LRP
2 8 2 5 LLL
1 7 1 5 LLP
7 6 7 3 LLL
3 9 4 8 LDP
9 1 9 1 SPP
3 6 1 6 UUP
4 2 4 3 RPP
3 8 3 6 LLP
9 8 8 7 LUP
1 10 2 8 DLL
9 3 9 3 SPP
7 11 6 10 ULP
4 4 1 4 UUU
4 5 5 3 DLL
5 8 4 7 ULP
9 7 6 7 UUU
5 2 8 2 DDD
6 ...

result:

ok answer 3

Test #83:

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

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 LDP
1 8 2 6 LLD
5 8 4 9 RUP
8 4 9 3 LDP
8 3 7 3 UPP
10 2 10 1 LPP
4 1 5 1 DPP
5 2 3 2 UUP
9 7 10 6 DLP
4 5 3 4 LUP
8 9 7 7 LLU
7 7 7 4 LLL
8 10 5 10 UUU
7 5 6 4 ULP
2 8 3 6 LLD
6 3 4 3 UUP
8 5 8 3 LLP
7 2 6 2 UPP
9 5 10 5 DPP
6 7 6 5 LLP
8 1 8 1 SPP
6 10 4 10 UUP
4 2 1 2 UUU
1 1 1 1 SPP
1...

result:

ok answer 3

Test #84:

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

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 10 1 UPPPPPPPPP
51 1 58 1 DDDDDDDPPP
65 1 73 1 DDDDDDDDPP
63 1 70 1 DDDDDDDPPP
1 1 1 1 SPPPPPPPPP
31 1 33 1 DDPPPPPPPP
4 1 2 1 UUPPPPPPPP
66 1 76 1 DDDDDDDDDD
7 1 3 1 UUUUPPPPPP
43 1 48 1 DDDDDPPPPP
42 1 49 1 DDDDDDDPPP
59 1 66 1 DDDDDDDPPP
83 1 91 1 DDDDDDDDPP
40 1 37 1 UUUPPPPPPP
85 1 95 1...

result:

ok answer 10

Test #85:

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

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 1 DDDDDDDDP
32 2 39 1 DDDDDDDLP
20 2 27 2 DDDDDDDPP
49 2 48 2 UPPPPPPPP
43 2 44 2 DPPPPPPPP
1 1 1 2 RPPPPPPPP
49 1 48 1 UPPPPPPPP
28 2 36 2 DDDDDDDDP
48 2 47 2 UPPPPPPPP
40 1 43 1 UDDDDPPPP
30 2 38 1 DDDDDDLDD
47 2 46 2 UPPPPPPPP
25 1 25 2 RPPPPPPPP
5 2 6 2 DPPPPPPPP
33 1 41 1 DDDDDDDDP
46...

result:

ok answer 9

Test #86:

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

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 14 1 SPPPPPPP
32 2 32 2 SPPPPPPP
28 2 22 3 RUUUUUUP
21 3 14 3 UUUUUUUP
26 1 26 2 RPPPPPPP
9 2 10 2 DPPPPPPP
9 1 8 1 UPPPPPPP
7 3 7 1 LLPPPPPP
19 3 13 2 ULUUUUUP
14 3 10 1 SLLUUUUP
12 1 11 1 UPPPPPPP
3 3 2 3 UPPPPPPP
4 2 4 3 RPPPPPPP
16 3 11 3 UUUUUPPP
33 1 33 3 RRPPPPPP
29 ...

result:

ok answer 8

Test #87:

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

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 DDDP
5 4 9 4 DDDD
25 1 25 1 SPPP
1 2 1 1 LPPP
2 3 4 3 DDPP
24 3 21 3 UUUP
19 1 18 1 UPPP
8 2 10 1 DDLP
19 3 19 1 LLPP
5 3 6 3 DPPP
8 1 9 1 DPPP
8 4 8 4 SPPP
8 3 10 4 DRDP
15 3 15 1 LLPP
7 3 9 3 DDPP
18 4 18 4 SPPP
5 1 6 1 DPPP
25 4 22 4 UUUP
12 4 15 4 DDDP
24 2 23 1 LUPP
23 3 20 3 UUUP
3 ...

result:

ok answer 4

Test #88:

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

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 SP
13 3 13 3 SP
6 2 6 1 LP
15 1 16 2 RD
2 3 2 4 RP
12 2 14 2 DD
9 1 10 1 DP
13 1 12 1 UP
10 5 9 5 UP
4 5 4 4 LP
14 1 15 2 RD
17 1 17 2 RP
10 1 10 2 RP
2 5 2 5 SP
8 3 8 1 LL
16 5 17 5 DP
6 5 6 5 SP
5 3 7 3 DD
4 2 3 2 UP
11 2 12 2 DP
9 3 9 2 LP
7 2 7 2 SP
18 5 19 4 DL
4 3 4 2 LP
6 3 6 2 LP
7...

result:

ok answer 2

Test #89:

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

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 9 6 UPP
7 5 8 6 RDP
5 1 7 1 DDP
8 1 11 1 DDD
7 3 8 3 DPP
16 3 16 2 LPP
9 1 12 1 DDD
15 6 16 4 LDL
16 2 16 3 RPP
7 2 9 1 LDD
12 5 15 5 DDD
4 5 6 5 DDP
11 3 14 3 DDD
4 2 4 1 LPP
9 3 12 3 DDD
9 4 11 5 RDD
10 2 13 2 DDD
15 5 15 4 LPP
2 1 2 1 SPP
5 4 8 4 DDD
2 4 1 4 UPP
1 6 3 6 DDP
2 2 3 2 DPP
6 3...

result:

ok answer 3

Test #90:

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

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 5 4 UPP
3 6 2 6 UPP
6 2 6 1 LPP
5 6 6 7 DRP
7 4 6 4 UPP
7 5 7 4 LPP
3 3 3 3 SPP
13 4 14 3 LDP
9 5 9 5 SPP
12 3 14 2 LDD
9 6 9 7 RPP
8 6 6 6 UUP
10 6 10 4 LLP
9 2 9 1 LPP
4 2 5 2 DPP
14 5 14 4 LPP
11 6 10 5 LUP
11 3 11 3 SPP
5 2 5 1 LPP
5 1 3 1 UUP
2 6 1 6 UPP
4 4 2 4 UUP
4 6 3 7 URP
9 1 7 1 UU...

result:

ok answer 3

Test #91:

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

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 3 3 DP
10 7 10 8 RP
4 5 5 6 RD
10 1 9 2 RU
11 6 11 5 LP
2 7 2 7 SP
8 5 9 6 DR
8 4 9 5 RD
4 7 4 8 RP
12 2 12 4 RR
3 6 2 6 UP
5 5 6 5 DP
4 4 4 6 RR
7 4 7 4 SP
8 7 9 8 DR
4 1 4 3 RR
3 7 4 7 DP
9 4 10 5 DR
10 3 11 3 DP
5 2 5 4 RR
3 1 2 1 UP
6 6 7 6 DP
5 3 4 4 RU
2 4 2 3 LP
1 1 1 1 SP
11 1 12 2 DR
...

result:

ok answer 2

Test #92:

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

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 3 3 LPP
5 7 7 7 DDP
6 3 6 3 SPP
4 8 7 8 DDD
7 8 8 8 DPP
4 4 4 3 LPP
2 7 2 6 LPP
7 1 7 2 RPP
8 5 9 5 DPP
1 8 1 9 RPP
5 4 7 4 DDP
10 3 8 3 UUP
2 8 3 8 DPP
3 2 4 2 DPP
11 6 11 6 SPP
4 7 5 6 LDP
7 5 8 4 LDP
1 6 3 6 SDD
10 2 9 2 UPP
5 6 8 6 DDD
11 8 11 7 LPP
2 4 4 4 DDP
9 8 10 9 DRP
8 6 8 9 RRR
4 5...

result:

ok answer 3

Test #93:

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

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 LPP
10 8 9 8 UPP
2 10 3 8 LLD
7 1 8 2 RDP
4 1 5 2 DRP
4 9 5 9 DPP
5 5 7 4 LDD
1 10 2 8 DLL
8 5 7 5 UPP
5 1 7 1 DDP
6 10 6 10 SPP
10 7 10 5 LLP
8 4 8 5 RPP
1 9 1 6 LLL
8 10 8 10 SPP
8 7 7 7 UPP
2 1 4 1 DDP
2 9 4 8 LDD
4 10 4 7 LLL
1 3 2 4 DRP
9 8 10 8 DPP
10 5 10 3 LLP
2 2 3 2 DPP
8 2 10 1 ...

result:

ok answer 3

Test #94:

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

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 76 LLLLLLLLLL
1 2 1 2 SPPPPPPPPP
1 25 1 31 RRRRRRPPPP
1 77 1 70 LLLLLLLPPP
1 98 1 93 LLLLLPPPPP
1 59 1 59 SPPPPPPPPP
1 57 1 51 SLLLLLLPPP
1 76 1 68 LRLLLLLLLL
1 38 1 36 LLPPPPPPPP
1 55 1 47 RLLLLLLLLL
1 43 1 42 LPPPPPPPPP
1 64 1 57 LLLLLLLPPP
1 54 1 52 LLPPPPPPPP
1 91 1 85 LLLLLLPPPP
1 16 ...

result:

ok answer 10

Test #95:

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

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 LLULLL
1 19 1 20 RPPPPP
2 24 2 20 LLLLPP
2 38 2 37 LPPPPP
1 41 1 40 LPPPPP
1 44 1 43 LPPPPP
1 47 1 46 LPPPPP
1 35 1 30 SLLLLL
2 8 2 11 RRRPPP
1 45 1 45 SPPPPP
2 20 2 19 LPPPPP
1 7 2 9 RDRPPP
1 13 2 13 DPPPPP
2 48 2 49 RPPPPP
2 36 2 31 SLLLLL
2 11 2 12 RPPPPP
2 7 1 7 UPPP...

result:

ok answer 6

Test #96:

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

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 SRRP
1 33 2 33 DPPP
1 14 1 13 LPPP
2 25 2 28 RRRP
3 6 3 7 RPPP
2 5 2 8 RRRP
1 18 2 20 DRRP
3 24 2 27 URRR
2 26 2 30 RRRR
1 13 1 14 RPPP
3 9 3 8 LPPP
2 22 2 25 RRRP
2 30 1 32 RRUP
3 30 3 31 RPPP
1 10 2 10 DPPP
1 6 1 7 RPPP
3 19 3 23 RRRR
3 31 1 33 RRUU
2 15 2 14 LPPP
3 4 3 5 RPPP
1 4 1 4 ...

result:

ok answer 4

Test #97:

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

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 3 13 DLL
2 1 2 2 RPP
3 15 2 15 UPP
4 15 4 14 LPP
3 20 3 19 LPP
2 14 2 12 LLP
3 13 3 10 LLL
1 11 1 10 LPP
4 19 4 19 SPP
1 21 1 22 RPP
2 9 2 9 SPP
1 14 1 14 SPP
2 24 2 24 SPP
3 18 3 17 LPP
3 3 3 5 RRP
1 20 2 20 DPP
2 10 3 8 DLL
4 25 3 25 UPP
1 10 2 10 DPP
2 20 2 19 LPP
2 18 2 18 SPP
4 22 4 21 L...

result:

ok answer 3

Test #98:

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

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 5 11 DPP
1 18 1 17 LPP
3 13 3 12 LPP
3 17 2 17 UPP
2 14 2 13 LPP
4 17 4 17 SPP
1 8 1 11 RRR
2 5 2 8 RRR
2 12 1 14 URR
2 20 3 20 DPP
1 2 1 3 RPP
1 5 1 6 RPP
4 6 4 8 RRP
3 3 3 2 LPP
3 4 5 4 DDP
3 2 3 1 LPP
2 3 2 3 SPP
1 20 2 20 DPP
2 6 3 7 DRP
1 19 2 19 DPP
3 7 3 8 RPP
5 20 5 20 SPP
3 11 4 11 D...

result:

ok answer 3

Test #99:

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

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 1 5 RPPP
3 11 4 9 LLDP
4 3 4 3 SPPP
5 5 5 3 LLPP
2 13 2 11 LLPP
4 14 4 13 LPPP
2 14 2 10 LLLL
3 10 5 9 LDDP
2 8 2 4 LLLL
5 10 5 6 LLLL
4 9 4 6 LLLP
2 16 5 15 DDDL
1 8 2 6 DLLP
3 1 3 2 RPPP
1 14 1 13 LPPP
3 13 3 10 LLLP
6 6 6 2 LLLL
3 9 4 7 DLLP
6 4 6 3 LPPP
2 11 2 7 LLLL
2 2 2 1 LPPP
3 7 4 5 D...

result:

ok answer 4

Test #100:

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

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 7 13 RR
3 7 3 6 LP
5 9 5 10 RP
1 7 2 7 DP
1 5 1 7 RR
2 13 2 14 RP
1 4 2 4 DP
3 11 2 12 RU
2 12 1 13 RU
5 14 6 14 DP
4 4 4 5 RP
4 3 3 3 UP
4 13 2 13 UU
3 3 3 4 RP
4 11 3 12 RU
7 14 7 14 SP
6 12 6 11 LP
6 13 5 13 UP
5 10 5 11 RP
3 1 2 1 UP
4 9 3 9 UP
2 4 1 4 UP
6 8 7 8 DP
3 8 3 7 LP...

result:

ok answer 2

Test #101:

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

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 5 7 UPP
5 5 5 4 LPP
3 2 4 2 DPP
4 9 3 9 UPP
6 10 5 9 ULP
8 10 7 11 RUP
8 9 8 6 LLL
1 5 1 6 RPP
5 2 5 3 RPP
7 12 6 12 UPP
5 7 4 7 UPP
2 9 1 9 UPP
4 10 4 9 LPP
2 8 1 8 UPP
1 2 2 2 DPP
7 5 6 5 UPP
6 1 6 2 RPP
2 11 2 10 LPP
3 5 2 5 UPP
4 1 5 1 DPP
5 6 6 6 DPP
2 12 1 12 UPP
2 6 2 8 RRP
7 4 7 3 LPP
...

result:

ok answer 3

Test #102:

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

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 5 11 DD
7 6 7 6 SP
4 8 3 8 UP
3 9 3 10 RP
9 6 9 7 RP
2 10 1 10 UP
8 1 9 1 DP
4 7 2 7 UU
9 9 9 9 SP
3 1 3 1 SP
7 10 8 10 DP
1 7 1 7 SP
5 8 5 9 RP
2 11 4 11 DD
7 4 6 3 UL
9 5 9 6 RP
9 3 9 4 RP
6 10 7 11 RD
9 11 9 10 LP
2 6 1 6 UP
2 7 2 8 RP
8 3 8 3 SP
1 1 1 1 SP
9 7 9 8 RP
2 8 1 8 UP
7 5 6 4 UL...

result:

ok answer 2

Test #103:

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

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 5 RP
8 5 9 5 DP
10 2 10 2 SP
6 7 5 7 UP
8 10 6 10 UU
9 5 8 5 UP
7 6 7 7 RP
8 7 8 6 LP
7 3 7 4 RP
9 8 9 8 SP
6 1 6 1 SP
10 7 10 8 RP
3 5 2 4 LU
4 10 5 9 DL
9 7 9 7 SP
10 6 10 7 RP
8 3 8 4 RP
7 7 8 7 DP
5 1 3 1 UU
9 3 8 3 UP
1 3 2 2 DL
2 7 1 6 LU
7 2 7 1 LP
6 2 6 4 RR
10 4 10 5 RP
7 9 7 9 SP
2...

result:

ok answer 2

Test #104:

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

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 48 1 UUUUUUUUUUUUUUUUUP
1 1 1 1 SPPPPPPPPPPPPPPPPP
55 1 37 1 UUUUUUUUUUUUUUUUUU
98 1 95 1 UUUPPPPPPPPPPPPPPP
4 1 5 1 DPPPPPPPPPPPPPPPPP
96 1 96 1 SPPPPPPPPPPPPPPPPP
91 1 75 1 UUUUUUUUUUUUUUUUPP
64 1 46 1 UUUUUUUUUUUUUUUUUU
88 1 76 1 UUUUUUUUUUUUPPPPPP
62 1 45 1 UUUUUUUUUUUUUUUUUP
99 1 99 1 S...

result:

ok answer 18

Test #105:

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

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 UPPPP
2 2 4 2 DDPPP
1 2 3 2 DDPPP
41 2 40 2 UPPPP
20 1 17 1 SUUUP
2 1 3 1 DPPPP
4 2 4 1 LPPPP
48 1 49 1 DPPPP
37 1 33 2 RUUUU
43 2 42 2 UPPPP
40 1 39 1 UPPPP
42 1 37 1 UUUUU
6 2 6 2 UDPPP
36 1 31 1 UUUUU
48 2 48 1 LPPPP
32 1 28 1 UUUUP
7 1 8 1 DPPPP
33 1 29 1 UUUUP
30 2 27 2 SUUUP
27 2 22 ...

result:

ok answer 5

Test #106:

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

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 11 3 RPPP
19 3 20 3 DPPP
30 1 31 1 DPPP
33 3 33 2 LPPP
31 3 30 3 UPPP
1 1 2 1 DPPP
2 1 3 1 DPPP
28 2 28 1 LPPP
15 3 18 3 DDDP
23 2 23 3 RPPP
10 1 13 1 DDDP
12 2 15 2 DDDP
30 2 29 2 UPPP
25 2 26 2 DPPP
25 3 25 3 SPPP
15 2 17 3 RDDP
12 1 15 1 DDDP
9 3 10 3 DPPP
8 1 8 1 SPPP
7 1 7 2 RPPP
16 3 19...

result:

ok answer 4

Test #107:

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

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 4 UPP
10 3 9 3 UPP
22 1 21 1 UPP
4 2 4 3 RPP
16 4 13 4 UUU
24 2 24 2 SPP
22 3 21 3 UPP
17 1 15 1 SUU
5 4 4 4 UPP
15 2 12 2 UUU
16 3 15 4 URP
21 3 20 3 UPP
10 1 9 1 UPP
25 1 25 2 RPP
9 3 8 3 UPP
1 1 1 1 SPP
20 3 20 2 LPP
8 1 6 1 UUP
19 1 17 1 UUP
18 4 16 4 UUP
20 4 17 4 UUU
21 4 19 4 UUP
10...

result:

ok answer 3

Test #108:

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

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 DPPP
15 5 16 5 DPPP
3 1 4 1 DPPP
2 5 1 5 UPPP
15 2 16 2 SDPP
3 2 3 3 RPPP
10 2 12 3 DRDP
6 5 7 5 DPPP
1 3 1 4 RPPP
9 1 8 1 UPPP
15 3 19 3 DDDD
13 4 14 5 SDRP
11 4 14 3 LDDD
5 1 6 1 DPPP
9 2 11 2 DDPP
17 3 19 2 DDLP
18 1 19 1 DPPP
9 5 11 5 DDPP
3 3 2 3 UPPP
20 2 20 2 SPPP
4 2 4 3 RPPP
4 3 4...

result:

ok answer 4

Test #109:

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

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 1 2 LPP
7 1 9 1 DDP
13 3 14 3 DPP
10 5 11 5 DPP
4 2 6 2 DDP
14 3 14 5 RRP
6 4 6 4 SPP
1 4 1 3 LPP
8 3 11 3 DDD
12 2 14 2 DDP
10 3 12 3 DDP
5 6 5 5 LPP
2 4 2 3 LPP
7 3 9 3 DDP
11 1 13 1 DDP
6 1 8 1 DDP
13 2 14 1 LDP
16 3 16 3 SPP
5 3 6 3 DPP
13 5 15 6 RDD
3 1 4 1 DPP
2 1 5 1 DDD
2 5 1 5 UPP
15 ...

result:

ok answer 3

Test #110:

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

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 RPP
3 5 2 7 RRU
8 5 8 5 SPP
7 7 7 6 LPP
2 4 1 4 UPP
9 4 8 4 UPP
14 3 14 4 RPP
11 7 11 6 LPP
6 2 3 2 UUU
1 4 1 3 LPP
9 6 6 6 UUU
3 6 2 5 LUP
12 3 11 3 UPP
7 4 6 4 UPP
12 2 9 2 UUU
13 6 10 6 UUU
14 4 13 4 UPP
13 1 10 1 UUU
2 1 1 1 UPP
1 6 2 6 DPP
11 3 9 3 UUP
12 6 11 5 LUP
4 2 4 1 LPP
11 2...

result:

ok answer 3

Test #111:

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

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 11 3 LP
6 6 6 7 RP
9 3 10 3 DP
10 8 11 8 DP
7 5 6 5 UP
9 2 11 2 DD
5 8 5 8 SP
11 8 11 7 LP
8 8 8 8 SP
9 6 9 7 RP
5 1 4 1 UP
12 4 12 4 SP
9 8 10 8 DP
7 2 8 2 DP
2 1 1 1 UP
7 4 6 4 UP
8 6 9 6 DP
8 5 8 7 RR
12 1 12 1 SP
1 8 1 8 SP
12 8 12 7 LP
4 8 4 7 LP
2 7 2 7 SP
7 7 7 8 RP
12 7 12 6 LP
9 4 9 ...

result:

ok answer 2

Test #112:

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

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 4 LP
1 1 2 1 DP
6 1 7 1 DP
5 7 4 7 UP
10 8 9 8 UP
3 2 3 3 RP
5 4 4 4 UP
5 5 4 5 UP
10 6 10 7 RP
1 9 2 9 DP
11 8 11 9 SR
6 8 7 8 DP
8 3 8 4 RP
7 6 8 6 DP
9 9 8 9 UP
2 8 1 8 UP
1 7 1 6 LP
8 7 9 7 DP
10 1 11 1 DP
3 6 4 6 DP
5 6 6 6 DP
4 1 4 1 SP
2 7 3 7 DP
3 4 2 4 UP
8 6 9 5 LD
5 9 5 9 SP
10 3 ...

result:

ok answer 2

Test #113:

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

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 5 1 DD
10 10 10 10 SP
7 3 8 3 DP
3 4 5 4 DD
10 5 9 5 UP
9 7 9 6 LP
6 1 6 2 RP
4 1 5 2 DR
3 5 3 4 LP
1 6 2 6 DP
7 8 6 8 UP
2 10 2 9 LP
5 6 5 5 LP
1 3 1 4 RP
8 4 7 4 UP
4 5 4 5 SP
3 9 3 7 LL
10 6 10 5 LP
2 3 2 4 RP
8 9 8 8 LP
8 6 7 6 UP
8 8 8 7 LP
6 8 5 8 UP
8 10 8 9 LP
3 10 5 10 DD
7 4 7 3 LP
2...

result:

ok answer 2

Test #114:

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

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 UPPPP
38 1 37 1 DUUPP
87 1 85 1 UUPPP
80 1 76 1 UUUUP
90 1 89 1 UPPPP
60 1 58 1 UUPPP
61 1 60 1 UPPPP
15 1 16 1 DPPPP
40 1 38 1 DUUUP
20 1 23 1 DDDPP
12 1 11 1 UPPPP
66 1 61 1 UUUUU
88 1 86 1 UUPPP
92 1 91 1 UPPPP
11 1 10 1 UPPPP
64 1 63 1 UPPPP
34 1 36 1 SDDPP
28 1 31 1 DDDPP
55 1 57 1...

result:

ok answer 5

Test #115:

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

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 30 2 DPPP
49 2 49 1 LPPP
25 1 26 1 DPPP
30 1 32 1 DDPP
40 1 39 1 UPPP
6 1 5 1 UPPP
4 2 2 2 SUUP
12 1 9 1 UUUP
22 1 19 1 UUUP
11 2 8 2 UUUP
29 1 31 1 DDPP
28 2 29 2 DPPP
17 1 15 1 UUPP
17 2 16 2 UPPP
27 2 26 2 UPPP
36 2 37 2 DPPP
46 2 46 2 SPPP
44 2 44 1 LPPP
38 1 38 1 SPPP
3 2 1 2 LUUR
45 2 4...

result:

ok answer 4

Test #116:

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

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 14 3 UU
31 1 31 1 SP
5 2 6 2 DP
23 2 24 2 DP
4 1 5 2 DR
28 2 29 2 DP
19 3 19 3 SP
29 3 29 3 SP
22 2 22 1 LP
1 3 1 3 SP
20 2 19 2 UP
25 2 26 1 DL
12 3 11 3 UP
3 3 5 3 DD
31 2 32 2 DP
19 1 18 1 UP
16 1 17 1 DP
17 2 16 2 UP
8 1 10 1 DD
5 1 6 1 DP
28 1 28 2 RP
14 2 14 2 SP
32 2 33 2 DP
6 2 7 3 RD...

result:

ok answer 2

Test #117:

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

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 DP
4 1 3 1 UP
2 1 2 2 RP
22 1 23 1 DP
17 4 16 4 UP
24 2 23 2 UP
5 4 5 4 SP
19 2 20 2 DP
15 3 15 4 RP
17 1 17 1 SP
21 2 22 2 DP
5 1 5 1 SP
10 4 9 3 LU
14 3 14 4 RP
8 1 8 1 SP
6 1 7 1 DP
10 2 9 2 UP
24 3 24 4 RP
3 1 2 1 UP
22 3 23 3 DP
3 2 3 4 RR
7 4 8 4 DP
21 4 20 4 UP
25 2 24 2 UP
16 2 1...

result:

ok answer 2

Test #118:

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

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 1 LP
9 3 9 3 SP
1 1 2 1 DP
2 1 3 1 DP
2 2 4 2 DD
5 2 6 2 DP
12 2 12 2 SP
14 4 15 4 DP
6 1 7 1 DP
20 5 20 5 LR
3 1 4 1 DP
3 2 4 3 DR
11 4 11 3 LP
1 4 1 2 LL
3 5 5 5 DD
14 1 15 1 DP
17 1 17 2 RP
7 1 6 1 UP
7 5 8 5 DP
18 4 20 4 DD
7 4 7 5 RP
1 2 1 1 LP
17 5 18 5 DP
6 3 7 3 DP
13 4 13 4 SP
16 ...

result:

ok answer 2

Test #119:

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

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 5 6 DD
3 4 3 4 SP
1 2 2 2 DP
16 4 16 2 LL
8 1 10 1 DD
11 4 12 4 DP
9 4 9 5 RP
10 4 11 3 LD
8 2 9 2 DP
13 6 14 6 DP
6 4 6 3 LP
7 4 7 5 RP
9 5 10 5 DP
4 1 3 1 UP
1 6 1 5 LP
5 1 6 1 DP
16 6 16 5 LP
8 3 10 3 DD
12 4 13 4 DP
10 3 12 3 DD
14 5 14 4 LP
6 5 6 6 RP
13 5 14 5 DP
4 4 5 4 DP
11 6 10 6 UP
...

result:

ok answer 2

Test #120:

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

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 8 3 UP
11 5 11 4 LP
6 6 6 6 SP
1 6 1 6 SP
1 3 1 4 RP
9 2 9 1 LP
4 1 4 2 RP
14 3 14 4 RP
9 5 9 6 RP
13 2 14 2 DP
6 2 7 2 DP
12 1 13 1 DP
5 5 6 5 DP
7 3 6 3 UP
7 6 7 7 RP
5 2 6 2 DP
10 3 10 3 SP
4 4 5 4 DP
5 1 6 1 DP
12 6 12 5 LP
13 1 12 1 UP
3 3 4 4 DR
1 2 1 2 SP
12 4 12 3 LP
13 6 13 6 SP
11 3 ...

result:

ok answer 2

Test #121:

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

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 5 6 DP
2 7 3 7 DP
12 6 12 7 RP
8 4 9 4 DP
10 8 9 8 UP
6 6 6 7 RP
3 3 4 3 DP
4 1 6 1 DD
12 5 12 6 RP
9 6 10 6 DP
2 1 3 1 DP
6 1 7 2 DR
6 8 7 8 DP
11 4 11 5 RP
11 5 11 6 RP
6 2 6 3 RP
9 3 10 3 SD
3 7 4 7 DP
5 6 6 6 DP
5 2 6 2 DP
3 1 5 1 DD
11 2 12 2 DP
4 4 5 4 SD
1 5 3 5 DD
7 1 8 1 DP
10 2 11 3 ...

result:

ok answer 2

Test #122:

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

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 DP
9 5 10 5 DP
4 1 5 1 DP
1 5 2 5 DP
11 2 11 1 LP
3 8 3 9 RP
4 8 4 8 SP
11 4 11 5 RP
3 6 4 6 DP
1 9 2 9 DP
9 4 9 5 RP
8 8 9 8 DP
1 1 1 1 SP
2 8 3 8 DP
1 6 1 8 RR
3 9 4 9 DP
8 3 8 4 RP
4 5 5 5 DP
10 8 10 7 LP
7 2 7 3 RP
9 2 10 2 DP
6 8 5 8 UP
8 7 7 7 UP
11 8 10 8 UP
6 5 6 6 RP
10 5 10 6 RP
...

result:

ok answer 2

Test #123:

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

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 6 9 UP
3 1 2 1 UP
6 2 5 2 UP
9 10 10 10 DP
8 7 8 5 LL
2 4 2 3 LP
5 9 4 8 UL
10 6 10 5 LP
3 9 2 9 UP
7 8 7 9 RP
4 4 3 3 UL
2 6 2 5 LP
5 4 4 3 UL
6 1 5 1 UP
8 9 8 10 RP
7 6 7 6 SP
10 8 10 9 RP
9 7 10 7 DP
1 10 1 10 SP
6 8 5 8 UP
3 4 3 2 LL
8 4 8 2 LL
1 2 1 1 LP
1 5 1 4 LP
7 4 8 3 LD
6 3 5 3 UP
2...

result:

ok answer 2

Test #124:

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

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 33 LLLLLLLLP
1 75 1 66 LLLLLLLLL
1 13 1 12 LPPPPPPPP
1 62 1 53 LLLLLLLLL
1 25 1 17 LLLLLLLLP
1 89 1 88 LPPPPPPPP
1 45 1 39 LLLLLLPPP
1 40 1 34 LLLLLLPPP
1 10 1 4 LLLLLLPPP
1 81 1 80 LPPPPPPPP
1 100 1 99 LPPPPPPPP
1 26 1 22 LLLLPPPPP
1 97 1 96 LPPPPPPPP
1 30 1 24 LLLLLLPPP
1 42 1 38 LLLLPPPP...

result:

ok answer 9

Test #125:

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

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 34 DP
2 37 2 37 SP
2 2 2 2 SP
2 19 2 18 LP
1 37 1 39 RR
2 3 2 3 SP
2 31 2 33 RR
1 45 1 47 RR
2 44 2 45 RP
1 22 2 22 DP
1 44 1 45 RP
2 17 2 16 LP
2 6 2 5 LP
2 21 1 21 UP
2 29 2 31 RR
2 36 1 36 UP
1 48 1 48 SP
1 30 1 31 RP
1 13 1 12 LP
1 43 1 44 RP
1 18 1 18 SP
1 50 1 49 LP
1 23 1 23 SP
2 8 2...

result:

ok answer 2

Test #126:

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

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 2 16 DP
2 8 2 7 LP
2 30 2 31 RP
3 33 3 32 LP
2 21 2 23 RR
2 11 1 11 UP
1 5 1 4 LP
2 6 3 5 DL
2 7 2 6 LP
3 24 3 25 RP
1 14 2 14 DP
3 5 3 4 LP
2 23 2 25 RR
2 10 2 9 LP
2 9 1 9 UP
1 6 1 5 LP
2 28 2 29 RP
1 7 1 6 LP
2 3 2 4 RP
3 26 3 27 RP
1 27 1 29 RR
2 29 2 30 RP
3 25 3 26 RP
2 19 1 19 UP
1 31 ...

result:

ok answer 2

Test #127:

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

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 2 2 DP
1 3 1 3 SP
1 13 1 13 SP
2 11 2 10 LP
4 21 4 20 LP
1 7 2 6 DL
4 15 4 13 LL
2 9 2 8 LP
2 21 3 21 DP
2 13 3 13 DP
4 4 3 4 UP
3 2 4 2 DP
2 20 2 21 RP
4 8 4 7 LP
4 3 4 3 SP
4 14 4 12 LL
2 12 2 11 LP
3 25 3 25 SP
3 19 3 18 LP
1 25 2 25 DP
1 21 1 21 SP
4 5 4 5 SP
3 3 3 2 LP
2 6 1 6 UP
2 14 2 1...

result:

ok answer 2

Test #128:

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

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 2 17 D
3 8 3 7 L
4 12 4 13 R
2 19 1 19 U
1 10 1 10 S
2 14 2 14 S
4 7 4 7 S
4 3 4 4 R
2 8 2 9 R
3 14 3 13 L
5 20 4 20 U
1 20 2 20 D
3 18 4 18 D
5 18 5 19 R
1 2 1 3 R
4 10 5 10 D
5 3 5 4 R
4 19 4 19 S
5 13 5 14 R
4 2 5 2 D
1 3 1 4 R
1 8 2 8 D
3 13 3 14 R
5 9 5 9 S
3 16 4 16 D
2 9 1 9 U
4 8 5 8 ...

result:

ok answer 1

Test #129:

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

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 3 10 U
5 6 4 6 U
4 7 3 7 U
2 2 3 2 D
2 8 1 8 U
6 5 6 4 L
3 15 3 16 R
5 12 5 12 S
4 3 4 2 L
3 7 3 6 L
1 14 1 13 L
2 4 1 4 U
3 14 3 15 R
1 8 1 7 L
2 14 1 14 U
3 8 2 8 U
1 2 2 2 D
1 12 1 12 S
6 12 6 13 R
4 5 3 5 U
4 9 3 9 U
2 16 1 16 U
6 16 6 16 S
6 4 6 3 L
4 11 4 12 R
4 8 3 8 U
5 2 ...

result:

ok answer 1

Test #130:

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

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 7 14 R
3 14 2 14 U
4 1 5 1 D
4 9 3 9 U
2 8 2 7 L
3 10 4 10 D
7 7 7 7 S
6 8 6 7 L
6 12 6 11 L
5 3 6 3 D
2 1 2 2 R
4 5 5 5 D
7 8 7 9 R
3 1 3 2 R
7 3 7 2 L
4 12 5 12 D
4 14 4 13 L
6 14 6 13 L
7 1 6 1 U
1 3 2 3 D
2 5 2 5 S
1 8 2 8 D
5 2 5 3 R
2 11 2 12 R
7 10 6 10 U
5 12 4 12 U
3 3 4 3 D
3 8 3 7 ...

result:

ok answer 1

Test #131:

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

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 1 9 U
3 2 3 3 R
4 6 4 6 S
8 5 8 6 R
4 5 5 5 D
1 6 2 6 D
7 7 7 8 R
6 9 6 10 R
8 11 8 11 S
4 2 5 2 D
8 10 8 10 S
3 12 2 12 U
8 12 8 12 S
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 7 9 U
5 8 5 8 S
7 3 7 4 R
5 4 4 4 U
4 4 4 5 R
8 8 8 9 R
6 11 5 11 U
7 5 8 5 D
7 4 7...

result:

ok answer 1

Test #132:

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

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 4 S
8 8 7 8 U
6 9 6 8 L
1 2 1 1 L
8 3 8 4 R
1 11 1 11 S
8 6 7 6 U
1 8 1 7 L
7 8 8 8 D
4 7 4 8 R
3 2 2 2 U
2 9 3 9 D
6 3 5 3 U
9 10 8 10 U
4 8 3 8 U
8 10 7 10 U
3 9 3 10 R
9 2 9 3 R
2 3 3 3 D
8 2 8 2 S
9 5 8 5 U
6 11 6 10 L
2 11 2 11 S
6 4 6 4 S
7 3 6 3 U
3 8 2 8 U
7 1 8 1 D
5 8 5 8...

result:

ok answer 1

Test #133:

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

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 3 5 U
10 2 10 3 R
4 1 3 1 U
1 10 2 10 D
2 1 2 2 R
7 5 7 4 L
1 9 2 9 D
5 9 6 9 D
9 1 9 2 R
5 6 4 6 U
5 10 5 10 S
8 2 8 3 R
5 4 5 4 S
7 8 6 8 U
7 1 6 1 U
9 2 10 2 D
10 4 10 5 R
2 9 1 9 U
4 7 5 7 D
6 10 6 10 S
8 7 9 7 D
6 6 6 5 L
5 7 6 7 D
7 7 7 6 L
3 4 4 4 D
4 4 3 4 U
5 5 4 5 U
4 10 4 10 S
7 4 6...

result:

ok answer 1

Test #134:

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

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 90 1 DPPP
74 1 73 1 UPPP
85 1 86 1 DPPP
59 1 58 1 UPPP
91 1 92 1 DPPP
88 1 87 1 UPPP
93 1 93 1 SPPP
78 1 77 1 UPPP
63 1 62 1 UPPP
52 1 51 1 UPPP
37 1 34 1 UUUP
28 1 24 1 UUUU
51 1 52 1 DPPP
42 1 42 1 SPPP
79 1 80 1 DPPP
4 1 5 1 DPPP
81 1 82 1 DPPP
31 1 27 1 UUUU
25 1 23 1 DUUU
60 1 59 1 UPPP
...

result:

ok answer 4

Test #135:

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

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 21 2 U
31 2 30 2 U
29 2 28 2 U
39 2 39 1 L
11 2 10 2 U
2 1 3 1 D
26 2 25 2 U
1 2 1 1 L
44 1 43 1 U
17 2 16 2 U
41 1 42 1 D
35 1 35 2 R
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 34 2 U
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: 0ms
memory: 22100kb

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 4 1 D
25 1 24 1 U
10 1 9 1 U
7 3 7 3 S
1 2 1 3 R
32 3 32 2 L
9 3 8 3 U
18 1 19 1 D
22 3 21 3 U
16 3 15 3 U
4 2 3 2 U
26 3 25 3 U
19 3 20 3 D
19 1 18 1 U
7 2 6 2 U
23 2 22 2 U
13 2 12 2 U
8 1 7 1 U
20 3 19 3 U
14 1 13 1 U
6 2 5 2 U
26 2 26 3 R
23 3 23 3 S
29 3 29 3 S
29 2 28...

result:

ok answer 1

Test #137:

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

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 18 1 D
22 4 23 4 D
16 1 16 2 R
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 24 4 D
22 1 23 1 D
20 2 20 2 S
8 2 7 2 U
17 4 18 4 D
1 3 1 3 S
9 1 8 1 U
22 3 21 3 U
13 4 12 4 U
12 3 11 3 U
14 1 15 1 D
1 1 1 2 R
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: 0ms
memory: 22020kb

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 16 5 R
7 3 6 3 U
6 2 7 2 D
8 3 8 2 L
12 4 12 5 R
10 2 10 3 R
12 5 11 5 U
18 2 18 2 S
12 3 12 4 R
16 1 15 1 U
2 1 3 1 D
19 5 19 4 L
19 3 18 3 U
14 4 14 5 R
13 2 12 2 U
15 2 14 2 U
17 1 18 1 D
20 5 19 5 U
15 3 14 3 U
7 1 7 1 S
4 4 4 3 L
8 5 7 5 U
6 3 5 3 U
18 4 17 4 U
1 3 1 ...

result:

ok answer 1

Test #139:

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

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 15 5 D
1 1 2 1 D
4 6 3 6 U
9 2 10 2 D
11 2 12 2 D
14 2 14 1 L
5 6 6 6 D
5 5 6 5 D
7 1 8 1 D
2 6 1 6 U
13 2 13 1 L
8 4 9 4 D
1 4 2 4 D
15 5 15 6 R
16 6 16 6 S
7 3 8 3 D
11 3 11 3 S
13 3 14 3 D
3 3 4 3 D
2 1 1 1 U
1 6 2 6 D
16 2 16 1 L
13 1 13 2 R
12 6 12 6 S
2 2 1 2 U
8 3 9 3 D
14 6 13 6 U
14 ...

result:

ok answer 1

Test #140:

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

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 3 L
10 7 9 7 U
13 6 13 5 L
12 3 11 3 U
6 5 7 5 D
14 2 14 1 L
11 4 11 4 S
11 3 12 3 D
13 1 12 1 U
14 1 13 1 U
8 7 8 6 L
10 6 11 6 D
2 7 1 7 U
11 7 11 7 S
2 4 3 4 D
11 6 11 5 L
7 5 6 5 U
9 4 10 4 D
7 6 6 6 U
12 5 12 4 L
12 4 13 4 D
3 2 3 3 R
3 4 3 5 R
1 2 2 2 D
1 3 1 4 R
4 1 3 1 U
9 1 8 1 U
...

result:

ok answer 1

Test #141:

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

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 4 3 D
2 4 1 4 U
5 8 4 8 U
9 5 9 6 R
8 8 7 8 U
5 4 5 5 R
11 1 10 1 U
3 8 2 8 U
6 8 5 8 U
8 6 7 6 U
5 5 6 5 D
11 2 11 2 S
8 4 9 4 D
5 1 4 1 U
4 1 3 1 U
6 1 5 1 U
2 8 1 8 U
9 6 8 6 U
9 1 8 1 U
7 8 6 8 U
12 6 12 5 L
9 4 10 4 D
7 7 8 7 D
7 1 6 1 U
9 3 8 3 U
4 3 4 4 R
12 1 11 1 U
2 5 2 5...

result:

ok answer 1

Test #142:

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

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 6 4 D
7 3 8 3 D
7 8 6 8 U
1 5 2 5 D
5 2 5 3 R
2 6 1 6 U
8 8 8 9 R
9 4 10 4 D
6 4 6 5 R
9 7 8 7 U
1 6 1 5 L
3 2 4 2 D
1 7 1 8 R
4 7 3 7 U
6 6 5 6 U
2 1 1 1 U
8 2 7 2 U
11 2 11 2 S
11 5 11 5 S
9 2 8 2 U
6 7 5 7 U
10 9 10 9 S
2 9 2 8 L
4 9 3 9 U
1 1 2 1 D
4 4 5 4 D
6 1 5 1 U
10 3 10 2 L...

result:

ok answer 1

Test #143:

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

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 5 S
9 9 8 9 U
4 10 4 10 S
2 2 1 2 U
6 9 5 9 U
1 1 2 1 D
6 1 5 1 U
1 4 1 5 R
7 7 7 8 R
6 2 6 1 L
9 5 8 5 U
9 6 10 6 D
8 7 8 8 R
5 4 6 4 D
10 7 9 7 U
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 1 3 U
3 5 2 5 U
9 8 9 9 R
1 3 2 3 D
3 8 4 8 D
7 2 6 2 U
2 7 2 7 ...

result:

ok answer 1

Test #144:

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

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 98 R
1 31 1 30 L
1 78 1 77 L
1 51 1 50 L
1 48 1 47 L
1 89 1 90 R
1 4 1 3 L
1 16 1 15 L
1 47 1 46 L
1 33 1 32 L
1 88 1 87 L
1 87 1 88 R
1 55 1 54 L
1 22 1 21 L
1 11 1 11 S
1 44 1 43 L
1 43 1 42 L
1 73 1 74 R
1 7 1 8 R
1 74 1 73 L
1 1 1 2 R
1 36 1 35 L
1 20 1 19 L
1 92...

result:

ok answer 1

Test #145:

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

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 18 S
1 20 1 21 R
2 6 2 6 S
2 9 2 10 R
1 3 1 3 S
2 30 2 29 L
2 4 1 4 U
1 33 1 33 S
2 43 1 43 U
2 21 2 20 L
1 31 1 30 L
2 24 2 24 S
1 10 1 10 S
1 42 2 42 D
1 4 1 5 R
1 45 1 44 L
2 28 1 28 U
1 27 1 26 L
1 24 1 25 R
2 47 2 46 L
1 47 1 48 R
1 13 2 13 D
2 40 2 39 L
1 18 1 19 R
1 22 1 23 R
1 36 2 ...

result:

ok answer 1

Test #146:

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

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 1 19 U
3 20 3 21 R
3 10 3 11 R
1 33 2 33 D
1 17 2 17 D
1 7 2 7 D
3 8 3 9 R
1 3 2 3 D
3 6 3 7 R
3 7 3 8 R
3 18 3 19 R
1 22 1 21 L
2 3 2 4 R
3 30 3 29 L
3 31 3 31 S
3 3 3 3 S
1 26 2 26 D
1 21 1 22 R
1 27 2 27 D
1 31 2 31 D
3 17 3 18 R
2 12 1 12 U
3 13 3 14 R
2 26 1 26 U
2 28 1 28 U
3 15 3 16 R
...

result:

ok answer 1

Test #147:

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

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 2 25 D
3 11 3 10 L
1 2 2 2 D
4 1 3 1 U
4 19 3 19 U
3 5 3 4 L
4 5 4 5 S
1 12 2 12 D
2 1 1 1 U
3 4 4 4 D
1 23 1 24 R
2 18 1 18 U
4 15 3 15 U
4 13 3 13 U
4 11 3 11 U
2 23 1 23 U
3 1 2 1 U
2 7 2 7 S
4 6 4 6 S
4 20 4 19 L
2 16 1 16 U
1 17 2 17 D
2 10 1 10 U
4 18 4 17 L
3 3 3 2 L
2 22 1 22 U
2 6 3 ...

result:

ok answer 1

Test #148:

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

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 3 11 U
2 13 1 13 U
1 20 2 20 D
2 18 1 18 U
2 6 1 6 U
2 17 1 17 U
4 12 4 13 R
4 1 3 1 U
5 6 5 6 S
2 4 1 4 U
4 4 3 4 U
1 9 2 9 D
5 18 5 19 R
2 8 1 8 U
5 19 5 18 L
5 3 4 3 U
4 15 3 15 U
1 4 2 4 D
1 13 1 12 L
5 17 5 16 L
4 19 4 18 L
3 19 3 18 L
5 4 5 5 R
4 10 3 10 U
3 15 4 15 D
1 3 2 3 D
3 3 3 2 ...

result:

ok answer 1

Test #149:

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

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 3 8 D
1 4 2 4 D
6 7 5 7 U
1 10 2 10 D
5 3 5 2 L
5 13 6 13 D
2 15 1 15 U
6 12 5 12 U
4 12 4 13 R
1 13 1 12 L
2 6 1 6 U
4 2 4 2 S
2 2 1 2 U
4 6 3 6 U
2 10 1 10 U
2 11 3 11 D
5 2 5 1 L
5 14 6 14 D
3 14 4 14 D
3 9 2 9 U
5 8 4 8 U
6 1 6 2 R
1 12 2 12 D
1 11 1 11 S
6 13 5 13 U
6 5 5 5 U
4 9 4 10 R
5...

result:

ok answer 1

Test #150:

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

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 6 1 U
6 6 6 7 R
1 7 2 7 D
3 8 3 7 L
5 1 5 2 R
6 1 6 2 R
6 5 5 5 U
4 1 5 1 D
1 5 2 5 D
4 3 3 3 U
3 7 4 7 D
3 9 4 9 D
4 11 5 11 D
6 4 7 4 D
1 6 2 6 D
6 13 5 13 U
7 5 6 5 U
6 14 6 13 L
4 14 3 14 U
6 12 5 12 U
2 1 1 1 U
7 7 7 6 L
5 6 6 6 D
5 5 5 6 R
6 10 6 11 R
4 7 4 8 R
5 2 5 3 R
6 2 6 3 R
4 5 3 ...

result:

ok answer 1

Test #151:

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

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 4 4 D
7 8 7 7 L
6 7 6 8 R
2 7 1 7 U
7 10 6 10 U
3 12 3 11 L
8 10 8 9 L
4 1 3 1 U
8 1 7 1 U
5 10 4 10 U
7 9 7 9 S
2 12 1 12 U
3 11 4 11 D
6 12 5 12 U
5 3 6 3 D
5 8 5 7 L
8 9 8 10 R
7 4 8 4 D
6 8 5 8 U
1 12 2 12 D
7 6 8 6 D
4 2 3 2 U
6 5 5 5 U
4 10 5 10 D
5 5 6 5 D
1 1 2 1 D
2 5 1 5 U
1 2 2 2 D
...

result:

ok answer 1

Test #152:

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

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 5 3 U
1 1 2 1 D
9 4 9 3 L
7 10 8 10 D
9 6 9 5 L
4 9 5 9 D
6 10 5 10 U
9 8 9 7 L
4 7 3 7 U
9 2 8 2 U
1 5 1 4 L
3 10 4 10 D
8 2 9 2 D
6 4 6 3 L
9 10 9 11 R
1 4 2 4 D
5 7 6 7 D
8 9 7 9 U
5 4 5 4 S
5 11 6 11 D
5 6 5 5 L
2 1 1 1 U
6 5 7 5 D
6 8 5 8 U
1 3 2 3 D
1 7 2 7 D
4 11 3 11 U
3 9 4 9 D
8 5 8 ...

result:

ok answer 1

Test #153:

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

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 10 S
9 2 9 3 R
6 5 5 5 U
7 2 7 2 S
10 7 10 8 R
5 5 6 5 D
1 9 2 9 D
5 10 5 10 S
1 7 2 7 D
1 10 2 10 D
7 6 8 6 D
9 8 9 7 L
10 10 10 10 S
2 2 1 2 U
7 9 7 9 S
5 4 6 4 D
3 4 4 4 D
5 9 6 9 D
9 9 8 9 U
5 3 6 3 D
10 2 10 1 L
3 3 4 3 D
8 7 7 7 U
6 3 5 3 U
6 10 7 10 D
10 9 10 9 S
10 5 9 5 U
7 4 8 4 D...

result:

ok answer 1