QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#481471#7222. The Great HuntinksamuraiWA 887ms9680kbC++239.0kb2024-07-17 06:24:092024-07-17 06:24:09

Judging History

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

  • [2024-07-17 06:24:09]
  • 评测
  • 测评结果:WA
  • 用时:887ms
  • 内存:9680kb
  • [2024-07-17 06:24:09]
  • 提交

answer

#include <bits/stdc++.h>
// cut here
#ifndef ATCODER_MAXFLOW_HPP
#define ATCODER_MAXFLOW_HPP 1
namespace atcoder {

namespace internal {

template <class T> struct simple_queue {
    std::vector<T> payload;
    int pos = 0;
    void reserve(int n) { payload.reserve(n); }
    int size() const { return int(payload.size()) - pos; }
    bool empty() const { return pos == int(payload.size()); }
    void push(const T& t) { payload.push_back(t); }
    T& front() { return payload[pos]; }
    void clear() {
        payload.clear();
        pos = 0;
    }
    void pop() { pos++; }
};

}  // namespace internal

}  // namespace atcoder

namespace atcoder {

template <class Cap> struct mf_graph {
  public:
    mf_graph() : _n(0) {}
    explicit mf_graph(int n) : _n(n), g(n) {}

    int add_edge(int from, int to, Cap cap) {
        assert(0 <= from && from < _n);
        assert(0 <= to && to < _n);
        assert(0 <= cap);
        int m = int(pos.size());
        pos.push_back({from, int(g[from].size())});
        int from_id = int(g[from].size());
        int to_id = int(g[to].size());
        if (from == to) to_id++;
        g[from].push_back(_edge{to, to_id, cap});
        g[to].push_back(_edge{from, from_id, 0});
        return m;
    }

    struct edge {
        int from, to;
        Cap cap, flow;
    };

    edge get_edge(int i) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        auto _e = g[pos[i].first][pos[i].second];
        auto _re = g[_e.to][_e.rev];
        return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};
    }
    std::vector<edge> edges() {
        int m = int(pos.size());
        std::vector<edge> result;
        for (int i = 0; i < m; i++) {
            result.push_back(get_edge(i));
        }
        return result;
    }
    void change_edge(int i, Cap new_cap, Cap new_flow) {
        int m = int(pos.size());
        assert(0 <= i && i < m);
        assert(0 <= new_flow && new_flow <= new_cap);
        auto& _e = g[pos[i].first][pos[i].second];
        auto& _re = g[_e.to][_e.rev];
        _e.cap = new_cap - new_flow;
        _re.cap = new_flow;
    }

    Cap flow(int s, int t) {
        return flow(s, t, std::numeric_limits<Cap>::max());
    }
    Cap flow(int s, int t, Cap flow_limit) {
        assert(0 <= s && s < _n);
        assert(0 <= t && t < _n);
        assert(s != t);

        std::vector<int> level(_n), iter(_n);
        internal::simple_queue<int> que;

        auto bfs = [&]() {
            std::fill(level.begin(), level.end(), -1);
            level[s] = 0;
            que.clear();
            que.push(s);
            while (!que.empty()) {
                int v = que.front();
                que.pop();
                for (auto e : g[v]) {
                    if (e.cap == 0 || level[e.to] >= 0) continue;
                    level[e.to] = level[v] + 1;
                    if (e.to == t) return;
                    que.push(e.to);
                }
            }
        };
        auto dfs = [&](auto self, int v, Cap up) {
            if (v == s) return up;
            Cap res = 0;
            int level_v = level[v];
            for (int& i = iter[v]; i < int(g[v].size()); i++) {
                _edge& e = g[v][i];
                if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;
                Cap d =
                    self(self, e.to, std::min(up - res, g[e.to][e.rev].cap));
                if (d <= 0) continue;
                g[v][i].cap += d;
                g[e.to][e.rev].cap -= d;
                res += d;
                if (res == up) return res;
            }
            level[v] = _n;
            return res;
        };

        Cap flow = 0;
        while (flow < flow_limit) {
            bfs();
            if (level[t] == -1) break;
            std::fill(iter.begin(), iter.end(), 0);
            Cap f = dfs(dfs, t, flow_limit - flow);
            if (!f) break;
            flow += f;
        }
        return flow;
    }

    std::vector<bool> min_cut(int s) {
        std::vector<bool> visited(_n);
        internal::simple_queue<int> que;
        que.push(s);
        while (!que.empty()) {
            int p = que.front();
            que.pop();
            visited[p] = true;
            for (auto e : g[p]) {
                if (e.cap && !visited[e.to]) {
                    visited[e.to] = true;
                    que.push(e.to);
                }
            }
        }
        return visited;
    }

  private:
    int _n;
    struct _edge {
        int to, rev;
        Cap cap;
    };
    std::vector<std::pair<int, int>> pos;
    std::vector<std::vector<_edge>> g;
};

}  // namespace atcoder

#endif  // ATCODER_MAXFLOW_HPP
// cut here
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int) a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
#define _3zlqvu8 ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

#define nare cout<<"No\n"; exit(0);

#define yare cout<<"Yes\n";

struct treelca{
	int n;
	vi seg;
	vec(vi) adj;
	int timer;
	vi tin,tout,tour,tourid,depth;
	treelca(int m,int root,vec(vi) neadj){
		init(m,root,neadj);
	}
	void init(int m,int root,vec(vi) neadj){
		n=m;
		timer=0;
		tin=tout=tourid=depth=vi(n,0);
		adj=neadj;
		dfs(root,-1);
		seg.resize(4*sz(tour));
		build(1,0,sz(tour)-1);
	}
	void dfs(int v,int par){
		tour.pb(v);
		tourid[v]=sz(tour)-1;
		tin[v]=timer++;
		for(auto u:adj[v]){
			if(u==par) continue;
			depth[u]=depth[v]+1;
			dfs(u,v);
			tour.pb(v);
		}
		tout[v]=timer++;
	}
	void build(int node,int l,int r){
		if(l==r){
			seg[node]=tour[l];
		}else{
			int m=(l+r)>>1;
			build(node*2,l,m);
			build(node*2+1,m+1,r);
			seg[node]=(tin[seg[node*2]]<tin[seg[node*2+1]]?
				seg[node*2]:
				seg[node*2+1]);
		}
	}
	int query(int node,int l,int r,int _l,int _r){
		if(l>_r or r<_l) return -1;
		if(l>=_l and r<=_r) return seg[node];
		int m=(l+r)>>1;
		int vl=query(node*2,l,m,_l,_r),vr=query(node*2+1,m+1,r,_l,_r);
		if(min(vl,vr)==-1) return max(vl,vr);
		return (tin[vl]<tin[vr]?vl:vr);
	}
	int ancestor(int from,int to){
		int tinfrom=tin[from],tinto=tin[to];
		if(tinfrom>tinto) swap(tinfrom,tinto);
		return query(1,0,sz(tour)-1,tinfrom,tinto);
	}
	int dist(int u,int v){
		return depth[u]+depth[v]-depth[ancestor(u,v)]*2;
	}
};

void slv(){
	int n;
	cin>>n;

	vec(vi) adj(n);
	rep(i,n-1){
		int u,v;
		cin>>u>>v;
		u-=1,v-=1;
		adj[u].pb(v),adj[v].pb(u);
	}

	vec(pii) a;
	rep(i,n){
		int s,e;
		cin>>s>>e;
		s-=1,e-=1;
		a.pb({s,e});
	}

	vec(pii) to(n,{-1,-1});
	vec(vec(pii)) adqry(n);
	treelca lca(n,0,adj);
	rep(i,n){
		auto [s,e]=a[i];
		int ho=0;
		if(s>0 and e>0){
			int up=lca.ancestor(s,e);
			if(up==s or up==e){
				if(lca.depth[s]>lca.depth[e]){
					swap(s,e);
				}
				adqry[e].pb({lca.depth[s],i});
			}else{
				ho=1;
			}
		}else{
			ho=1;
		}
		if(ho){
			to[i]={s,e};
		}
	}

	vi pns(n,-1);
	vi par(n);
	multiset<pii> mst;
	auto dfs=[&](auto self,int v)->void{
		int taken=0;
		for(auto u:adj[v]){
			if(u==par[v]) continue;
			par[u]=v;
			self(self,u);
			if(v==0){
				if(sz(mst)){
					if(sz(mst)>1){
						nare;
					}
					if(!taken){
						pns[(*mst.begin()).se]=v;
						taken=1;
						mst.clear();
					}else{
						nare;
					}
				}
			}
		}
		for(auto [d,x]:adqry[v]){
			mst.insert({d,x});
		}
		if(v==0 and taken and sz(mst)){
			nare;
		}
		if(sz(mst)){
			auto it=prev(mst.end());
			pii p=*it;
			if(p.fi>lca.depth[v]){
				nare;
			}
			pns[p.se]=v;
			mst.erase(it);
		}
	};
	dfs(dfs,0);

	vi usd(n);
	rep(v,n){
		if(pns[v]!=-1){
			usd[pns[v]]=1;
		}
	}

	int si=0;
	rep(v,n){
		if(to[v].fi!=-1){
			si+=1;
		}
	}
	const int src=2*n;
	const int sink=2*n+1;

	atcoder::mf_graph<int> g(2*n+2);
	rep(v,n){
		auto [s,e]=to[v];
		if(s!=-1){
			g.add_edge(src,v,1);
			g.add_edge(v,s+n,1);
			g.add_edge(v,e+n,1);
		}
	}

	rep(v,n){
		if(!usd[v]){
			g.add_edge(v+n,sink,1);
		}
		if(v){
			g.add_edge(v+n,par[v]+n,1e9);
		}
	}
	int cur=g.flow(src,sink);
	if(cur!=si){
		nare;
	}
	vec(vi) adqry1(n);
	for(auto e:g.edges()){
		if(e.flow==0) continue;
		if(e.from<n){
			int to=e.to-n;
			adqry1[to].pb(e.from);
		}
	}
	
	set<int> st;
	auto rfs=[&](auto self,int v)->void{
		for(auto u:adj[v]){
			if(u==par[v]) continue;
			self(self,u);
		}
		for(auto x:adqry1[v]){
			st.insert(x);
		}
		if(sz(st) and !usd[v]){
			auto it=st.begin();
			pns[*it]=v;
			st.erase(it);
		}
	};
	rfs(rfs,0);

	yare;
	rep(v,n){
		cout<<pns[v]+1<<" ";
	}
	cout<<"\n";
}

signed main(){
_3zlqvu8;
	slv();
}

詳細信息

Test #1:

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

input:

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

output:

Yes
7 10 8 1 3 2 5 6 9 4 

result:

ok 

Test #2:

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

input:

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

output:

No

result:

ok 

Test #3:

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

input:

100
19 1
49 19
13 49
5 13
98 5
27 98
76 27
38 76
67 38
14 67
75 14
44 75
9 44
45 9
82 45
57 82
16 57
18 16
37 18
3 37
50 3
42 50
32 42
60 32
48 60
10 48
90 10
93 90
25 93
94 25
78 94
51 78
40 51
86 40
85 86
23 85
87 23
83 87
7 83
28 7
88 28
2 88
56 2
47 56
79 47
97 79
95 97
39 95
73 39
55 73
8 55
46...

output:

Yes
21 75 98 73 34 92 86 95 59 70 49 41 71 9 77 79 69 67 60 13 4 66 74 94 50 16 29 84 58 20 25 39 42 6 55 36 88 22 8 2 27 78 10 24 37 43 64 56 23 100 33 47 83 76 44 90 19 62 5 26 81 82 45 53 97 11 65 61 51 12 99 72 14 15 38 32 18 68 85 87 89 48 54 40 35 96 3 93 31 63 80 91 57 17 46 52 7 30 1 28 

result:

ok 

Test #4:

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

input:

100
71 1
3 71
19 3
96 19
68 96
18 68
76 18
67 76
59 67
9 59
81 9
46 81
94 46
95 94
87 95
93 87
33 93
61 33
69 61
37 69
23 37
36 23
90 36
54 90
51 54
50 51
91 50
34 91
45 34
64 45
48 64
12 48
78 12
75 78
16 75
39 16
28 39
58 28
92 58
82 92
77 82
11 77
72 11
24 72
44 24
57 44
55 57
17 55
7 17
10 7
53 ...

output:

Yes
74 67 5 59 70 54 37 2 81 19 93 96 87 41 39 75 23 66 10 97 73 57 49 11 27 44 53 17 9 28 63 33 58 88 55 80 24 43 91 82 7 61 98 15 48 77 45 52 22 83 12 84 76 68 78 95 36 8 29 1 71 51 90 21 47 32 13 34 30 4 26 35 94 16 6 40 18 46 64 89 3 86 50 20 25 62 100 65 60 56 14 79 85 38 99 72 31 92 69 42 

result:

ok 

Test #5:

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

input:

100
29 1
3 1
41 1
87 1
86 1
35 1
67 1
45 1
84 1
4 1
16 1
26 1
64 1
53 1
69 1
57 1
6 1
43 1
100 1
21 1
79 1
80 1
54 1
2 1
99 1
81 1
59 1
97 1
74 1
75 1
71 1
44 1
34 1
88 1
65 1
31 1
66 1
85 1
8 1
47 1
24 1
42 1
30 1
82 1
51 1
58 1
93 1
52 1
72 1
17 1
20 1
40 1
36 1
9 1
78 1
62 1
61 1
89 1
33 1
76 1
9...

output:

Yes
29 3 41 87 86 35 67 45 37 84 4 16 26 64 53 69 49 57 5 6 43 100 21 79 95 80 54 2 99 81 59 97 13 74 75 71 44 34 88 12 65 31 66 85 8 47 24 42 30 82 51 58 93 52 72 17 20 40 36 9 78 62 50 61 89 33 76 94 98 56 60 10 32 39 55 73 90 63 68 11 27 96 7 23 91 25 77 15 22 46 18 70 83 38 28 19 14 92 48 1 

result:

ok 

Test #6:

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

input:

100
81 1
74 1
65 1
22 1
33 1
99 1
93 1
59 1
88 1
78 1
20 1
51 1
57 1
43 1
35 1
17 1
32 1
18 1
30 1
31 1
76 1
6 1
39 1
16 1
12 1
21 1
62 1
91 1
50 1
71 1
46 1
53 1
63 1
75 1
41 1
42 1
83 1
72 1
90 1
98 1
64 1
61 1
45 1
9 1
77 1
4 1
47 1
49 1
2 1
25 1
66 1
28 1
73 1
60 1
56 1
11 1
80 1
3 1
58 1
87 1
8...

output:

Yes
81 74 65 22 33 99 93 59 88 78 20 51 57 43 35 17 32 18 30 31 76 6 39 16 12 21 62 91 50 71 46 53 63 75 41 42 83 72 90 98 64 61 45 9 77 4 47 49 2 25 66 28 73 60 56 11 80 3 58 87 86 24 89 23 92 5 36 8 69 100 52 96 14 13 34 55 79 95 85 15 70 68 37 7 27 48 44 94 97 26 84 29 82 10 67 54 19 40 38 1 

result:

ok 

Test #7:

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

input:

100
11 1
91 11
99 91
63 99
59 63
97 59
52 97
49 52
29 49
23 29
30 23
88 30
6 88
45 6
47 45
22 47
70 22
90 70
76 90
60 76
93 60
36 93
27 36
100 27
24 100
65 24
9 65
87 9
17 87
18 17
84 18
72 84
10 72
78 10
54 78
95 54
58 95
51 58
66 51
42 66
21 42
67 21
41 67
15 41
55 15
50 55
96 50
86 96
43 86
44 43...

output:

Yes
21 63 71 97 99 52 29 1 44 57 77 23 30 36 70 59 37 31 24 48 84 90 86 38 47 95 34 87 60 76 54 27 56 55 25 91 41 72 74 58 51 22 68 79 96 67 11 7 46 33 88 66 32 49 89 50 65 61 6 17 45 39 53 40 19 83 12 20 92 28 82 9 98 5 94 3 4 10 80 14 13 93 85 100 8 73 35 69 64 81 2 18 42 62 26 16 75 43 78 15 

result:

ok 

Test #8:

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

input:

100
53 1
58 53
99 58
25 99
13 25
17 13
71 17
4 71
93 4
47 93
57 47
34 57
85 34
87 85
49 87
100 49
62 100
76 62
65 76
31 65
89 31
81 89
83 81
35 83
56 35
55 56
43 55
26 43
86 26
41 86
51 41
22 51
63 22
14 63
90 14
91 90
44 91
70 44
52 70
40 52
94 40
73 94
77 73
30 77
88 30
38 88
84 38
29 84
97 29
2 9...

output:

Yes
53 3 48 80 1 66 25 2 34 57 58 79 86 76 94 65 13 88 15 92 31 44 17 87 89 72 81 70 50 22 43 91 83 38 40 41 18 71 73 75 26 52 33 35 90 63 12 16 98 99 49 7 20 95 27 77 5 55 4 97 84 8 6 36 54 68 74 19 42 45 9 46 11 51 96 30 29 10 32 100 56 37 23 93 61 69 28 78 64 39 24 82 21 47 60 67 59 14 85 62 

result:

ok 

Test #9:

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

input:

100
64 1
88 1
8 1
18 1
65 1
47 1
21 1
100 1
58 1
6 1
97 1
55 1
20 1
90 1
95 1
34 1
51 1
94 1
85 1
98 1
72 1
19 1
68 1
32 1
69 1
44 1
25 1
49 1
29 1
30 1
23 1
10 1
53 1
99 1
70 1
93 1
33 1
75 1
92 1
41 1
60 1
27 1
87 1
43 1
3 1
61 1
96 1
81 1
24 1
7 1
78 1
66 1
91 1
28 1
82 1
84 1
2 1
45 1
37 1
17 1
...

output:

Yes
64 88 8 18 39 1 47 21 100 58 6 77 97 55 20 90 95 34 89 51 94 85 98 72 19 68 48 32 69 44 25 50 49 29 30 23 10 53 99 70 93 33 75 92 41 60 27 87 43 3 61 96 81 24 7 78 66 91 28 82 62 84 2 45 37 17 79 22 11 67 38 42 52 31 15 59 16 74 54 35 40 63 57 14 56 86 83 12 4 71 76 36 26 73 9 80 46 5 13 65 

result:

ok 

Test #10:

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

input:

100
83 1
7 1
67 1
89 1
99 1
27 1
24 1
41 1
25 1
51 1
3 1
26 1
61 1
87 1
73 1
23 1
75 1
69 1
48 1
63 1
94 1
84 1
97 1
43 1
93 1
47 1
55 1
71 1
31 1
2 1
90 1
6 1
91 1
46 1
13 1
80 1
54 1
32 1
50 1
28 1
57 1
77 1
22 1
29 1
95 1
8 1
68 1
86 1
65 1
30 1
34 1
36 1
70 1
92 1
21 1
42 1
40 1
19 1
52 1
56 1
7...

output:

Yes
83 7 67 89 99 27 24 41 25 51 3 26 61 87 73 23 75 69 48 63 94 84 97 43 93 47 55 71 31 2 90 6 91 46 13 80 54 32 50 28 57 77 22 29 95 8 68 86 65 30 34 36 70 92 21 42 40 19 52 56 74 20 78 11 14 4 38 100 49 96 66 60 85 37 12 79 5 98 53 35 62 16 18 33 59 64 76 15 45 72 9 58 81 88 82 17 10 39 44 1 

result:

ok 

Test #11:

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

input:

100
84 1
12 84
59 12
14 59
96 14
5 96
9 5
17 9
67 17
15 67
7 15
48 7
46 48
93 46
70 93
61 70
37 61
57 37
60 57
43 60
89 43
54 89
26 54
95 26
72 95
29 72
87 29
99 87
24 99
90 24
3 90
52 3
85 52
28 85
30 28
78 30
75 78
53 75
55 53
31 55
6 31
82 6
25 82
11 25
13 11
73 13
27 73
39 27
2 39
79 2
47 79
69 ...

output:

Yes
96 14 5 48 59 61 54 72 15 37 26 28 3 36 85 12 29 9 1 52 89 84 6 47 87 57 99 71 86 95 62 60 88 21 97 17 25 53 69 20 22 33 65 30 82 39 46 11 51 23 55 79 98 49 40 43 100 80 73 58 31 67 90 56 81 78 16 10 8 32 42 63 93 27 44 41 94 91 19 70 77 66 50 75 18 76 83 92 35 4 34 7 2 64 74 45 68 13 38 24 

result:

ok 

Test #12:

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

input:

100
16 1
93 16
89 93
60 89
87 60
70 87
92 70
97 92
15 97
40 15
39 40
42 39
73 42
71 73
12 71
84 12
96 84
17 96
48 17
55 48
50 55
38 50
19 38
28 19
90 28
25 90
27 25
22 27
45 22
76 45
2 76
57 2
81 57
10 81
46 10
41 46
51 41
78 51
56 78
9 56
31 9
98 31
86 98
91 86
77 91
5 77
66 5
64 66
61 64
49 61
14 ...

output:

Yes
1 89 60 87 93 70 42 20 12 25 92 73 84 48 27 22 45 41 51 31 46 40 56 2 55 57 54 76 3 86 5 71 96 38 39 26 83 61 98 9 11 19 6 82 34 64 97 28 15 4 24 16 33 63 23 91 43 36 14 10 100 17 90 13 44 94 68 72 32 52 58 99 62 85 37 21 18 66 74 80 67 78 50 59 47 49 95 75 7 88 53 35 30 29 65 8 69 79 77 81 

result:

ok 

Test #13:

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

input:

100
21 1
82 1
38 1
17 1
87 1
43 1
14 1
28 1
33 1
55 1
47 1
40 1
58 1
45 1
6 1
12 1
39 1
96 1
26 1
50 1
84 1
18 1
5 1
75 1
22 1
97 1
10 1
36 1
35 1
48 1
77 1
95 1
72 1
73 1
83 1
25 1
11 1
51 1
65 1
74 1
8 1
61 1
92 1
69 1
85 1
56 1
78 1
27 1
52 1
19 1
64 1
23 1
31 1
59 1
37 1
67 1
44 1
88 1
20 1
13 1...

output:

Yes
21 82 57 38 17 87 43 14 28 33 55 47 40 58 45 6 12 39 96 26 50 84 100 18 5 75 22 76 97 10 36 35 48 77 95 72 73 83 25 11 51 65 74 8 61 92 69 85 56 78 4 27 52 19 64 23 31 59 37 54 67 44 88 20 13 70 41 53 93 86 32 49 94 60 71 46 89 34 24 80 42 3 98 7 68 90 79 99 9 66 91 29 30 15 63 2 81 16 62 1 

result:

ok 

Test #14:

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

input:

100
30 1
90 1
42 1
55 1
9 1
18 1
62 1
35 1
63 1
89 1
17 1
32 1
36 1
19 1
95 1
12 1
29 1
47 1
8 1
70 1
75 1
81 1
28 1
79 1
71 1
56 1
85 1
39 1
58 1
21 1
65 1
26 1
24 1
31 1
86 1
69 1
91 1
77 1
22 1
100 1
78 1
67 1
92 1
93 1
87 1
14 1
98 1
99 1
73 1
37 1
84 1
94 1
46 1
11 1
82 1
97 1
66 1
50 1
44 1
72...

output:

Yes
30 90 42 55 9 18 62 35 63 89 17 32 36 19 95 12 29 47 8 70 75 81 28 79 71 56 85 39 58 21 65 26 24 31 86 69 91 77 22 100 78 67 92 93 87 14 98 99 73 37 84 94 46 11 82 97 66 50 44 43 72 51 74 13 45 57 6 27 20 53 96 5 15 61 48 3 33 7 41 2 34 4 83 23 10 40 25 49 76 59 68 88 52 54 16 38 80 64 60 1 

result:

ok 

Test #15:

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

input:

100
83 1
44 1
11 44
93 83
20 11
63 93
69 63
71 69
99 20
94 99
92 94
32 92
50 32
96 71
3 50
2 96
61 3
51 61
41 2
89 51
80 41
76 89
95 80
9 76
54 95
40 54
37 9
34 37
45 34
36 45
97 36
53 97
72 40
91 53
67 72
85 67
28 85
26 91
5 28
27 5
4 27
100 4
18 100
79 26
82 18
84 79
65 82
12 65
56 84
16 56
42 12
...

output:

Yes
20 44 9 97 76 99 67 36 10 25 72 82 45 65 90 89 52 12 49 100 59 18 31 33 77 62 4 39 22 27 5 21 55 35 19 43 28 64 17 42 75 51 48 66 94 50 14 30 34 61 37 53 3 63 1 57 26 68 86 87 85 79 40 6 73 54 95 13 80 23 56 41 8 38 88 78 29 58 32 92 2 74 91 16 70 24 96 46 47 15 81 98 71 7 84 69 60 93 83 11 

result:

ok 

Test #16:

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

input:

100
38 1
87 1
73 87
6 73
63 6
37 38
66 63
29 66
8 29
40 8
88 40
24 88
47 24
86 47
74 86
43 74
33 43
84 33
81 84
89 81
91 37
7 89
65 7
49 65
77 49
98 77
79 98
92 79
28 91
68 92
90 68
14 90
55 14
10 55
52 10
94 52
30 94
15 30
61 15
78 61
62 78
99 62
57 99
82 57
2 82
96 2
70 96
12 70
53 12
22 53
83 22
...

output:

Yes
4 86 47 13 88 40 50 85 32 87 97 10 99 27 52 8 24 16 84 79 29 72 57 96 66 7 42 74 26 35 33 44 61 76 25 80 39 56 58 11 82 75 36 34 2 64 23 78 37 65 70 49 12 60 71 54 81 9 46 41 45 63 69 90 53 21 92 20 77 55 43 59 6 94 73 93 95 62 5 89 98 18 22 19 3 67 14 17 83 31 51 48 28 91 30 100 15 38 1 68 

result:

ok 

Test #17:

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

input:

100
98 1
62 1
71 1
77 1
63 1
30 1
51 1
24 1
82 1
9 1
17 1
57 1
36 1
25 1
80 1
96 1
16 1
6 1
68 1
44 1
23 1
89 1
60 1
8 1
65 1
47 1
76 1
66 1
21 1
75 1
28 1
97 1
99 1
2 1
53 1
14 1
50 1
90 1
64 1
5 1
3 1
46 1
34 1
85 1
4 1
41 1
72 1
54 1
81 1
92 1
52 1
13 1
61 1
69 1
45 1
74 1
79 1
33 1
38 1
95 1
48 ...

output:

Yes
98 62 19 71 77 63 30 40 20 51 24 82 9 17 57 36 25 88 80 96 16 6 68 44 23 89 60 93 8 26 15 65 27 47 37 76 66 10 21 75 28 97 87 99 2 53 14 50 90 64 94 5 3 46 34 85 4 41 72 54 81 92 52 7 13 61 69 45 29 74 79 33 38 95 48 84 91 18 73 59 100 83 42 58 55 86 31 12 32 11 49 43 78 67 70 56 22 39 35 1 

result:

ok 

Test #18:

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

input:

100
58 1
26 1
6 1
51 1
91 1
80 1
89 1
35 1
22 1
57 1
41 1
75 1
48 1
72 1
17 1
67 1
30 1
61 1
79 1
98 1
43 1
3 1
81 1
63 1
25 1
27 1
87 1
90 1
11 1
100 1
66 1
84 1
45 1
20 1
47 1
36 1
14 1
54 1
88 1
38 1
55 1
68 1
50 1
74 1
2 1
82 1
70 1
83 1
37 1
93 1
53 1
16 1
85 1
23 1
71 1
21 1
34 1
15 1
78 1
86 ...

output:

Yes
58 26 6 51 91 80 89 35 22 57 41 75 48 72 17 67 30 61 79 98 43 3 81 63 25 27 87 90 11 100 66 84 45 20 92 47 36 14 54 88 38 55 68 50 74 2 82 70 83 37 93 53 16 7 85 8 23 71 21 77 34 39 15 78 86 33 59 52 44 18 5 73 99 19 9 96 10 60 24 65 29 62 49 40 42 31 97 69 4 76 56 12 64 28 94 95 13 46 32 1 

result:

ok 

Test #19:

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

input:

100
88 1
28 1
80 28
53 80
31 88
66 31
98 66
90 53
50 90
79 50
64 79
84 64
7 98
82 84
42 7
34 42
85 82
81 85
93 81
71 93
48 71
46 48
43 46
27 34
41 43
26 27
77 26
17 77
62 41
74 17
22 74
19 62
38 22
95 19
68 95
9 68
20 38
5 20
32 9
94 5
86 32
57 86
58 94
100 57
92 58
30 92
8 100
72 30
70 8
4 70
67 4
...

output:

Yes
5 20 92 72 58 34 43 40 94 35 46 99 10 44 52 48 71 49 14 38 22 24 3 25 93 90 13 73 74 17 30 97 75 51 18 50 54 61 89 77 36 81 47 83 56 91 53 37 21 84 80 41 62 19 9 82 85 4 95 32 57 7 64 68 33 1 8 39 100 26 67 27 45 65 70 42 31 86 79 63 12 28 96 11 76 98 6 15 29 16 66 59 23 69 2 55 88 60 78 87 

result:

ok 

Test #20:

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

input:

100
36 1
58 1
69 58
64 69
62 64
8 62
74 8
23 74
96 23
21 36
59 96
53 59
22 53
82 21
88 22
7 88
30 7
89 30
54 89
83 54
15 83
50 82
81 15
72 81
79 50
92 72
76 92
91 76
46 91
31 46
11 31
55 11
60 55
4 60
49 4
40 49
19 40
70 19
43 70
27 43
84 27
38 84
99 38
13 99
35 13
42 35
25 42
28 25
90 79
37 28
14 3...

output:

Yes
88 94 56 9 90 47 22 97 63 79 53 87 66 50 59 96 14 7 85 30 11 23 68 60 81 72 93 27 40 91 76 89 2 92 43 48 70 54 100 44 98 4 57 31 13 84 78 25 24 49 38 28 74 83 8 5 15 26 62 19 95 6 99 45 46 64 75 41 37 69 86 82 32 35 61 33 1 67 16 34 65 42 80 77 39 52 17 18 71 20 10 21 55 51 3 73 29 12 36 58 

result:

ok 

Test #21:

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

input:

100
53 1
74 1
64 1
27 1
67 1
5 1
35 1
95 1
57 1
8 1
21 1
9 1
99 1
42 1
41 1
81 1
90 1
50 1
49 1
71 1
17 1
28 1
33 1
18 1
52 1
97 1
26 1
73 1
31 1
79 1
87 1
88 1
76 1
56 1
3 1
39 1
63 1
4 1
80 1
19 1
54 1
6 1
65 1
13 1
94 1
38 1
7 1
40 1
29 1
2 1
70 1
47 1
32 1
98 1
61 1
25 1
10 1
55 1
77 1
82 1
11 1...

output:

Yes
53 74 64 27 36 67 5 35 66 95 57 8 21 43 9 99 15 42 41 60 81 90 50 49 71 17 28 85 33 96 18 52 97 26 73 31 79 45 87 88 76 56 3 23 39 63 4 80 19 54 51 6 65 13 94 38 7 40 29 44 2 70 20 47 32 24 98 61 12 25 10 55 77 82 11 16 84 58 89 34 37 46 14 59 100 69 93 62 78 22 83 75 30 68 48 92 91 72 86 1 

result:

ok 

Test #22:

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

input:

100
96 1
17 1
8 1
34 1
11 1
98 1
60 1
48 1
80 1
55 1
39 1
5 1
54 1
19 1
90 1
44 1
31 1
91 1
26 1
15 1
14 1
32 1
47 1
36 1
49 1
46 1
13 1
82 1
69 1
45 1
99 1
88 1
65 1
59 1
52 1
58 1
21 1
86 1
18 1
66 1
79 1
73 1
72 1
93 1
30 1
76 1
100 1
20 1
33 1
22 1
41 1
81 1
78 1
97 1
35 1
29 1
10 1
95 1
77 1
94...

output:

Yes
96 17 8 34 11 98 60 48 80 55 39 5 54 19 90 44 31 91 26 15 14 32 47 36 49 46 13 82 69 45 99 88 65 59 52 58 21 86 18 66 79 73 72 93 30 76 100 57 20 33 22 41 81 78 97 2 35 29 10 95 77 9 94 70 6 3 24 89 38 42 92 71 16 85 25 40 37 4 84 51 67 68 27 28 63 83 87 75 43 74 62 12 50 7 53 23 64 56 61 1 

result:

ok 

Test #23:

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

input:

100
76 1
88 1
19 76
51 88
46 19
47 46
20 51
9 47
33 20
80 33
28 9
12 28
81 12
10 81
17 80
43 10
24 17
89 24
65 43
97 65
73 97
37 89
75 73
54 37
92 75
66 92
13 54
58 66
16 13
41 58
71 16
68 41
59 68
38 59
14 71
78 38
30 14
27 30
36 27
42 36
8 42
77 78
91 77
7 8
95 91
100 7
98 100
82 98
34 82
99 34
35...

output:

Yes
10 43 65 73 75 1 81 89 91 12 77 35 59 41 28 92 68 66 49 52 70 44 32 16 78 26 5 23 79 18 9 38 88 97 56 40 67 25 58 62 3 74 61 55 95 13 54 48 57 37 24 27 17 36 69 42 80 100 45 83 96 21 8 94 98 7 34 82 33 99 29 30 71 50 15 84 72 60 85 20 64 90 93 47 2 86 51 46 87 11 6 53 31 63 4 39 22 19 14 76 

result:

ok 

Test #24:

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

input:

100
19 1
23 1
85 23
75 85
68 75
25 68
57 25
10 19
8 57
15 8
78 15
63 78
61 63
41 61
34 41
16 34
64 10
43 16
88 43
56 88
77 64
72 56
79 72
98 77
11 79
2 11
53 2
62 53
7 98
28 62
55 28
66 55
32 66
91 32
12 91
26 12
42 26
39 7
89 42
60 39
80 89
6 80
47 6
17 47
73 17
49 73
58 49
20 58
38 20
40 38
48 60
...

output:

Yes
64 60 77 10 98 7 39 96 48 37 31 19 50 25 57 68 78 34 63 11 32 8 91 75 43 6 59 49 17 28 61 26 62 87 2 16 67 41 58 55 69 12 85 38 33 73 47 36 88 79 56 76 40 83 65 24 42 93 84 35 1 44 54 9 20 74 97 13 29 30 71 89 45 95 72 66 80 52 70 100 81 4 14 51 22 46 5 94 21 92 53 18 82 86 90 27 3 15 99 23 

result:

ok 

Test #25:

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

input:

100
94 1
83 1
39 1
29 1
23 1
14 1
63 1
42 1
67 1
4 1
59 1
41 1
12 1
11 1
9 1
92 1
48 1
10 1
43 1
53 1
97 1
77 1
2 1
85 1
45 1
24 1
64 1
28 1
82 1
88 1
79 1
35 1
6 1
68 1
34 1
70 1
7 1
22 1
37 1
44 1
49 1
33 1
20 1
51 1
18 1
69 1
91 1
73 1
100 1
95 1
93 1
58 1
62 1
96 1
21 1
47 1
61 1
13 1
52 1
65 1
...

output:

Yes
94 19 26 30 83 39 29 23 89 55 14 63 42 67 71 4 59 41 12 17 11 9 92 40 48 75 99 10 43 53 97 77 2 85 45 24 64 28 5 82 88 79 35 6 68 34 70 16 7 22 80 37 44 60 49 33 20 51 18 69 86 91 73 100 95 93 58 62 96 21 47 61 13 52 65 27 90 32 81 8 84 38 31 87 15 54 3 36 50 78 56 57 25 46 74 98 72 66 76 1 

result:

ok 

Test #26:

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

input:

100
74 1
90 1
45 1
27 1
13 1
4 1
51 1
37 1
82 1
11 1
47 1
6 1
80 1
58 1
57 1
86 1
70 1
42 1
84 1
41 1
64 1
77 1
15 1
88 1
48 1
28 1
61 1
35 1
20 1
63 1
5 1
96 1
50 1
87 1
79 1
34 1
93 1
10 1
94 1
32 1
62 1
56 1
8 1
78 1
33 1
26 1
67 1
66 1
95 1
49 1
65 1
31 1
2 1
7 1
17 1
97 1
14 1
43 1
69 1
60 1
39...

output:

Yes
74 90 45 27 13 4 51 37 82 11 47 6 80 58 57 86 70 42 84 41 64 77 15 88 48 28 61 35 20 63 5 96 50 87 79 34 93 10 94 32 62 56 8 78 33 26 67 66 95 49 65 31 2 7 17 89 97 14 43 98 69 81 60 39 9 100 21 68 54 52 59 73 99 83 75 72 19 71 38 76 40 29 53 23 25 55 30 44 91 22 3 85 46 36 24 18 92 12 16 1 

result:

ok 

Test #27:

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

input:

100
80 1
97 1
81 1
77 97
44 80
54 77
55 81
18 55
22 54
15 22
17 44
89 18
12 89
60 12
86 60
56 15
2 56
35 86
5 17
83 35
58 2
93 58
36 83
72 36
99 72
3 99
9 5
30 93
21 9
90 3
63 90
8 30
67 8
31 63
78 67
26 78
14 31
47 21
73 14
94 26
52 94
53 47
50 52
92 73
29 50
38 53
51 92
100 51
34 38
33 34
82 33
16...

output:

Yes
92 38 25 52 94 73 86 14 33 96 43 84 20 82 88 54 78 32 19 22 93 7 50 41 1 65 98 16 39 67 56 34 49 47 90 8 76 6 30 68 40 31 46 63 85 3 64 29 36 18 53 27 26 62 10 21 71 55 24 48 100 70 72 99 35 4 51 15 23 66 83 60 9 87 13 42 5 17 75 12 58 89 95 2 77 59 91 45 61 44 69 37 57 28 11 79 80 74 97 81 

result:

ok 

Test #28:

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

input:

100
77 1
94 1
70 1
75 94
43 70
55 43
9 55
88 9
33 88
62 33
6 62
52 75
7 6
40 7
4 40
82 4
46 82
47 46
68 47
51 68
16 51
17 16
21 17
89 21
56 89
93 56
63 93
32 63
41 32
2 41
31 52
44 2
8 44
48 8
66 48
65 66
50 65
36 50
57 31
25 36
73 25
95 73
26 95
81 57
13 26
28 13
49 28
61 81
72 49
59 72
11 61
45 59...

output:

Yes
77 58 7 6 69 27 18 62 33 88 19 9 55 43 100 74 14 36 56 48 66 91 47 34 89 3 83 1 59 65 35 30 41 76 96 70 2 4 75 73 49 87 90 8 68 11 50 22 80 85 51 98 13 46 16 12 61 92 86 99 64 42 17 97 15 79 25 81 5 57 23 45 95 32 10 20 28 31 26 82 67 29 39 44 40 63 71 52 37 54 84 21 78 24 60 53 94 72 38 93 

result:

ok 

Test #29:

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

input:

100
68 1
92 1
87 1
38 1
78 1
20 1
3 1
21 1
75 1
19 1
99 1
16 1
12 1
85 1
22 1
18 1
61 1
70 1
37 1
84 1
74 1
24 1
69 1
72 1
42 1
26 1
25 1
35 1
54 1
8 1
31 1
46 1
15 1
62 1
29 1
28 1
57 1
51 1
11 1
82 1
39 1
49 1
56 1
9 1
17 1
93 1
14 1
77 1
81 1
50 1
86 1
40 1
45 1
91 1
52 1
43 1
97 1
76 1
6 1
27 1
...

output:

Yes
64 13 68 92 10 87 38 79 78 20 3 48 21 75 19 99 47 16 12 30 85 22 18 61 63 70 37 84 74 67 24 44 65 69 72 42 5 7 26 25 35 54 96 8 31 46 89 15 83 62 29 28 39 51 11 82 41 100 1 94 49 56 9 17 93 33 90 14 77 58 81 95 88 50 86 23 40 45 55 91 36 4 52 43 97 76 6 71 27 34 73 60 98 59 66 53 32 2 80 57 

result:

ok 

Test #30:

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

input:

100
89 1
10 1
59 1
74 1
5 1
72 1
44 1
41 1
68 1
32 1
15 1
20 1
92 1
4 1
50 1
54 1
33 1
45 1
76 1
27 1
94 1
55 1
17 1
91 1
47 1
43 1
48 1
84 1
100 1
62 1
37 1
16 1
39 1
83 1
64 1
85 1
93 1
69 1
87 1
77 1
23 1
49 1
7 1
53 1
95 1
14 1
86 1
3 1
22 1
58 1
82 1
38 1
90 1
71 1
25 1
75 1
34 1
11 1
60 1
80 1...

output:

Yes
89 10 59 74 5 72 44 41 68 32 15 8 92 4 50 54 33 45 76 27 94 55 17 91 47 43 48 84 100 62 37 16 39 83 64 85 93 69 88 1 77 23 49 7 53 95 96 14 86 3 22 46 19 58 82 21 40 38 98 90 57 71 29 25 2 75 34 11 56 60 31 80 12 97 18 36 51 61 67 26 13 24 35 87 73 81 66 78 30 70 65 42 52 79 99 28 9 63 6 20 

result:

ok 

Test #31:

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

input:

100
22 1
14 1
96 1
21 96
33 22
20 14
34 21
50 20
38 50
97 34
32 97
61 32
87 38
46 87
79 33
67 61
49 67
57 79
66 57
70 49
99 46
19 66
13 99
51 19
58 70
76 13
95 51
78 58
16 76
84 95
9 78
17 84
92 9
12 92
85 16
23 85
26 12
71 26
3 17
82 3
56 71
43 82
30 23
45 30
63 43
2 56
75 45
48 75
69 48
100 69
5 1...

output:

Yes
59 84 18 17 95 13 67 63 31 38 39 43 3 8 82 62 78 15 7 40 91 81 24 51 45 19 35 83 93 4 30 61 23 86 85 5 28 76 89 100 92 75 48 54 11 88 94 66 65 57 44 9 16 69 72 73 79 99 37 25 98 46 29 47 6 33 55 87 60 77 49 58 26 70 14 50 90 32 64 12 97 71 36 56 42 74 2 53 34 41 68 21 27 1 52 10 80 22 20 96 

result:

ok 

Test #32:

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

input:

100
63 1
49 1
20 1
76 20
51 49
95 51
5 76
66 5
26 66
83 26
61 83
13 61
24 13
94 24
75 94
19 75
54 95
68 19
29 68
56 29
32 56
85 32
9 85
4 9
28 4
64 28
90 64
81 90
30 81
87 30
7 87
96 7
18 96
12 18
42 12
40 54
17 40
98 42
80 17
84 98
14 84
25 14
59 80
48 59
82 25
36 48
27 82
43 27
57 36
86 43
35 86
3...

output:

Yes
63 55 48 95 59 26 41 80 36 38 57 100 76 34 93 74 45 52 17 2 40 66 33 67 5 83 10 94 75 61 20 70 47 13 85 9 89 16 28 78 64 37 79 29 7 19 56 42 14 96 25 30 84 4 58 73 81 88 69 50 82 31 77 46 54 15 98 24 18 8 92 11 44 65 97 27 43 53 87 51 86 90 12 22 71 1 3 32 39 35 23 60 99 91 72 49 6 21 62 68 

result:

ok 

Test #33:

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

input:

100
83 1
45 1
44 1
33 1
94 1
52 1
34 1
96 1
92 1
27 1
43 1
71 1
70 1
9 1
77 1
29 1
25 1
79 1
5 1
49 1
2 1
41 1
13 1
22 1
46 1
12 1
56 1
68 1
99 1
28 1
93 1
72 1
63 1
82 1
4 1
57 1
90 1
66 1
37 1
67 1
74 1
89 1
60 1
95 1
80 1
17 1
87 1
35 1
8 1
59 1
3 1
78 1
23 1
62 1
51 1
26 1
97 1
86 1
24 1
50 1
69...

output:

Yes
40 83 45 44 33 94 52 34 96 92 27 43 71 70 81 9 47 77 29 25 7 79 5 49 61 2 48 15 76 41 13 22 46 12 64 56 19 68 99 28 93 72 63 82 4 57 90 78 10 21 66 37 67 91 74 84 89 11 36 60 95 55 88 80 20 17 87 35 38 8 59 3 32 1 53 39 23 62 51 58 26 97 86 24 50 69 18 14 6 85 54 16 100 65 42 75 31 30 73 98 

result:

ok 

Test #34:

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

input:

100
30 1
58 1
36 1
7 1
10 1
14 1
67 1
100 1
73 1
42 1
53 1
57 1
97 1
61 1
69 1
71 1
26 1
63 1
22 1
12 1
86 1
59 1
81 1
24 1
32 1
5 1
54 1
28 1
46 1
45 1
96 1
65 1
6 1
90 1
38 1
29 1
72 1
80 1
31 1
34 1
2 1
77 1
41 1
64 1
40 1
25 1
78 1
51 1
66 1
17 1
50 1
3 1
39 1
93 1
74 1
48 1
79 1
55 1
16 1
33 1
...

output:

Yes
30 58 36 7 10 14 67 100 73 42 53 57 97 61 69 71 26 63 22 12 86 59 81 24 32 5 54 28 46 45 96 65 6 90 38 29 72 85 80 31 34 2 23 77 60 75 41 64 37 40 25 78 51 66 17 50 3 68 35 70 39 93 4 74 48 47 79 18 55 16 49 33 82 87 84 52 9 98 94 15 62 99 44 1 21 11 95 92 56 19 88 27 20 76 13 8 91 89 83 43 

result:

ok 

Test #35:

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

input:

100
69 1
8 1
80 1
5 8
86 80
60 86
34 69
42 5
11 34
10 60
12 11
56 10
44 56
16 12
74 16
3 44
43 3
99 74
97 99
48 42
23 97
78 23
81 78
39 43
26 81
24 39
65 48
82 24
61 65
19 26
7 19
52 7
87 61
31 52
57 87
29 57
49 31
21 29
75 82
6 75
64 21
96 64
27 96
14 27
93 14
47 6
83 47
37 49
18 93
79 83
71 18
15 ...

output:

Yes
99 97 16 78 74 53 81 23 77 54 31 12 26 11 19 30 7 52 90 91 9 35 34 94 84 58 49 17 37 36 55 69 33 89 42 5 48 65 61 21 87 100 93 14 57 64 18 92 46 2 29 96 68 71 50 32 13 27 66 45 95 73 72 98 1 59 10 86 43 60 24 39 8 56 6 38 82 28 47 75 15 25 4 51 88 67 83 44 85 70 3 22 79 20 62 76 63 41 40 80 

result:

ok 

Test #36:

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

input:

100
10 1
43 1
67 1
78 67
75 78
48 75
96 48
39 96
99 39
23 99
32 23
81 32
19 43
34 81
56 34
28 56
27 19
68 28
53 27
24 53
65 24
3 65
46 68
94 46
89 3
30 94
69 30
35 69
9 35
91 9
44 91
73 89
22 44
37 10
83 22
7 83
63 7
12 73
74 63
58 74
50 58
14 50
61 14
52 61
92 52
77 92
93 77
86 12
8 93
18 86
98 8
4...

output:

Yes
10 37 88 80 27 24 53 65 89 86 3 62 12 18 33 19 39 57 73 49 54 15 96 23 56 4 99 32 35 46 81 55 94 50 30 14 98 83 43 69 91 77 34 63 48 40 60 8 31 20 51 45 92 68 82 76 75 9 61 38 44 70 74 100 22 26 66 2 97 25 47 78 21 85 52 59 11 95 28 72 6 1 5 17 90 29 71 84 93 64 41 36 16 58 13 79 87 42 7 67 

result:

ok 

Test #37:

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

input:

100
100 1
24 1
99 1
41 1
3 1
87 1
73 1
18 1
53 1
31 1
61 1
82 1
84 1
62 1
16 1
4 1
95 1
57 1
36 1
96 1
94 1
12 1
69 1
32 1
78 1
97 1
20 1
27 1
83 1
33 1
5 1
64 1
23 1
44 1
60 1
70 1
2 1
79 1
47 1
14 1
39 1
13 1
45 1
71 1
17 1
74 1
58 1
28 1
49 1
21 1
55 1
56 1
76 1
35 1
38 1
66 1
15 1
77 1
22 1
88 1...

output:

Yes
100 24 99 41 3 26 87 73 18 50 53 65 10 31 61 11 75 82 84 62 16 4 95 57 67 36 96 94 12 69 32 78 97 20 27 42 83 33 5 64 72 23 44 29 8 60 70 89 2 46 79 86 47 14 39 68 63 13 98 45 71 30 91 17 80 74 37 58 28 49 43 21 55 56 76 81 35 6 38 66 15 77 54 22 88 52 51 93 7 90 25 85 34 48 59 9 40 19 92 1 

result:

ok 

Test #38:

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

input:

100
73 1
53 1
66 1
35 1
60 1
51 1
63 1
79 1
16 1
32 1
70 1
94 1
82 1
95 1
38 1
90 1
62 1
43 1
98 1
47 1
56 1
24 1
48 1
15 1
7 1
36 1
85 1
30 1
83 1
9 1
29 1
74 1
46 1
31 1
42 1
41 1
75 1
20 1
54 1
4 1
76 1
84 1
45 1
2 1
81 1
57 1
12 1
6 1
33 1
37 1
67 1
58 1
52 1
49 1
65 1
8 1
91 1
92 1
68 1
97 1
77...

output:

Yes
73 53 66 35 60 51 63 79 16 32 70 94 82 95 38 90 62 43 98 47 56 24 48 15 7 36 85 30 83 9 29 74 46 31 42 41 75 20 23 54 4 76 84 45 2 81 57 12 6 33 88 37 59 67 58 52 49 65 8 71 96 91 92 100 68 34 13 97 77 27 18 55 99 61 25 39 78 44 87 40 26 80 22 17 14 64 69 89 86 5 11 21 3 72 19 28 93 50 10 1 

result:

ok 

Test #39:

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

input:

100
78 1
69 1
62 1
95 1
30 62
35 69
43 30
82 35
58 95
52 78
54 43
68 54
85 82
51 52
2 51
94 58
48 94
45 2
27 85
14 68
56 14
31 56
76 27
66 31
57 76
72 57
98 45
60 48
89 60
84 72
53 98
79 84
44 79
92 66
39 92
7 44
74 39
61 53
93 7
11 93
59 11
41 74
6 41
5 89
34 6
42 34
83 42
3 83
22 59
100 3
40 5
67 ...

output:

Yes
46 74 28 66 97 44 11 55 96 79 60 39 9 23 7 19 92 82 13 93 22 63 61 67 71 20 25 59 84 72 47 10 17 50 64 36 75 45 4 1 12 51 32 80 18 52 78 99 31 94 3 90 26 56 14 21 86 68 54 58 6 83 34 41 49 100 35 73 42 70 15 65 43 48 40 30 2 91 5 53 77 8 76 89 69 24 37 62 98 16 81 27 38 87 33 88 29 57 85 95 

result:

ok 

Test #40:

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

input:

100
15 1
58 1
51 1
72 1
84 51
86 84
97 72
63 97
56 63
59 56
74 59
37 74
32 37
38 86
46 32
5 46
23 5
62 23
61 62
2 61
31 2
48 58
40 31
34 40
95 34
82 95
9 38
43 82
7 9
24 7
17 48
4 24
66 43
79 66
83 4
55 79
67 55
16 83
77 16
3 77
68 67
60 68
96 60
14 96
81 14
22 3
20 81
69 20
42 17
6 69
41 22
26 41
7...

output:

Yes
15 96 17 42 55 79 71 48 4 50 66 28 54 1 52 77 26 43 82 12 95 41 70 11 34 90 39 40 45 31 2 76 100 25 61 62 23 14 5 46 68 24 98 67 91 13 33 10 29 80 81 65 30 22 89 36 57 32 3 60 37 74 69 20 59 16 49 56 88 87 7 21 9 63 19 73 6 84 78 92 47 27 97 8 72 35 64 99 83 44 75 53 51 18 58 94 38 93 85 86 

result:

ok 

Test #41:

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

input:

100
39 1
29 1
28 1
63 1
37 1
3 1
82 1
32 1
92 1
16 1
65 1
56 1
5 1
30 1
78 1
81 1
60 1
99 1
21 1
17 1
96 1
93 1
27 1
45 1
85 1
51 1
35 1
25 1
13 1
86 1
91 1
38 1
48 1
94 1
33 1
98 1
87 1
4 1
70 1
95 1
97 1
69 1
80 1
2 1
8 1
61 1
59 1
15 1
44 1
41 1
58 1
54 1
52 1
34 1
36 1
53 1
12 1
19 1
57 1
9 1
7 ...

output:

Yes
39 29 28 63 37 3 89 71 7 20 32 92 16 65 77 56 5 72 50 30 78 23 62 81 60 99 21 17 96 43 93 83 14 27 45 85 51 18 35 25 13 88 86 91 38 48 6 94 33 98 40 74 87 4 64 70 42 12 73 97 69 55 80 75 84 2 95 8 66 61 22 46 59 15 90 44 49 41 58 79 26 68 24 54 52 34 36 53 31 82 11 10 67 19 76 57 9 100 47 1 

result:

ok 

Test #42:

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

input:

100
64 1
100 1
90 1
81 1
39 1
42 1
32 1
63 1
72 1
41 1
92 1
10 1
84 1
43 1
38 1
27 1
8 1
26 1
47 1
96 1
95 1
25 1
4 1
46 1
87 1
67 1
21 1
44 1
69 1
31 1
24 1
91 1
88 1
49 1
57 1
45 1
80 1
65 1
56 1
93 1
66 1
75 1
85 1
35 1
2 1
86 1
82 1
15 1
37 1
78 1
89 1
7 1
18 1
48 1
29 1
60 1
79 1
70 1
22 1
34 1...

output:

Yes
64 100 90 81 39 42 32 63 72 41 92 10 84 43 38 27 8 26 47 96 95 25 4 46 87 67 21 44 69 31 24 91 88 49 57 45 80 65 23 56 61 93 66 75 98 1 94 35 50 71 53 2 86 82 9 40 15 55 52 37 58 12 78 59 33 51 89 7 18 76 73 77 48 54 5 74 29 62 17 99 83 60 28 30 36 11 79 70 13 3 68 97 16 20 22 14 19 6 34 85 

result:

ok 

Test #43:

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

input:

100
46 1
65 1
24 1
73 1
52 46
38 52
59 65
74 38
86 24
12 59
92 86
83 74
34 92
88 73
6 34
32 83
89 32
56 89
68 6
53 56
13 88
15 13
99 53
47 99
54 47
93 68
3 12
70 15
33 54
11 3
45 33
41 70
36 93
27 36
9 45
81 27
7 41
18 7
40 81
82 9
50 82
2 50
66 2
28 40
61 66
96 28
4 18
94 11
8 61
79 8
58 4
17 94
72...

output:

Yes
46 56 62 73 82 37 1 16 49 9 60 12 67 40 2 61 50 87 22 8 80 79 25 77 84 57 78 76 43 48 7 45 23 95 71 59 66 14 20 65 72 42 86 19 94 21 26 97 33 5 51 83 17 53 55 74 54 85 28 89 93 27 11 96 47 36 99 31 81 30 32 44 69 39 63 68 91 6 75 34 38 3 100 10 13 15 90 64 41 52 18 58 4 35 92 70 88 98 29 24 

result:

ok 

Test #44:

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

input:

100
15 1
25 1
60 1
2 1
69 25
65 2
48 65
47 48
97 47
36 97
19 36
39 60
64 19
80 64
59 80
94 39
99 59
81 94
84 99
11 84
77 11
72 77
16 72
85 16
30 85
45 30
66 81
6 45
42 6
20 42
58 20
86 66
46 58
96 46
43 15
68 96
52 86
83 68
12 83
51 12
14 52
92 51
63 92
27 63
21 27
18 21
57 14
10 57
8 10
38 18
61 38...

output:

Yes
43 85 52 69 87 14 57 25 1 86 66 72 84 10 17 8 22 44 33 93 7 77 49 82 75 18 30 48 45 16 68 11 99 46 59 12 80 64 20 67 19 58 73 92 96 36 21 70 98 51 26 63 97 5 74 100 27 29 41 37 81 32 6 95 38 54 42 35 23 61 47 40 34 83 91 76 90 78 94 9 60 15 62 65 55 4 13 53 71 28 79 24 89 31 3 56 39 50 88 2 

result:

ok 

Test #45:

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

input:

100
21 1
63 1
8 1
9 1
50 1
75 1
86 1
15 1
51 1
13 1
11 1
26 1
27 1
10 1
59 1
98 1
7 1
91 1
23 1
17 1
82 1
53 1
18 1
52 1
67 1
89 1
88 1
87 1
61 1
55 1
22 1
41 1
72 1
81 1
65 1
20 1
60 1
37 1
92 1
69 1
99 1
80 1
66 1
44 1
34 1
70 1
36 1
68 1
90 1
78 1
97 1
46 1
62 1
4 1
100 1
47 1
74 1
25 1
5 1
16 1
...

output:

Yes
21 63 8 54 9 14 50 75 77 86 15 38 96 51 13 11 71 26 19 27 45 10 2 94 59 98 7 93 56 28 91 23 17 48 33 82 53 18 57 52 40 67 49 64 89 39 88 87 61 55 22 41 72 81 65 20 31 60 3 6 37 79 92 73 69 99 80 12 32 66 44 76 29 34 95 70 36 68 30 43 90 35 78 83 97 46 62 58 4 100 85 47 84 42 74 24 25 5 16 1 

result:

ok 

Test #46:

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

input:

100
65 1
44 1
11 1
59 1
49 1
54 1
39 1
28 1
68 1
5 1
55 1
62 1
90 1
30 1
4 1
78 1
53 1
69 1
43 1
76 1
12 1
60 1
58 1
34 1
48 1
51 1
20 1
42 1
52 1
72 1
64 1
10 1
13 1
80 1
91 1
2 1
35 1
16 1
99 1
66 1
97 1
75 1
84 1
40 1
85 1
57 1
45 1
33 1
86 1
56 1
36 1
46 1
98 1
82 1
15 1
94 1
38 1
100 1
17 1
77 ...

output:

Yes
65 44 11 59 49 54 39 28 68 5 55 62 90 30 4 78 53 69 43 76 12 60 58 34 48 51 20 42 52 72 64 88 74 10 13 70 93 80 91 2 35 16 87 26 99 32 66 97 75 95 84 40 71 85 14 63 57 61 45 7 27 22 33 86 3 56 36 92 24 67 96 31 81 23 46 98 1 25 6 41 15 94 8 73 19 29 89 18 38 50 100 47 37 83 17 77 9 21 79 82 

result:

ok 

Test #47:

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

input:

100
3 1
24 1
87 1
16 1
32 24
89 16
71 89
51 87
57 32
41 51
31 41
15 31
73 71
56 57
34 56
47 34
46 47
54 3
2 15
23 46
58 54
97 73
25 97
60 25
68 60
4 58
8 2
10 68
40 23
42 8
14 10
50 4
11 14
18 11
38 42
48 38
84 50
100 18
35 48
12 100
9 84
29 35
27 12
39 40
43 29
80 43
98 39
5 9
69 80
72 27
88 72
95 ...

output:

Yes
84 50 45 4 9 64 13 58 77 55 5 22 51 25 62 63 66 36 37 56 34 1 47 46 40 57 32 95 39 98 76 67 83 91 61 85 21 79 23 74 96 28 38 8 2 15 80 31 69 42 78 65 54 48 17 49 35 20 7 29 19 43 81 70 3 41 26 75 86 30 59 97 60 73 71 11 94 89 68 14 100 16 27 18 53 12 93 44 6 10 33 92 52 72 88 99 87 82 90 24 

result:

ok 

Test #48:

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

input:

100
85 1
58 1
90 1
98 1
39 98
91 90
52 39
41 52
16 91
47 41
9 47
11 9
37 16
44 11
70 58
71 44
86 37
54 71
33 54
62 33
13 62
66 13
61 86
60 61
28 60
17 66
38 17
35 38
96 35
45 96
68 45
8 68
80 28
14 8
95 14
76 80
31 76
78 31
93 95
48 93
21 48
3 21
83 78
100 3
82 70
23 83
67 100
32 67
20 23
53 32
24 2...

output:

Yes
85 58 82 70 36 51 37 56 16 31 78 61 23 86 9 60 18 83 6 28 80 57 1 59 75 25 76 19 94 24 20 77 46 99 47 11 71 38 54 96 4 44 14 33 62 13 27 41 93 3 7 35 53 21 66 88 10 45 100 67 32 52 81 50 22 55 91 17 29 63 48 15 30 79 5 2 95 84 90 87 39 69 34 68 12 72 97 64 8 73 43 74 92 49 42 89 40 26 65 98 

result:

ok 

Test #49:

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

input:

100
44 1
53 1
39 1
17 1
25 1
64 1
94 1
48 1
78 1
90 1
5 1
100 1
29 1
4 1
38 1
8 1
47 1
11 1
81 1
61 1
99 1
24 1
18 1
23 1
58 1
27 1
98 1
72 1
79 1
97 1
15 1
40 1
33 1
46 1
82 1
96 1
3 1
71 1
69 1
42 1
80 1
51 1
2 1
91 1
66 1
45 1
9 1
12 1
26 1
41 1
32 1
54 1
83 1
67 1
52 1
76 1
68 1
65 1
6 1
63 1
74...

output:

Yes
44 53 57 59 39 17 84 25 64 60 94 48 78 88 34 90 5 92 86 100 29 73 31 4 28 38 8 50 36 47 89 11 81 55 61 19 99 24 20 35 18 16 23 58 27 98 72 79 37 97 15 21 40 33 46 82 96 10 95 3 71 49 69 42 43 77 87 30 85 62 80 51 2 75 56 22 91 66 45 9 12 26 41 32 54 70 7 83 93 67 74 52 76 13 68 65 6 63 14 1 

result:

ok 

Test #50:

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

input:

100
91 1
36 1
31 1
74 1
56 1
28 1
5 1
77 1
39 1
42 1
16 1
23 1
45 1
9 1
100 1
57 1
24 1
79 1
97 1
88 1
73 1
3 1
48 1
90 1
59 1
4 1
89 1
67 1
63 1
32 1
94 1
80 1
33 1
15 1
26 1
92 1
58 1
66 1
41 1
49 1
35 1
93 1
95 1
68 1
27 1
21 1
85 1
81 1
7 1
96 1
50 1
86 1
99 1
87 1
61 1
51 1
11 1
43 1
78 1
25 1
...

output:

Yes
91 36 31 74 56 28 5 77 39 42 16 23 45 9 100 57 24 79 97 88 73 3 48 90 59 4 89 67 63 32 94 80 33 15 26 92 17 58 53 66 41 49 70 35 18 13 93 95 65 68 8 27 21 22 85 81 71 75 7 19 37 96 2 29 50 6 86 62 46 99 34 84 87 83 69 44 61 72 76 54 12 1 11 98 14 60 43 52 55 38 40 64 78 47 30 82 25 20 10 51 

result:

ok 

Test #51:

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

input:

100
5 1
87 1
83 1
98 1
34 1
75 1
64 1
69 1
21 1
39 1
12 1
49 1
10 1
47 1
67 1
81 1
14 1
59 1
68 1
90 1
70 1
52 1
48 1
66 1
72 1
60 1
55 1
86 1
54 1
4 1
22 1
42 1
16 1
56 10
43 47
50 64
2 16
32 87
46 72
95 56
88 55
19 59
20 2
36 14
85 43
57 69
79 67
18 12
63 42
82 48
76 19
15 34
62 88
74 36
97 46
44 ...

output:

Yes
5 91 87 77 3 32 83 9 92 29 98 53 34 15 65 41 75 64 28 50 57 69 21 24 39 93 95 18 49 56 17 74 10 43 85 47 45 89 79 72 61 81 36 2 14 80 58 8 46 84 76 19 59 40 11 68 90 35 99 60 52 94 48 23 82 100 66 37 33 97 73 25 12 55 62 88 51 42 86 96 26 27 7 54 38 31 44 6 78 4 22 13 30 71 67 63 16 1 20 70 

result:

ok 

Test #52:

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

input:

100
69 1
29 1
84 1
31 1
23 1
8 1
85 1
20 1
82 1
38 1
47 1
91 1
94 1
71 1
64 1
89 1
67 1
79 1
35 1
92 1
55 1
46 1
87 1
76 1
40 1
59 1
19 1
81 1
68 1
99 1
58 1
70 1
57 1
72 99
42 68
4 70
17 42
14 4
51 72
28 51
80 79
50 59
54 57
34 89
5 40
24 19
90 54
60 81
88 90
3 28
100 14
74 3
56 88
63 55
48 24
75 1...

output:

Yes
69 29 84 31 23 8 85 20 82 38 47 91 96 94 71 64 89 34 45 88 80 79 35 97 92 49 63 86 46 11 87 44 16 67 2 77 9 65 6 30 59 13 50 41 21 10 48 98 39 72 81 83 15 60 42 68 75 37 17 33 53 99 24 74 62 3 28 51 78 43 36 12 61 1 95 66 14 18 100 4 22 55 25 70 19 27 57 90 54 26 40 52 93 76 32 73 56 7 58 5 

result:

ok 

Test #53:

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

input:

100
5 1
57 1
84 1
52 1
51 1
16 1
47 1
2 1
10 1
62 1
36 1
44 1
70 1
30 1
26 1
98 1
38 1
21 1
55 1
68 1
92 1
97 1
12 1
86 1
64 1
89 1
6 1
4 1
63 1
49 1
82 1
94 1
73 1
43 73
3 63
77 49
48 21
85 77
17 3
18 85
14 6
88 86
61 12
46 18
54 61
13 46
45 13
96 97
50 4
8 17
100 43
19 8
23 26
15 89
74 100
28 96
3...

output:

Yes
5 57 84 52 51 16 47 2 10 62 36 44 70 30 23 26 98 11 38 48 21 55 68 92 28 96 90 97 61 71 78 54 3 88 27 4 73 69 64 95 19 74 56 41 1 35 15 53 6 50 25 40 80 65 20 22 66 67 63 34 100 8 81 17 86 91 72 45 46 33 13 18 99 59 85 77 93 82 75 31 29 58 43 76 79 9 32 87 60 7 37 49 42 12 14 83 39 24 89 94 

result:

ok 

Test #54:

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

input:

100
94 1
21 1
95 1
8 1
18 1
88 1
37 1
13 1
28 1
38 1
56 1
67 1
43 1
75 1
5 1
17 1
91 1
10 1
30 1
77 1
29 1
97 1
7 1
96 1
11 1
63 1
41 1
50 1
49 1
9 1
6 1
84 1
23 1
31 43
55 11
15 31
60 63
72 5
100 91
48 6
85 95
35 48
16 21
26 37
93 28
57 23
76 93
65 10
82 8
87 15
73 67
80 9
61 84
99 65
74 61
59 57
1...

output:

Yes
94 92 21 16 85 95 66 82 8 20 51 39 53 19 18 88 3 42 40 37 26 13 89 98 76 93 28 83 38 56 52 67 73 24 31 43 15 47 87 36 68 75 46 72 5 69 79 17 91 100 1 65 99 30 54 2 77 4 14 29 86 90 12 44 10 7 25 96 71 11 55 27 32 63 60 78 41 81 50 58 70 49 80 9 45 35 48 64 6 34 74 61 84 33 59 57 22 23 62 97 

result:

ok 

Test #55:

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

input:

100
89 1
98 1
88 1
67 1
53 1
48 1
78 1
19 1
35 1
40 1
47 1
28 1
46 1
11 1
21 1
71 1
60 1
97 1
80 1
33 1
42 1
12 1
76 1
62 1
92 1
13 1
95 1
75 1
17 1
50 1
66 1
49 1
52 1
84 62
57 52
82 75
23 66
9 49
3 9
94 57
25 17
87 82
83 3
16 23
31 50
15 83
18 94
91 92
29 18
38 15
64 87
96 31
73 29
5 73
99 95
74 5...

output:

Yes
89 98 88 67 53 48 78 19 35 40 47 28 46 11 21 71 41 60 97 80 86 33 37 42 79 56 12 76 69 64 4 3 100 92 91 77 90 26 62 95 99 6 87 13 39 82 17 24 34 7 25 1 54 9 65 96 58 10 81 45 31 72 75 59 8 20 68 27 61 16 94 23 55 70 66 83 50 85 14 38 51 5 44 63 15 18 74 29 73 57 43 22 49 84 2 32 30 52 36 93 

result:

ok 

Test #56:

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

input:

100
9 1
52 1
79 1
43 1
83 1
86 1
99 1
47 1
87 1
36 1
95 1
44 1
26 1
37 1
20 1
22 1
60 1
97 1
57 1
4 1
2 1
39 1
66 1
70 1
92 1
17 1
61 1
5 1
27 1
75 1
14 1
7 1
24 1
85 24
96 61
62 96
77 85
16 70
45 62
63 66
40 57
12 5
31 16
71 75
8 77
80 12
53 71
68 7
59 39
58 60
3 68
15 53
25 92
51 80
41 8
32 41
54 ...

output:

Yes
9 52 79 43 83 86 99 47 87 36 95 44 26 37 20 22 58 60 97 57 40 4 98 38 2 46 59 77 18 42 63 6 66 16 50 31 1 84 90 25 30 55 19 72 88 17 61 96 41 91 48 45 11 54 51 93 80 85 12 62 81 67 23 27 21 29 92 15 53 71 13 89 10 14 68 3 35 5 56 65 33 49 34 69 70 8 75 64 28 78 94 82 100 74 76 73 32 24 7 39 

result:

ok 

Test #57:

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

input:

100
99 1
34 1
70 1
26 1
86 1
94 1
67 1
25 1
61 1
66 1
73 1
38 1
87 1
49 1
21 1
3 1
52 1
100 1
54 1
76 1
58 1
8 1
44 1
6 1
40 1
55 1
29 1
77 1
59 1
31 1
65 1
81 1
69 1
95 59
28 69
48 3
85 65
12 81
22 99
14 48
24 25
71 70
56 40
27 31
78 58
79 78
82 71
13 82
23 79
17 49
72 77
97 66
83 56
33 67
36 85
43...

output:

Yes
22 32 1 93 34 53 71 70 82 13 19 10 26 64 86 94 7 84 5 33 20 67 25 43 24 51 39 91 61 97 66 42 88 73 62 46 89 38 87 49 17 9 21 48 14 63 3 52 100 16 98 47 92 50 15 54 57 76 4 58 78 11 79 23 37 41 8 44 60 6 40 83 56 80 55 35 29 96 77 72 2 95 59 31 74 27 85 36 68 65 81 90 12 18 30 45 69 28 75 99 

result:

ok 

Test #58:

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

input:

100
75 1
22 1
36 1
74 1
7 1
93 1
16 1
21 1
42 1
61 1
26 1
55 1
98 1
100 1
23 1
2 1
17 1
71 1
25 1
56 1
12 1
83 1
80 1
15 1
86 1
81 1
77 1
33 1
92 1
53 1
44 1
52 1
35 1
29 53
88 44
5 88
10 5
8 92
96 10
28 86
90 52
43 80
48 90
76 29
85 96
91 48
82 35
46 82
11 46
39 77
13 76
57 91
62 57
47 13
70 47
14 ...

output:

Yes
75 22 36 74 7 93 16 58 21 42 61 26 55 98 100 23 2 87 17 94 71 25 68 56 20 12 83 30 80 43 15 4 86 28 81 60 40 79 39 65 59 32 77 99 37 69 33 95 27 49 31 8 92 50 84 89 47 76 70 13 14 29 45 66 53 54 10 96 5 88 1 78 41 73 9 85 64 90 62 48 57 67 91 34 52 24 3 19 63 18 82 46 72 51 38 11 35 6 97 44 

result:

ok 

Test #59:

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

input:

100
52 1
75 1
5 1
62 1
23 1
74 1
28 1
7 1
68 1
49 1
26 1
44 1
4 1
100 1
43 1
59 1
33 1
17 1
24 1
89 1
12 1
77 1
32 1
96 1
55 1
18 1
6 1
88 1
81 1
92 1
3 1
99 1
46 1
22 99
67 88
70 67
14 3
48 22
76 14
41 92
69 46
60 69
37 76
27 48
97 41
39 37
8 27
38 39
80 6
73 8
78 38
36 60
66 73
50 66
31 18
65 80
5...

output:

Yes
52 75 5 62 23 74 28 7 68 49 26 44 4 100 43 59 33 17 24 89 12 56 40 77 10 32 51 61 96 72 87 9 91 55 31 18 65 71 47 45 80 57 13 6 11 54 76 42 63 64 30 70 67 93 81 41 35 97 21 92 94 86 15 39 38 37 78 14 2 95 82 84 3 1 98 20 73 8 27 48 22 99 66 50 85 25 29 69 60 36 79 16 34 53 90 19 58 46 83 88 

result:

ok 

Test #60:

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

input:

100
26 1
9 1
97 1
66 1
86 1
18 1
93 1
99 1
64 1
55 1
19 66
2 86
49 55
29 9
38 29
44 64
94 49
82 18
77 97
70 26
57 38
30 82
28 44
68 70
52 57
95 77
40 28
10 99
51 40
75 94
32 10
100 52
74 32
80 2
27 75
83 74
78 80
58 51
54 30
87 95
23 78
96 19
65 54
35 100
88 58
98 23
12 88
60 96
85 27
76 68
3 83
7 7...

output:

Yes
53 83 7 66 76 51 81 57 11 14 24 47 34 72 77 97 96 99 12 79 48 69 4 27 45 22 87 95 92 43 21 60 8 90 13 38 1 55 75 61 20 98 23 42 56 89 17 9 91 82 88 62 58 40 64 28 65 50 54 6 78 33 31 46 52 25 73 74 32 93 3 71 15 80 37 68 30 16 70 2 36 26 39 35 100 49 86 18 59 63 41 29 94 19 84 85 5 44 67 10 

result:

ok 

Test #61:

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

input:

100
54 1
71 1
100 1
9 1
19 1
78 1
41 1
75 1
84 1
38 1
28 75
96 38
40 96
39 84
83 40
79 39
17 79
24 17
97 24
99 97
49 28
35 99
95 49
62 35
45 95
31 62
59 41
2 83
89 31
86 89
32 2
37 32
14 86
61 78
60 37
36 14
91 60
57 91
13 57
47 36
85 47
64 13
68 85
46 19
90 68
52 45
15 52
76 64
81 76
77 90
25 77
92...

output:

Yes
54 71 100 9 69 79 20 92 61 26 78 53 40 8 63 37 13 17 57 45 10 11 83 29 4 18 44 94 86 42 5 30 93 85 66 52 35 55 31 89 46 15 7 34 77 65 25 68 76 73 88 90 21 16 12 23 32 19 50 95 51 56 80 67 96 38 49 62 43 59 70 39 48 84 47 98 81 99 1 74 64 41 6 91 58 60 28 22 82 87 97 75 72 3 24 2 36 33 27 14 

result:

ok 

Test #62:

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

input:

100
50 1
40 1
87 1
19 1
34 1
33 1
49 1
67 1
65 1
15 1
91 49
53 33
97 15
21 97
82 21
42 82
62 42
4 65
17 62
52 4
78 52
95 17
61 95
71 78
63 61
28 63
64 71
85 64
70 91
83 67
6 85
3 28
92 3
41 34
96 92
39 6
69 96
35 69
7 35
98 7
16 98
12 16
51 12
57 83
66 39
20 51
79 70
100 57
80 20
11 100
94 80
74 66
...

output:

Yes
50 40 87 19 34 41 33 59 29 73 30 14 63 95 16 55 89 39 58 96 99 25 71 27 48 81 11 9 72 90 26 100 65 74 93 37 20 67 6 70 23 66 32 92 21 15 17 75 60 3 18 28 5 51 61 45 31 77 2 62 57 98 35 7 85 68 54 10 46 12 64 78 52 88 86 4 94 8 79 47 80 84 43 69 24 42 53 44 56 38 76 22 83 91 36 49 13 1 82 97 

result:

ok 

Test #63:

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

input:

100
99 1
63 1
7 1
22 1
100 1
45 1
10 1
3 1
95 1
71 1
40 95
8 63
33 8
96 33
64 40
77 71
9 45
62 96
21 62
51 21
37 77
39 10
36 37
31 99
35 51
93 31
56 36
49 22
72 49
97 9
89 39
88 7
19 72
85 88
46 100
98 93
16 98
48 19
74 85
59 89
65 35
4 59
2 74
18 56
55 46
78 3
34 78
29 55
92 16
6 64
52 48
94 18
24 ...

output:

Yes
90 16 76 54 98 92 37 93 87 13 60 63 20 65 35 44 21 38 75 86 5 23 55 7 47 51 49 83 85 89 74 2 79 25 81 28 39 11 24 72 19 48 52 42 57 43 64 84 53 29 46 73 9 62 17 67 91 36 14 26 97 45 66 33 10 4 59 22 82 1 30 94 31 34 78 69 41 80 40 12 6 3 15 96 88 77 32 71 95 18 70 8 27 68 50 56 61 100 58 99 

result:

ok 

Test #64:

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

input:

100
81 1
100 1
17 1
43 1
10 1
29 1
34 1
25 1
21 1
4 1
60 4
6 29
68 60
51 25
93 6
18 21
24 68
90 24
73 18
26 73
12 90
86 51
64 26
47 64
72 12
80 72
7 80
40 47
96 7
84 96
48 84
63 86
15 63
67 40
92 48
32 67
28 32
57 92
75 28
79 75
20 57
23 79
78 23
19 78
36 20
30 19
62 15
45 36
87 62
31 45
35 31
83 35...

output:

Yes
81 100 17 43 10 65 7 6 93 41 89 55 71 13 53 63 2 5 62 92 30 42 70 36 11 76 91 64 20 56 39 98 51 79 61 23 75 78 48 96 28 19 32 88 67 44 40 16 80 66 27 87 86 47 95 72 77 1 9 90 45 57 83 84 49 26 12 59 24 74 8 73 46 99 54 3 34 25 37 33 31 18 21 68 60 38 85 82 97 22 14 50 15 58 4 69 94 52 35 29 

result:

ok 

Test #65:

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

input:

100
68 1
25 1
99 1
7 1
27 1
75 1
63 1
11 1
64 1
69 1
37 69
60 37
45 64
70 60
6 75
92 11
40 45
73 70
20 40
89 73
84 20
15 89
55 15
61 84
36 63
59 55
32 6
16 59
4 32
56 16
77 56
17 61
93 17
14 93
54 77
42 14
10 42
47 92
51 54
24 36
80 51
48 10
52 80
57 52
18 48
91 24
100 18
74 100
49 74
71 47
98 71
53...

output:

Yes
68 25 99 7 27 75 4 32 6 91 70 24 31 36 21 23 53 71 51 19 98 8 41 86 33 12 73 58 62 35 56 64 85 97 55 90 74 93 48 18 100 66 49 10 65 78 5 88 42 63 14 44 16 17 29 60 76 96 61 43 81 1 80 15 34 52 47 89 84 54 46 67 57 77 20 39 79 59 83 37 40 28 50 72 87 3 9 13 45 92 69 95 82 30 94 38 26 2 22 11 

result:

ok 

Test #66:

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

input:

100
92 1
72 1
62 1
21 1
10 1
47 1
17 1
50 1
5 1
51 1
2 62
24 21
69 2
77 51
18 24
23 50
75 18
27 72
85 92
76 75
14 5
64 77
53 10
60 17
66 27
52 69
88 53
43 14
34 88
11 47
46 64
67 66
22 34
25 43
41 76
82 22
13 67
65 11
80 41
9 80
79 65
70 85
19 79
56 70
93 13
30 60
90 46
99 25
20 99
44 19
42 44
40 42...

output:

Yes
92 85 70 56 31 73 89 55 87 4 67 13 66 63 100 27 72 29 93 83 62 2 69 52 32 18 24 75 76 80 41 9 61 58 59 35 21 98 71 54 81 53 88 48 45 8 82 22 34 10 19 79 1 65 44 40 11 6 57 28 78 42 38 12 94 97 16 60 17 30 95 39 68 7 91 50 33 36 3 23 96 14 5 37 99 43 25 20 49 15 74 84 46 64 77 90 47 86 26 51 

result:

ok 

Test #67:

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

input:

100
25 1
56 1
78 1
40 1
64 1
26 1
48 1
83 1
58 1
62 1
69 83
93 62
90 58
63 90
52 63
12 69
91 93
92 52
9 91
6 9
2 6
57 92
39 2
46 57
88 48
87 39
8 12
99 87
97 46
45 99
82 8
28 64
81 82
38 40
20 81
59 97
11 45
36 59
49 20
24 11
60 24
19 36
33 49
54 19
96 60
17 96
84 17
32 84
70 88
68 32
61 54
43 61
14...

output:

Yes
25 56 78 38 40 64 28 26 29 70 88 48 74 13 83 69 8 1 49 81 20 77 82 12 33 67 3 23 80 57 92 46 97 54 59 52 63 43 53 36 90 61 7 31 65 10 58 19 37 85 100 62 2 96 39 24 68 17 11 87 14 99 72 16 6 27 95 21 84 41 98 79 22 35 5 71 51 32 73 45 18 42 9 60 75 86 15 76 44 34 50 47 91 89 66 30 94 93 4 55 

result:

ok 

Test #68:

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

input:

100
13 1
16 1
50 1
76 1
62 1
39 1
17 1
26 1
41 1
29 1
35 41
77 29
8 17
14 77
88 14
79 35
86 79
19 88
25 19
55 25
5 86
47 55
97 47
43 97
49 26
28 43
20 28
57 20
70 5
59 70
93 57
40 93
82 49
46 8
6 40
34 82
75 59
68 39
53 6
66 53
84 66
72 75
37 84
100 37
90 100
60 90
4 60
65 68
87 34
3 87
69 72
32 69
...

output:

Yes
13 16 50 76 62 68 65 67 39 96 2 17 45 46 8 92 49 34 87 55 42 3 98 78 82 31 56 59 5 72 54 75 69 70 15 86 11 52 48 79 30 95 27 38 71 44 32 89 1 25 19 40 97 88 14 7 6 20 53 4 74 66 94 43 26 18 10 90 33 23 12 84 80 77 21 61 29 24 37 85 58 91 100 73 63 57 47 83 9 60 36 35 28 99 81 64 22 93 51 41 

result:

ok 

Test #69:

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

input:

10000
8285 1
5274 8285
925 5274
6279 925
1629 6279
593 1629
6906 593
2783 6906
2772 2783
2356 2772
8811 2356
8061 8811
5384 8061
9147 5384
6687 9147
2277 6687
4413 2277
8369 4413
6178 8369
9328 6178
7069 9328
5822 7069
8903 5822
2405 8903
7267 2405
301 7267
4655 301
3854 4655
6031 3854
9986 6031
388...

output:

No

result:

ok 

Test #70:

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

input:

10000
1985 1
6714 1985
3491 6714
8283 3491
3834 8283
428 3834
6210 428
3475 6210
4076 3475
2725 4076
3895 2725
789 3895
8096 789
219 8096
9077 219
672 9077
9958 672
7902 9958
1629 7902
9851 1629
4118 9851
8962 4118
1083 8962
7406 1083
6775 7406
8666 6775
1924 8666
8378 1924
3823 8378
3485 3823
6634 ...

output:

No

result:

ok 

Test #71:

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

input:

10000
5230 1
3501 1
186 1
534 1
6547 1
807 1
5407 1
6108 1
3005 1
7908 1
7694 1
410 1
4717 1
617 1
9745 1
7587 1
2657 1
3754 1
98 1
7150 1
7103 1
3002 1
8670 1
7882 1
5989 1
2462 1
3948 1
7396 1
9041 1
1449 1
2602 1
8688 1
7366 1
2193 1
6594 1
9830 1
9402 1
8094 1
7659 1
9635 1
1379 1
8722 1
2187 1
...

output:

Yes
5230 3501 186 534 6547 807 5407 6108 3005 7908 7694 410 4717 617 9745 7587 2657 3754 98 7150 7103 3002 8670 7882 5989 2462 3948 7396 9041 1449 2602 8688 7366 2193 6594 9830 9402 8094 7659 9635 1379 8722 2187 8637 7735 6187 588 3859 2615 511 9839 59 1900 4862 5157 6044 1412 1575 9385 112 8194 244...

result:

ok 

Test #72:

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

input:

10000
7754 1
3415 1
9786 1
3269 1
3938 1
4680 1
8676 1
7067 1
1079 1
8101 1
1490 1
6306 1
808 1
6003 1
2748 1
9129 1
8509 1
7081 1
7668 1
5179 1
4113 1
1411 1
3169 1
206 1
7234 1
9263 1
7877 1
5388 1
4764 1
637 1
7089 1
4357 1
3952 1
8067 1
6222 1
8652 1
7066 1
8475 1
5963 1
3496 1
6013 1
4206 1
793...

output:

Yes
7754 3415 9786 3269 3938 4680 8676 7067 1079 8101 1490 6306 808 6003 2748 9129 8509 7081 7668 5179 4113 1411 3169 206 7234 9263 7877 5388 4764 637 7089 4357 3952 8067 6222 8652 7066 8475 5963 3496 6013 4206 7932 4474 3866 7031 3262 9554 5476 2471 51 3742 6547 8223 1215 5171 4467 7189 3731 8264 5...

result:

ok 

Test #73:

score: 0
Accepted
time: 13ms
memory: 8344kb

input:

10000
1626 1
2160 1626
6051 2160
9515 6051
4912 9515
8661 4912
5657 8661
5109 5657
936 5109
3363 936
9242 3363
7877 9242
9374 7877
4128 9374
1441 4128
6657 1441
1583 6657
8601 1583
1759 8601
638 1759
7661 638
9377 7661
4039 9377
2557 4039
6912 2557
2019 6912
7965 2019
4662 7965
8310 4662
1579 8310
9...

output:

Yes
5186 3051 9993 1 7426 638 1579 2237 2142 6170 7434 5070 5892 4025 7614 894 3370 2446 9074 7974 8144 6463 5902 1440 9648 1583 6313 4462 6436 5887 353 3699 2500 8284 8464 4210 1119 4679 9795 8240 6602 8661 6304 3089 2620 7661 602 4957 2534 7042 4912 8321 6411 4109 964 9126 3960 9439 7594 8338 2773...

result:

ok 

Test #74:

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

input:

10000
1063 1
7709 1063
9176 7709
8475 9176
8010 8475
6050 8010
2560 6050
8443 2560
7064 8443
4686 7064
2807 4686
255 2807
2714 255
428 2714
5129 428
2363 5129
2419 2363
9175 2419
8947 9175
823 8947
8532 823
5412 8532
140 5412
1794 140
2090 1794
4491 2090
9274 4491
3089 9274
6883 3089
1578 6883
6157 ...

output:

Yes
8010 8558 6050 3070 417 2603 1695 4326 687 140 9394 428 1022 2518 7645 7221 816 1196 1886 240 9241 86 1977 6087 2767 4491 4121 2331 4343 3873 4319 9801 6025 5443 6214 2142 6912 6763 2036 2705 1024 2677 6286 2454 8547 8952 5210 2006 9398 4412 4392 5129 7784 5528 2870 9274 7167 4686 4802 1510 4748...

result:

ok 

Test #75:

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

input:

10000
52 1
1236 1
2612 1
4025 1
7647 1
8945 1
8005 1
3507 1
6149 1
1364 1
4277 1
7402 1
9669 1
734 1
6982 1
8804 1
5257 1
6146 1
5518 1
8259 1
1398 1
6550 1
1362 1
4109 1
6898 1
3529 1
6876 1
5087 1
5258 1
7682 1
5826 1
7925 1
7689 1
4496 1
8410 1
1404 1
743 1
3016 1
9269 1
2183 1
6584 1
2494 1
9314...

output:

Yes
52 1236 2612 4025 7647 8945 8005 3507 6149 1364 4277 7402 9669 734 6982 8804 5257 6146 5518 8259 1398 6550 1362 4109 6898 3529 6876 5087 5258 7682 5826 7925 7689 4496 8410 1404 743 3016 9269 2183 6584 2494 9314 954 8680 9692 5542 301 3668 5126 1800 7685 6891 8052 1713 7809 7994 1376 3424 5904 52...

result:

ok 

Test #76:

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

input:

10000
183 1
5107 1
9584 1
5745 1
1889 1
6282 1
8157 1
7251 1
3265 1
9800 1
3981 1
7570 1
992 1
6501 1
5620 1
1995 1
49 1
9267 1
7493 1
1514 1
8961 1
630 1
2289 1
4262 1
6147 1
8512 1
5241 1
1556 1
8273 1
2777 1
7319 1
4548 1
863 1
1044 1
180 1
5825 1
4726 1
4017 1
5897 1
5624 1
5475 1
391 1
637 1
54...

output:

Yes
183 5107 9584 5745 1889 6282 8157 7251 3265 9800 3981 7570 992 6501 5620 1995 49 9267 7493 1514 8961 630 2289 4262 6147 8512 5241 1556 8273 2777 7319 4548 863 1044 180 5825 4726 4017 5897 5624 5475 391 637 5484 1864 178 3450 2329 3615 6593 6585 9364 3923 4766 7195 9935 4795 2300 4868 7040 3079 6...

result:

ok 

Test #77:

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

input:

10000
5655 1
7163 5655
7130 7163
9895 7130
131 9895
6890 131
4212 6890
3056 4212
362 3056
1170 362
2491 1170
8377 2491
5830 8377
7164 5830
325 7164
9764 325
2095 9764
9101 2095
9182 9101
6740 9182
7011 6740
3989 7011
5996 3989
6677 5996
1604 6677
6705 1604
7119 6705
3530 7119
4675 3530
6995 4675
925...

output:

Yes
4212 3056 6890 325 4675 131 6995 1600 9079 6207 362 7011 9257 324 9339 4418 9997 2316 9764 5075 5100 9895 5132 9746 9612 3202 7202 4443 4428 717 2742 497 7142 8514 7529 767 6039 5350 4315 5689 3381 4914 8108 4240 7680 2440 2892 2095 6630 809 4491 8759 4311 6711 1340 471 1852 2790 7861 8895 6354 ...

result:

ok 

Test #78:

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

input:

10000
262 1
4219 262
5287 4219
2093 5287
3553 2093
4075 3553
6456 4075
2468 6456
8490 2468
5491 8490
8342 5491
8976 8342
7644 8976
576 7644
2700 576
4839 2700
7965 4839
2169 7965
6105 2169
1173 6105
9016 1173
3162 9016
923 3162
1199 923
1691 1199
1367 1691
8158 1367
1957 8158
3470 1957
9937 3470
783...

output:

Yes
8342 8976 9016 3162 3500 7644 7504 1691 4172 7833 576 2747 2700 46 2526 1367 7163 4347 669 8793 8709 9773 9889 923 9935 181 7561 430 4496 9329 197 4735 7653 5663 3588 5234 3646 972 4084 3364 4227 2475 2321 727 3663 7793 8550 7851 7597 1965 6724 4576 2032 4839 821 1138 5960 4653 2170 5491 6364 72...

result:

ok 

Test #79:

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

input:

10000
5693 1
8407 1
684 1
2937 1
4972 1
9264 1
6885 1
121 1
5814 1
7354 1
361 1
5377 1
5388 1
9161 1
473 1
1618 1
573 1
7902 1
5404 1
8223 1
6086 1
4937 1
3466 1
7729 1
5127 1
676 1
7192 1
4209 1
5522 1
3005 1
5533 1
131 1
3059 1
253 1
724 1
8006 1
8986 1
7036 1
5255 1
6495 1
6834 1
7056 1
840 1
60 ...

output:

Yes
5693 8407 684 2937 4972 9264 6885 121 5814 7354 361 5377 5388 9161 473 1618 573 7902 5404 8223 6086 4937 3466 7729 5127 676 7192 4209 5522 3005 5533 131 3059 253 724 8006 8986 4775 7036 5255 6495 6834 7056 840 60 2777 2716 8448 1113 5338 8763 9153 9621 5981 3732 1540 1048 4029 7510 6545 9444 832...

result:

ok 

Test #80:

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

input:

10000
8518 1
6511 1
5792 1
1024 1
8602 1
3999 1
3164 1
6473 1
460 1
5783 1
1406 1
602 1
4905 1
3669 1
6882 1
3190 1
7074 1
5220 1
4455 1
2362 1
3671 1
6869 1
9553 1
7035 1
1356 1
255 1
3047 1
6089 1
4304 1
5609 1
5736 1
2843 1
6803 1
4943 1
6040 1
7643 1
5654 1
5632 1
2612 1
4734 1
7519 1
9672 1
401...

output:

Yes
8518 6511 5792 1024 8602 3999 3164 6473 460 5783 1406 602 4905 3669 6882 3190 7074 5220 4455 2362 3671 6869 9553 7035 1356 255 3047 6089 4304 5609 5736 2843 6803 4943 6040 7643 5654 5632 2612 4734 7519 9672 4010 250 2372 9766 7113 5559 5768 1542 5649 9403 5447 8159 5808 7497 9913 349 9128 6176 7...

result:

ok 

Test #81:

score: 0
Accepted
time: 887ms
memory: 8832kb

input:

10000
9246 1
7433 1
64 9246
4654 7433
1898 64
2120 1898
3869 2120
4305 4654
6589 4305
3865 3869
6209 3865
7312 6589
2125 6209
7876 2125
3980 7876
7161 7312
5214 7161
3648 3980
3288 5214
9996 3288
8192 3648
9267 9996
7953 9267
5868 8192
1558 5868
3753 7953
7172 3753
8098 7172
7671 8098
3289 1558
8072...

output:

Yes
6123 263 5010 3712 4768 4314 8100 9292 5863 5817 6008 7220 8647 6506 6817 2891 6094 6046 5007 7725 9662 4490 3100 4046 6197 7628 4079 6073 1256 4457 7577 9065 3200 797 4864 5876 3945 8357 8823 869 5248 6584 5938 6091 3911 2868 7289 9612 5240 8900 9248 2512 8396 6381 7159 6905 7960 9496 6452 8821...

result:

ok 

Test #82:

score: 0
Accepted
time: 374ms
memory: 8940kb

input:

10000
9869 1
1294 1
1599 1294
9493 1599
7496 9493
1169 7496
2315 1169
7701 2315
2557 7701
5818 2557
1061 5818
9041 1061
6196 9041
7095 6196
1977 7095
2601 1977
5967 2601
1121 5967
283 1121
9173 9869
3977 283
4337 3977
1030 4337
4688 1030
4569 4688
2000 4569
9938 2000
6631 9173
4565 9938
3309 4565
24...

output:

Yes
1630 6299 1737 9060 2962 9452 5256 1054 4131 8307 8780 4455 4903 1166 292 1966 3671 1877 9160 2649 6692 8572 1526 4185 4103 204 4421 7039 6720 5269 5588 5056 4806 4106 1941 108 8260 2576 8296 7154 9550 1806 2607 6269 533 9975 3104 9428 7556 9144 8695 8080 8592 4656 1558 7824 5964 620 6745 689 47...

result:

ok 

Test #83:

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

input:

10000
5386 1
5551 1
3526 1
4007 1
5312 1
6705 1
1244 1
1954 1
5605 1
7194 1
6840 1
3575 1
4713 1
8036 1
896 1
4940 1
1736 1
8000 1
6735 1
77 1
5188 1
4026 1
7144 1
448 1
4140 1
6949 1
7397 1
4764 1
2287 1
2826 1
4045 1
6455 1
3078 1
2303 1
6342 1
3914 1
3746 1
5859 1
3638 1
1687 1
9532 1
4923 1
6216...

output:

Yes
5386 5551 3526 4007 5312 6705 1244 1954 5605 7194 6840 3575 4713 8036 896 4940 1736 8000 6735 77 5188 4026 7144 448 4140 6949 7397 4764 2287 2826 4045 6455 3078 2303 6342 3914 3746 5859 3638 1687 9532 4923 6216 592 4213 2192 3023 5678 4216 43 3971 9773 4055 5848 8785 8025 3819 8090 1239 5293 894...

result:

ok 

Test #84:

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

input:

10000
4529 1
6877 1
7360 1
8666 1
219 1
6010 1
4996 1
4212 1
5390 1
4939 1
5847 1
5434 1
2688 1
2564 1
5901 1
1395 1
2871 1
1973 1
5470 1
6465 1
8594 1
2999 1
136 1
2772 1
6831 1
3192 1
5732 1
9093 1
3748 1
8832 1
6874 1
9108 1
7946 1
6165 1
5251 1
4971 1
2730 1
3964 1
2451 1
3336 1
671 1
6990 1
713...

output:

Yes
4529 6877 7360 8666 219 6010 4996 4212 5390 4939 5847 5434 2688 2564 5901 1395 2871 1973 5470 6465 8594 2999 136 2772 6831 3192 5732 9093 3748 8832 6874 9108 7946 6165 5251 4971 2730 3964 2451 3336 671 6990 7133 2920 7916 8717 3414 6253 1371 4676 7580 3826 4803 5107 4690 6139 8415 6812 7395 4743...

result:

ok 

Test #85:

score: 0
Accepted
time: 606ms
memory: 8588kb

input:

10000
9442 1
3365 1
5470 3365
1531 9442
2286 5470
3435 1531
6149 3435
8191 6149
5362 2286
4180 8191
4547 5362
5899 4547
58 5899
9468 58
8640 9468
6465 8640
3488 4180
6277 3488
9041 6277
812 6465
8024 812
9088 8024
9215 9041
4580 9088
1917 4580
7204 1917
3205 9215
3285 3205
7230 7204
9552 7230
6808 9...

output:

Yes
9178 8926 1277 9555 1 5242 2841 2638 1688 9414 2769 6078 365 5654 3307 4245 9232 1503 1032 2502 8268 7053 4297 1870 9903 6940 836 4675 4684 3405 7906 7407 6551 977 3339 5516 314 8022 9274 8934 732 1362 1335 8699 9139 5100 2813 3780 6949 9149 1496 4613 9569 9484 6117 130 1566 855 2201 4044 3185 4...

result:

ok 

Test #86:

score: 0
Accepted
time: 229ms
memory: 8564kb

input:

10000
2368 1
7613 1
644 7613
521 2368
379 521
5149 644
2106 5149
8659 2106
4644 8659
5501 4644
1554 5501
4971 1554
6280 4971
7633 6280
7212 7633
9241 7212
7481 9241
5592 7481
5296 5592
7233 5296
2797 7233
4588 2797
4040 4588
2341 4040
5217 2341
6508 5217
9830 6508
1189 9830
2420 1189
6696 2420
3960 ...

output:

Yes
453 8761 5564 9272 3774 4035 1907 6837 2882 1368 4191 9529 1180 2428 6739 7444 5585 6101 2351 7195 6634 6465 4305 2461 1617 1699 4900 5869 8488 9565 4243 2472 8162 4132 2663 3565 1934 5104 8791 740 6647 3825 4275 3789 6965 2937 9797 2376 3198 7873 4968 8830 1418 1723 1515 867 3986 8231 8575 7246...

result:

ok 

Test #87:

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

input:

10000
8415 1
5765 1
612 1
6876 1
6237 1
5401 1
9549 1
6178 1
180 1
5641 1
700 1
2846 1
6410 1
9540 1
302 1
556 1
9218 1
4686 1
963 1
2263 1
2897 1
296 1
8723 1
4892 1
9185 1
2586 1
8158 1
7749 1
5169 1
6685 1
8232 1
6132 1
3113 1
6049 1
483 1
1313 1
3166 1
949 1
5506 1
4219 1
1865 1
4771 1
4074 1
57...

output:

Yes
8415 5765 612 6876 6237 5401 9549 6178 180 5641 700 2846 6410 9540 302 556 9218 4686 963 2263 2897 296 8723 4892 9185 2586 8158 7749 5169 6685 8232 6132 3113 6049 483 1313 3166 949 5506 4219 1865 4771 4074 572 7159 9467 8992 7741 9436 8065 9013 2012 1029 1294 6995 6584 6383 7126 1153 2640 1018 1...

result:

ok 

Test #88:

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

input:

10000
3864 1
97 1
179 1
8024 1
1957 1
1799 1
66 1
7341 1
9831 1
6741 1
7245 1
5584 1
6414 1
7085 1
6735 1
883 1
5299 1
3145 1
9667 1
6519 1
8874 1
5496 1
3752 1
5685 1
5049 1
9658 1
4818 1
4345 1
5159 1
2548 1
8655 1
3798 1
7705 1
9574 1
2374 1
2670 1
6641 1
2052 1
6017 1
8400 1
30 1
2071 1
1433 1
5...

output:

Yes
3864 97 179 8024 1957 1799 66 7341 9831 6741 7245 5584 6414 7085 6735 883 5299 3145 9667 6519 8874 5496 3752 5685 5049 9658 4818 4345 5159 2548 8655 3798 7705 9574 2374 2670 6641 2052 6017 8400 30 2071 1433 5653 2421 8703 4474 5806 9865 7518 5914 5028 9977 3390 547 4054 4196 2867 2923 3886 1634 ...

result:

ok 

Test #89:

score: 0
Accepted
time: 119ms
memory: 7852kb

input:

10000
4442 1
4129 1
67 4129
7845 67
4027 7845
9829 4442
6594 4027
7960 6594
4697 7960
554 9829
672 554
6455 672
1272 6455
1300 1272
4352 1300
2120 4697
1078 4352
4144 1078
5752 2120
6550 4144
3079 6550
8209 5752
6710 8209
3041 6710
7171 3079
7115 3041
7443 7115
7551 7171
6359 7551
9634 7443
1961 635...

output:

Yes
9437 6810 2160 7623 8096 9371 421 9839 6054 7823 999 8598 6076 9287 795 6277 6918 3375 8020 4169 1858 3296 3130 1699 2779 5188 958 1005 7320 6468 2261 8865 7414 7294 7356 6438 3385 7905 4418 8625 7137 9423 5626 2948 7030 6571 7027 1472 8464 6850 984 1304 1221 2858 1777 7371 3854 8717 3614 5359 2...

result:

ok 

Test #90:

score: 0
Accepted
time: 58ms
memory: 8232kb

input:

10000
3383 1
2580 1
7168 2580
6366 3383
3132 7168
2015 3132
6734 2015
7818 6734
9690 7818
2280 6366
3856 9690
200 3856
7842 200
7954 7842
5229 7954
2933 5229
5747 2933
1089 5747
5251 1089
1900 2280
4787 5251
4801 4787
374 1900
2148 374
6815 4801
9937 6815
4876 9937
9278 2148
1815 4876
3764 1815
4299...

output:

Yes
7881 3927 2868 8861 8004 9663 8396 7620 8152 6238 9927 9862 1743 6220 6166 8229 9446 471 5941 6055 5503 8890 8710 6457 7261 9512 620 5609 7163 4812 2551 8916 82 3852 9462 5714 1552 8473 5489 4325 392 1952 4827 7313 7506 1954 2882 5530 5080 7861 8939 9826 5794 2074 8210 6032 6496 3539 2064 6875 7...

result:

ok 

Test #91:

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

input:

10000
3509 1
1968 1
1468 1
6194 1
8541 1
9091 1
2279 1
3250 1
9450 1
1717 1
6968 1
6845 1
4818 1
3351 1
4477 1
7153 1
7861 1
6643 1
7939 1
1439 1
6238 1
6370 1
6261 1
2159 1
9468 1
4963 1
8137 1
7027 1
9359 1
5666 1
9549 1
7401 1
1312 1
3850 1
3029 1
2690 1
1595 1
7831 1
1183 1
6902 1
9872 1
7549 1
...

output:

Yes
3509 1968 1468 6194 8541 9091 2279 3250 9450 1717 6968 6845 4818 3351 4477 7153 7861 6643 7939 1439 6238 6370 6261 2159 9468 4963 8137 7027 9359 5666 9549 7401 1312 3850 3029 2690 1595 7831 1183 6902 9872 7549 9123 7658 7228 3151 8264 6576 2823 4276 1400 6715 1059 3199 4704 7755 4637 2363 2557 9...

result:

ok 

Test #92:

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

input:

10000
3263 1
4405 1
7526 1
8767 1
1797 1
3838 1
7224 1
7143 1
8507 1
8814 1
6866 1
6872 1
7568 1
7336 1
1001 1
6327 1
2112 1
5357 1
49 1
7926 1
8293 1
4445 1
4338 1
657 1
4240 1
8939 1
2781 1
6936 1
3249 1
6486 1
4993 1
2532 1
310 1
4785 1
2548 1
8028 1
2481 1
3037 1
7066 1
2302 1
1370 1
7338 1
4728...

output:

Yes
3263 4405 7526 8767 1797 3838 7224 7143 8507 8814 6866 6872 7568 7336 1001 6327 2112 5357 49 7926 8293 4445 4338 657 4240 8939 2781 6936 3249 6486 4993 2532 310 4785 2548 8028 2481 3037 7066 2302 1370 7338 4728 7527 6010 1830 1689 3021 4930 9393 8119 4709 7471 8252 1412 522 1303 6986 6977 1270 6...

result:

ok 

Test #93:

score: 0
Accepted
time: 597ms
memory: 9232kb

input:

10000
220 1
3379 1
7226 1
9643 220
1928 3379
636 7226
5362 1928
3245 636
7717 9643
594 7717
7741 5362
2430 3245
5836 2430
8279 7741
4215 5836
4017 4215
3757 4017
7714 8279
5524 7714
5625 3757
3936 5524
9006 3936
7020 594
5732 9006
7892 5625
4893 7892
7125 5732
9525 4893
2670 7020
1989 2670
5097 1989...

output:

Yes
4056 5994 3891 4499 862 7716 734 1974 6274 1406 3406 7160 6779 2471 6188 8830 9039 6128 2740 3047 3312 4601 9521 9937 3200 6985 9461 1301 7401 9445 490 8926 9552 878 326 7864 464 991 334 8747 7688 2722 1980 2956 5266 1396 9251 5626 6287 5188 5228 1901 5605 5331 9655 9447 7986 9307 6556 128 8752 ...

result:

ok 

Test #94:

score: -100
Wrong Answer
time: 525ms
memory: 8872kb

input:

10000
4934 1
1016 1
6795 1
2033 6795
5542 2033
533 5542
471 533
4890 471
8718 4890
8830 1016
6799 8718
3770 6799
4902 3770
4302 4902
2173 4302
5160 2173
8216 5160
3589 8216
4918 3589
5432 4918
5727 8830
2164 5432
4510 2164
7554 4510
5133 7554
1193 5727
9568 5133
5620 9568
1505 1193
3585 5620
5831 15...

output:

Yes
2504 5616 1545 8957 9587 683 3017 6626 8325 4046 2471 1212 200 505 3434 7672 1341 9784 7128 8772 1496 6980 8822 9002 9389 3306 7706 665 7988 4871 4406 7868 1451 1749 3343 5016 1206 7118 8120 520 2847 4170 4491 4730 7292 3741 3571 9155 2278 6958 9657 315 4387 8070 5979 9078 6728 1916 5006 4917 16...

result:

wrong answer knight 9976 is not on his path!