QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203539#2475. Bank RobberyPhantomThreshold#AC ✓5ms3560kbC++203.4kb2023-10-06 17:59:362023-10-06 17:59:37

Judging History

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

  • [2023-10-06 17:59:37]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3560kb
  • [2023-10-06 17:59:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	vector<vector<int>> G(n+5);
	vector<int> deg(n+5);
	for(int i=1;i<n;i++)
	{
		int u,v;
		cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
		deg[u]++;deg[v]++;
	}
	int need=0;
	for(int i=0;i<n;i++)
	{
		if(deg[i]!=1)need++;
	}
	vector<int> good(n+5);
	int rem=365;
	if(k<need+1)
	{
		cout<<"ATTACK"<<endl;
		//interact
		for(int i=1;i<=k;i++)
		{
			int x;
			cin>>x;
			good[x]=1;
		}
		vector<int> pull(n+5,1);
		while(1)
		{
			rem--;
			assert(rem>=0);
			for(int u=0;u<n;u++)
			{
				int allbad=1;
				allbad &= !good[u];
				for(auto v:G[u])
				{
					allbad &= !good[v];
				}
				if(allbad)
				{
					cout<<u<<endl;
					return 0;
				}
			}
			vector<int> vis(n+5),siz(n+5),gsiz(n+5),pa(n+5,-1),emp(n+5,0);
			function<void(int)> dfs=[&](int u)
			{
				siz[u]=(deg[u]!=1);
				gsiz[u]=good[u];
				vis[u]=1;
				emp[u]=(deg[u]!=1 and not good[u]);
				for(auto v:G[u])
				{
					if(not vis[v])
					{
						pa[v]=u;
						dfs(v);
						siz[u]+=siz[v];
						gsiz[u]+=gsiz[v];
						emp[u]|=emp[v];
					}
				}
			};
			int found=0;
			for(int x=0;x<n;x++)
			{
				if(deg[x]!=1 and good[x]==0)
				{
					fill(pa.begin(),pa.end(),-1);
					fill(vis.begin(),vis.end(),0);
					fill(siz.begin(),siz.end(),0);
					fill(gsiz.begin(),gsiz.end(),0);
					dfs(x);
					for(int i=0;i<n;i++)
					{
						if(deg[i]==1)
						{
							if(not pull[i])continue;
							int tt=i;
							while(pa[tt]!=x)
								tt=pa[tt];
							if(not emp[tt] and gsiz[tt]<=siz[tt])
							{
								cout<<i<<endl;
								fill(pull.begin(),pull.end(),0);
								for(int j=0;j<n;j++)
								{
									int tt2=j;
									while(pa[tt2]!=x)
										tt2=pa[tt2];
									if(tt2==tt)
										pull[j]=1;
								}
								found=1;
								break;
							}
						}
					}
					if(found)break;
				}
			}
			if(not found)
			{
				for(int i=0;i<n;i++)
				{
					if(deg[i]==1)
					{
						cout<<i<<endl;
						found=1;
						break;
					}
				}
			}
			assert(found);
			int chg;
			cin>>chg;
			vector<int> ngood(n+5);
			for(int i=0;i<chg;i++)
			{
				int u,v;
				cin>>u>>v;
				ngood[v]=1;
				good[u]=0;
			}
			for(int i=0;i<n;i++)
				good[i]|=ngood[i];
		}
	}
	else
	{
		cout<<"DEFEND"<<endl;
		int now=0;
		for(int i=0;i<n;i++)
		{
			if(deg[i]!=1)
			{
				cout<<i<<' ';
				good[i]=1;
				now++;
			}
		}
		for(int i=0;i<n;i++)
		{
			if(now==k)break;
			if(deg[i]==1)
			{
				cout<<i<<' ';
				good[i]=1;
				now++;
			}
		}
		cout<<endl;
		//interact
		vector<int> pa(n+5,-1);
		function<void(int)> dfs=[&](int u)
		{
			for(auto v:G[u])
			{
				if(pa[u]==v)continue;
				pa[v]=u;
				dfs(v);
			}
		};
		int x;
		while(cin>>x and x!=-1)
		{
			rem--;
			assert(rem>=0);
			if(good[x]){cout<<0<<endl;}
			else
			{
				fill(pa.begin(),pa.end(),-1);
				dfs(x);
				vector<pair<int,int>> mv;
				for(int i=0;i<n;i++)
				{
					if(deg[i]==1 and good[i]==1)
					{
						int u=i;
						while(pa[u]!=-1)
						{
							mv.emplace_back(u,pa[u]);
							u=pa[u];
						}
						good[i]=0;
						good[x]=1;
						break;
					}
				}
				reverse(mv.begin(),mv.end());
				cout<<mv.size()<<endl;
				for(auto [u,v]:mv)
					cout<<u<<' '<<v<<endl;
			}
		}
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3512kb

input:

6 3
0 1
0 2
0 3
3 4
3 5
4
2
5
1
2
5
1
5
1
2
1
2
1
5
4
2
5
1
2
5
4
5
2
1
4
5
2
5
1
2
4
2
4
5
1
2
5
4
5
4
1
5
1
2
5
2
5
1
2
4
5
4
2
1
5
1
2
1
4
5
4
2
5
4
1
2
4
2
4
1
2
5
1
2
4
2
1
5
4
5
2
1
2
4
1
4
5
4
5
2
4
5
4
2
5
2
1
5
4
5
2
4
5
1
5
2
5
2
5
1
4
2
1
4
1
5
4
5
2
4
5
1
5
2
1
2
1
4
1
4
2
1
5
1
4
1
2
5
...

output:

DEFEND
0 3 1 
3
3 4
0 3
1 0
3
0 2
3 0
4 3
3
3 5
0 3
2 0
3
0 1
3 0
5 3
2
0 2
1 0
3
3 5
0 3
2 0
3
0 1
3 0
5 3
3
3 5
0 3
1 0
3
0 1
3 0
5 3
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
3
3 5
0 3
1 0
2
3 4
5 3
3
0 2
3 0
4 3
3
3 5
0 3
2 0
3
0 1
3 0
5 3
2
0 2
1 0
3
3 5
0 3
2 0
2
3 4
5 3
2
3 5
4 3
3
0 2
3 0
5 3
...

result:

ok 

Test #2:

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

input:

6 2
0 1
0 2
0 3
3 4
3 5
0 3
1 0 1

output:

ATTACK
1
2

result:

ok 

Test #3:

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

input:

100 50
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 
10
34 71
16 34
7 16
2 7
0 2
1 0
4 1
10 4
23 10
49 23
6
36 74
17 36
7 17
16 7
34 16
71 34
2
36 75
74 36
11
46 94
22 46
10 22
4 10
1 4
0 1
2 0
7 2
17 7
36...

result:

ok 

Test #4:

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

input:

100 49
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54...

output:

ATTACK
49
62
70
74
76
77

result:

ok 

Test #5:

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

input:

100 10
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

ATTACK
10
14
16
17

result:

ok 

Test #6:

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

input:

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

output:

ATTACK
1
9
10
11

result:

ok 

Test #7:

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

input:

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

output:

ATTACK
1
2

result:

ok 

Test #8:

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

input:

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

output:

DEFEND
0 1 2 5 7 8 3 
5
8 12
7 8
1 7
0 1
3 0
7
5 10
2 5
0 2
1 0
7 1
8 7
12 8
7
8 13
7 8
1 7
0 1
2 0
5 2
10 5
4
1 6
7 1
8 7
13 8
4
8 12
7 8
1 7
6 1
2
8 13
12 8
4
1 6
7 1
8 7
13 8
5
5 10
2 5
0 2
1 0
6 1
6
7 9
1 7
0 1
2 0
5 2
10 5
5
2 4
0 2
1 0
7 1
9 7
5
7 9
1 7
0 1
2 0
4 2
3
8 13
7 8
9 7
5
0 3
1 0
7 1...

result:

ok 

Test #9:

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

input:

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

output:

ATTACK
3
8
9

result:

ok 

Test #10:

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

input:

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

output:

ATTACK
6
8
9

result:

ok 

Test #11:

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

input:

6 2
0 1
0 2
0 3
1 4
1 5
0 1
1 0 2

output:

ATTACK
2
3

result:

ok 

Test #12:

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

input:

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

output:

ATTACK
4
6
7

result:

ok 

Test #13:

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

input:

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

output:

ATTACK
5
6
7

result:

ok 

Test #14:

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

input:

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

output:

ATTACK
9
10
12
13

result:

ok 

Test #15:

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

input:

8 3
0 1
0 2
0 3
1 4
1 5
2 6
2 7
0 1 2
1 0 3
2 3 0 1 4

output:

ATTACK
3
4
5

result:

ok 

Test #16:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 
6
9 20
3 9
0 3
1 0
4 1
11 4
6
7 17
2 7
0 2
3 0
9 3
20 9
7
10 22
4 10
1 4
0 1
2 0
7 2
17 7
7
7 17
2 7
0 2
1 0
4 1
10 4
22 10
6
5 13
1 5
0 1
2 0
7 2
17 7
6
8 19
3 8
0 3
1 0
5 1
13 5
6
4 11
1 4
0 1
3 0
8 3
19 8
3
10 24
4 10
11 4
7
9 21
3 9
0 3
1 0
4 1
10 4
24 10
7
10 2...

result:

ok 

Test #17:

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

input:

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

output:

DEFEND
0 2 3 4 5 11 1 
4
4 7
2 4
0 2
1 0
6
11 13
3 11
0 3
2 0
4 2
7 4
5
2 20
0 2
3 0
11 3
13 11
3
4 16
2 4
20 2
3
2 20
4 2
16 4
3
0 21
2 0
20 2
4
4 7
2 4
0 2
21 0
4
5 17
2 5
4 2
7 4
6
11 12
3 11
0 3
2 0
5 2
17 5
4
0 22
3 0
11 3
12 11
4
4 23
2 4
0 2
22 0
4
0 1
2 0
4 2
23 4
4
5 9
2 5
0 2
1 0
4
4 6
2 4...

result:

ok 

Test #18:

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

input:

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

output:

ATTACK
3
4
5

result:

ok 

Test #19:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 
4
3 8
0 3
2 0
6 2
5
5 13
1 5
0 1
3 0
8 3
5
2 7
0 2
1 0
5 1
13 5
5
4 11
1 4
0 1
2 0
7 2
5
3 9
0 3
1 0
4 1
11 4
4
2 6
0 2
3 0
9 3
5
5 13
1 5
0 1
2 0
6 2
4
4 10
1 4
5 1
13 5
5
2 6
0 2
1 0
4 1
10 4
4
3 8
0 3
2 0
6 2
5
5 13
1 5
0 1
3 0
8 3
4
4 10
1 4
5 1
13 5
4
5 12
1 5
4 1
10 4
2
5...

result:

ok 

Test #20:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 
6
8 18
3 8
0 3
1 0
5 1
12 5
6
7 16
2 7
0 2
3 0
8 3
18 8
7
11 26
4 11
1 4
0 1
2 0
7 2
16 7
7
6 14
2 6
0 2
1 0
4 1
11 4
26 11
6
8 18
3 8
0 3
2 0
6 2
14 6
2
8 19
18 8
6
6 14
2 6
0 2
3 0
8 3
19 8
7
10 23
4 10
1 4
0 1
2 0
6 2
14 6
2
10 22
23 10
5
5 13
1 5
4 1
10 4
22 ...

result:

ok 

Test #21:

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

input:

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

output:

ATTACK
4
6
7

result:

ok 

Test #22:

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

input:

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

output:

ATTACK
14
18
20
21

result:

ok 

Test #23:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
7
11 25
4 11
1 4
0 1
2 0
6 2
15 6
8
14 30
6 14
2 6
0 2
1 0
4 1
11 4
25 11
8
11 24
4 11
1 4
0 1
2 0
6 2
14 6
30 14
7
8 19
3 8
0 3
1 0
4 1
11 4
24 11
2
8 18
19 8
6
6 15
2 6
0 2
3 0
8 3
18 8
7
10 22
4 10
1 4
0 1
2 0
6 2
15 6
7
8 19
3 8
0 3
1 0
4 1
10 4
22 1...

result:

ok 

Test #24:

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

input:

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

output:

ATTACK
6
8
9

result:

ok 

Test #25:

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

input:

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

output:

DEFEND
0 1 2 3 4 
4
2 6
0 2
1 0
4 1
4
3 9
0 3
2 0
6 2
2
3 10
9 3
4
1 4
0 1
3 0
10 3
4
3 8
0 3
1 0
4 1
4
2 6
0 2
3 0
8 3
4
1 4
0 1
2 0
6 2
4
2 7
0 2
1 0
4 1
4
1 4
0 1
2 0
7 2
4
3 8
0 3
1 0
4 1
4
1 4
0 1
3 0
8 3
2
1 5
4 1
4
3 8
0 3
1 0
5 1
2
3 10
8 3
4
2 6
0 2
3 0
10 3
4
1 5
0 1
2 0
6 2
4
3 10
0 3
1 0...

result:

ok 

Test #26:

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

input:

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

output:

ATTACK
7
8
9

result:

ok 

Test #27:

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

input:

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

output:

ATTACK
8
10
12
13

result:

ok 

Test #28:

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

input:

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

output:

ATTACK
9
10
12
13

result:

ok 

Test #29:

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

input:

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

output:

ATTACK
13
14
16
17

result:

ok 

Test #30:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 
4
3 8
0 3
2 0
6 2
5
5 13
1 5
0 1
3 0
8 3
5
2 7
0 2
1 0
5 1
13 5
5
4 11
1 4
0 1
2 0
7 2
5
3 9
0 3
1 0
4 1
11 4
4
2 6
0 2
3 0
9 3
5
5 13
1 5
0 1
2 0
6 2
4
4 10
1 4
5 1
13 5
5
2 6
0 2
1 0
4 1
10 4
4
3 8
0 3
2 0
6 2
5
5 13
1 5
0 1
3 0
8 3
4
4 10
1 4
5 1
13 5
4
5 12
1 5
4 1
10 4
2
5...

result:

ok 

Test #31:

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

input:

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

output:

DEFEND
0 3 5 1 
4
5 30
3 5
0 3
1 0
2
5 7
30 5
2
5 24
7 5
4
0 12
3 0
5 3
24 5
4
5 30
3 5
0 3
12 0
3
3 23
5 3
30 5
3
5 19
3 5
23 3
2
5 6
19 5
2
5 35
6 5
4
0 2
3 0
5 3
35 5
3
3 13
0 3
2 0
3
5 38
3 5
13 3
2
5 24
38 5
3
3 27
5 3
24 5
3
5 9
3 5
27 3
2
5 14
9 5
2
5 30
14 5
2
5 24
30 5
2
5 26
24 5
2
5 35
26...

result:

ok 

Test #32:

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

input:

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

output:

ATTACK
10
14
16
17

result:

ok 

Test #33:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 
4
9 20
3 9
8 3
18 8
7
12 27
5 12
1 5
0 1
3 0
9 3
20 9
8
15 33
6 15
2 6
0 2
1 0
5 1
12 5
27 12
7
9 20
3 9
0 3
2 0
6 2
15 6
33 15
7
15 32
6 15
2 6
0 2
3 0
9 3
20 9
6
16 34
7 16
2 7
6 2
15 6
32 15
8
13 29
5 13
1 5
0 1
2 0
7 2
16 7
34 16
8
16 34
7 1...

result:

ok 

Test #34:

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

input:

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

output:

ATTACK
17
18
20
21

result:

ok 

Test #35:

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

input:

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

output:

ATTACK
2
3

result:

ok 

Test #36:

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

input:

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

output:

ATTACK
9
10
12
13

result:

ok 

Test #37:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 
7
11 24
4 11
1 4
0 1
2 0
7 2
16 7
6
12 27
5 12
1 5
4 1
11 4
24 11
8
15 34
6 15
2 6
0 2
1 0
5 1
12 5
27 12
8
10 22
4 10
1 4
0 1
2 0
6 2
15 6
34 15
7
8 19
3 8
0 3
1 0
4 1
10 4
22 10
7
14 31
6 14
2 6
0 2
3 0
8 3
19 8
8
10 22
4 10
1 4
0 1
2 0
6 2
14 6
31 ...

result:

ok 

Test #38:

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

input:

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

output:

ATTACK
8
10
12
13

result:

ok 

Test #39:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 
6
6 15
2 6
0 2
1 0
5 1
13 5
6
8 18
3 8
0 3
2 0
6 2
15 6
2
8 19
18 8
7
10 23
4 10
1 4
0 1
3 0
8 3
19 8
7
8 19
3 8
0 3
1 0
4 1
10 4
23 10
2
8 18
19 8
4
9 20
3 9
8 3
18 8
7
10 22
4 10
1 4
0 1
3 0
9 3
20 9
7
8 19
3 8
0 3
1 0
4 1
10 4
22 10
4
9 20
3 9
8 3
19 8
7
10...

result:

ok 

Test #40:

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

input:

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

output:

DEFEND
0 1 3 5 6 8 9 2 
4
5 7
1 5
0 1
2 0
2
5 18
7 5
4
8 12
6 8
5 6
18 5
6
0 2
1 0
5 1
6 5
8 6
12 8
6
9 11
6 9
5 6
1 5
0 1
2 0
7
3 16
0 3
1 0
5 1
6 5
9 6
11 9
7
8 13
6 8
5 6
1 5
0 1
3 0
16 3
7
3 16
0 3
1 0
5 1
6 5
8 6
13 8
3
0 2
3 0
16 3
5
6 17
5 6
1 5
0 1
2 0
3
8 13
6 8
17 6
6
0 2
1 0
5 1
6 5
8 6
1...

result:

ok 

Test #41:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 12 20 23 10 
5
8 22
3 8
0 3
2 0
10 2
5
2 28
0 2
3 0
8 3
22 8
6
7 21
5 7
1 5
0 1
2 0
28 2
4
6 15
5 6
7 5
21 7
2
6 14
15 6
6
2 10
0 2
1 0
5 1
6 5
14 6
6
12 18
9 12
3 9
0 3
2 0
10 2
8
6 15
5 6
1 5
0 1
3 0
9 3
12 9
18 12
4
7 21
5 7
6 5
15 6
6
2 11
0 2
1 0
5 1
7 5
21 7
2
2 28
1...

result:

ok 

Test #42:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
5
22 46
10 22
4 10
11 4
24 11
4
23 49
10 23
22 10
46 22
5
11 24
4 11
10 4
23 10
49 23
8
21 44
9 21
3 9
0 3
1 0
4 1
11 4
24 11
9
22 46
10 22
4 10
1 4
0 1
3 0
9 3
21 9
44 21
7
13 29
5 13
1 5
4 1
10 4
22 10
46 22
7
22 46
10 22
4 1...

result:

ok 

Test #43:

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

input:

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

output:

ATTACK
22
30
34
36
37

result:

ok 

Test #44:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
6
8 19
3 8
0 3
2 0
7 2
17 7
7
12 26
5 12
1 5
0 1
3 0
8 3
19 8
8
15 32
6 15
2 6
0 2
1 0
5 1
12 5
26 12
7
8 19
3 8
0 3
2 0
6 2
15 6
32 15
7
14 31
6 14
2 6
0 2
3 0
8 3
19 8
4
15 33
6 15
14 6
31 14
8
13 28
5 13
1 5
0 1
2 0
6 2
15 6
33 15
8
15 33
6 15
2...

result:

ok 

Test #45:

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

input:

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

output:

DEFEND
0 1 
2
0 7
1 0
2
0 20
7 0
2
0 14
20 0
2
0 18
14 0
2
0 21
18 0
2
0 22
21 0
2
0 3
22 0
2
0 26
3 0
2
0 25
26 0
2
0 2
25 0
2
0 4
2 0
2
0 22
4 0
2
0 23
22 0
2
0 25
23 0
2
0 21
25 0
2
0 4
21 0
2
0 21
4 0
2
0 23
21 0
2
0 16
23 0
2
0 26
16 0
2
0 17
26 0
2
0 3
17 0
2
0 23
3 0
2
0 15
23 0
2
0 3
15 0
2
...

result:

ok 

Test #46:

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

input:

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

output:

ATTACK
26
30
34
36
37

result:

ok 

Test #47:

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

input:

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

output:

ATTACK
18
22
26
28
29

result:

ok 

Test #48:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 
4
5 12
1 5
4 1
10 4
6
7 17
2 7
0 2
1 0
5 1
12 5
6
5 12
1 5
0 1
2 0
7 2
17 7
6
9 21
3 9
0 3
1 0
5 1
12 5
6
5 12
1 5
0 1
3 0
9 3
21 9
6
6 14
2 6
0 2
1 0
5 1
12 5
6
5 12
1 5
0 1
2 0
6 2
14 6
6
9 21
3 9
0 3
1 0
5 1
12 5
6
7 16
2 7
0 2
3 0
9 3
21 9
4
6 14
2 6
7 2
16 7
4
7 1...

result:

ok 

Test #49:

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

input:

55 27
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
25 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
8
15 32
6 15
2 6
0 2
1 0
5 1
12 5
26 12
8
21 45
9 21
3 9
0 3
2 0
6 2
15 6
32 15
6
18 39
8 18
3 8
9 3
21 9
45 21
6
20 43
9 20
3 9
8 3
18 8
39 18
9
22 46
10 22
4 10
1 4
0 1
3 0
9 3
20 9
43 20
2
22 47
46 22
7
13 28
5 13
1 5
...

result:

ok 

Test #50:

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

input:

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

output:

ATTACK
13
14
16
17

result:

ok 

Test #51:

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

input:

57 27
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
27
30
34
36
37

result:

ok 

Test #52:

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

input:

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

output:

ATTACK
23
30
34
36
37

result:

ok 

Test #53:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
7
12 27
5 12
1 5
0 1
2 0
6 2
15 6
4
13 29
5 13
12 5
27 12
6
11 25
4 11
1 4
5 1
13 5
29 13
7
6 15
2 6
0 2
1 0
4 1
11 4
25 11
6
9 21
3 9
0 3
2 0
6 2
15 6
7
13 29
5 13
1 5
0 1
3 0
9 3
21 9
7
9 21
3 9
0 3
1 0
5 1
13 5
29 13
6
6 15
2 6
0 2
3 0
9 3
21 9
6
8 18...

result:

ok 

Test #54:

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

input:

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

output:

ATTACK
10
14
16
17

result:

ok 

Test #55:

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

input:

57 28
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
8
15 33
6 15
2 6
0 2
1 0
5 1
12 5
27 12
6
17 37
7 17
2 7
6 2
15 6
33 15
9
22 46
10 22
4 10
1 4
0 1
2 0
7 2
17 7
37 17
9
15 32
6 15
2 6
0 2
1 0
4 1
10 4
22 10
46 22
8
20 42
9 20
3 9
0 3
2 0
6 2
15 6
32 15
9
25 52
11 25
...

result:

ok 

Test #56:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
3
18 39
8 18
19 8
8
10 23
4 10
1 4
0 1
3 0
8 3
18 8
39 18
8
18 40
8 18
3 8
0 3
1 0
4 1
10 4
23 10
8
13 28
5 13
1 5
0 1
3 0
8 3
18 8
40 18
8
15 32
6 15
2 6
0 2
1 0
5 1
13 5
28 13
8
18 40
8 18
3 8
0 3
2 0
6 2
15 6
32 15
8
13 28
5 13
1 5
0 1
3 0...

result:

ok 

Test #57:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
8
21 45
9 21
3 9
0 3
1 0
4 1
10 4
23 10
9
22 48
10 22
4 10
1 4
0 1
3 0
9 3
21 9
45 21
3
10 23
22 10
48 22
8
20 43
9 20
3 9
0 3
1 0
4 1
10 4
23 10
4
21 45
9 21
20 9
43 20
8
13 28
5 13
1 5
0 1
3 0
9 3
21 9
45 21
8
21 45
9 21
3 9
0 3...

result:

ok 

Test #58:

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

input:

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

output:

ATTACK
13
14
16
17

result:

ok 

Test #59:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 9 10 11 12 15 7 
4
0 48
3 0
4 3
7 4
4
5 44
3 5
0 3
48 0
5
2 35
0 2
3 0
5 3
44 5
8
11 19
9 11
6 9
4 6
3 4
0 3
2 0
35 2
7
0 32
3 0
4 3
6 4
9 6
11 9
19 11
5
6 8
4 6
3 4
0 3
32 0
4
10 40
9 10
6 9
8 6
7
0 50
3 0
4 3
6 4
9 6
10 9
40 10
7
11 19
9 11
6 9
4 6
3 4
0 3
50 0
5
12 23
10 12
9...

result:

ok 

Test #60:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
5
19 40
8 19
3 8
9 3
20 9
8
11 24
4 11
1 4
0 1
3 0
8 3
19 8
40 19
8
19 41
8 19
3 8
0 3
1 0
4 1
11 4
24 11
8
13 29
5 13
1 5
0 1
3 0
8 3
19 8
41 19
8
15 33
6 15
2 6
0 2
1 0
5 1
13 5
29 13
8
19 41
8 19
3 8
0 3
2 0
6 2
15 6
33 15
8
13 29
5 13
...

result:

ok 

Test #61:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 
4
7 16
2 7
6 2
14 6
6
8 19
3 8
0 3
2 0
7 2
16 7
4
9 20
3 9
8 3
19 8
7
11 24
4 11
1 4
0 1
3 0
9 3
20 9
7
9 20
3 9
0 3
1 0
4 1
11 4
24 11
4
8 19
3 8
9 3
20 9
4
9 21
3 9
8 3
19 8
7
10 23
4 10
1 4
0 1
3 0
9 3
21 9
7
9 20
3 9
0 3
1 0
4 1
10 4
23 10
2
9 21
20 9
7...

result:

ok 

Test #62:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
4
11 24
4 11
10 4
22 10
8
21 45
9 21
3 9
0 3
1 0
4 1
11 4
24 11
6
18 39
8 18
3 8
9 3
21 9
45 21
8
16 34
7 16
2 7
0 2
3 0
8 3
18 8
39 18
8
11 25
4 11
1 4
0 1
2 0
7 2
16 7
34 16
8
14 31
6 14
2 6
0 2
1 0
4 1
11 4
25 11
8
13 28
5 13
1 5
...

result:

ok 

Test #63:

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

input:

60 30
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 
8
14 31
6 14
2 6
0 2
1 0
5 1
13 5
29 13
6
16 34
7 16
2 7
6 2
14 6
31 14
2
16 35
34 16
9
26 54
12 26
5 12
1 5
0 1
2 0
7 2
16 7
35 16
8
24 50
11 24
4 11
1 4
5 1
12 5
26 12
54 26
6
23 49
10 23
4 10
11 4
24 11
50 24
...

result:

ok 

Test #64:

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

input:

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

output:

DEFEND
0 1 3 4 5 6 8 9 10 15 20 2 
6
15 16
10 15
8 10
1 8
0 1
2 0
9
6 13
5 6
3 5
0 3
1 0
8 1
10 8
15 10
16 15
2
6 25
13 6
7
8 11
1 8
0 1
3 0
5 3
6 5
25 6
4
15 16
10 15
8 10
11 8
2
15 17
16 15
4
8 11
10 8
15 10
17 15
7
20 22
4 20
3 4
0 3
1 0
8 1
11 8
3
4 21
20 4
22 20
4
5 7
3 5
4 3
21 4
3
6 12
5 6
7 ...

result:

ok 

Test #65:

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

input:

57 27
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
27
30
34
36
37

result:

ok 

Test #66:

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

input:

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

output:

ATTACK
20
22
26
28
29

result:

ok 

Test #67:

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

input:

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

output:

ATTACK
4
20

result:

ok 

Test #68:

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

input:

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

output:

ATTACK
4
14

result:

ok 

Test #69:

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

input:

64 32
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 
8
19 41
8 19
3 8
0 3
2 0
6 2
14 6
31 14
9
22 46
10 22
4 10
1 4
0 1
3 0
8 3
19 8
41 19
9
19 40
8 19
3 8
0 3
1 0
4 1
10 4
22 10
46 22
9
25 52
11 25
4 11
1 4
0 1
3 0
8 3
19 8
40 19
9
16 34
7 16
2 7
0 2
1 0
4 1...

result:

ok 

Test #70:

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

input:

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

output:

ATTACK
23
30
34
36
37

result:

ok 

Test #71:

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

input:

56 27
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
27
30
34
36
37

result:

ok 

Test #72:

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

input:

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

output:

ATTACK
18
22
26
28
29

result:

ok 

Test #73:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
8
15 33
6 15
2 6
0 2
1 0
4 1
11 4
25 11
8
21 45
9 21
3 9
0 3
2 0
6 2
15 6
33 15
4
20 42
9 20
21 9
45 21
6
19 40
8 19
3 8
9 3
20 9
42 20
8
13 28
5 13
1 5
0 1
3 0
8 3
19 8
40 19
7
23 49
10 23
4 10
1 4
5 1
13 5
28 13
9
19 40
8 ...

result:

ok 

Test #74:

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

input:

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

output:

ATTACK
17
18
20
21

result:

ok 

Test #75:

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

input:

58 29
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 
8
16 34
7 16
2 7
0 2
1 0
5 1
13 5
28 13
8
18 38
8 18
3 8
0 3
2 0
7 2
16 7
34 16
9
22 47
10 22
4 10
1 4
0 1
3 0
8 3
18 8
38 18
9
15 33
6 15
2 6
0 2
1 0
4 1
10 4
22 10
47 22
8
20 43
9 20
3 9
0 3
2 0
6 2
15 6
33 15
9
2...

result:

ok 

Test #76:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
7
12 27
5 12
1 5
0 1
2 0
6 2
15 6
4
13 29
5 13
12 5
27 12
6
11 25
4 11
1 4
5 1
13 5
29 13
7
6 15
2 6
0 2
1 0
4 1
11 4
25 11
6
9 21
3 9
0 3
2 0
6 2
15 6
7
13 29
5 13
1 5
0 1
3 0
9 3
21 9
7
9 21
3 9
0 3
1 0
5 1
13 5
29 13
6
6 15
2 6
0 2
3 0
9 3
21 9
6
8 18...

result:

ok 

Test #77:

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

input:

78 38
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
38
46
54
58
60
61

result:

ok 

Test #78:

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

input:

70 35
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

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

result:

ok 

Test #79:

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

input:

63 30
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
30
38
42
44
45

result:

ok 

Test #80:

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

input:

65 6
0 1
0 2
0 3
0 13
0 15
0 17
0 18
0 38
0 42
0 50
0 52
0 54
0 61
1 10
1 11
1 16
1 23
1 35
1 37
1 39
1 44
1 51
1 55
1 57
1 64
2 6
2 7
2 12
2 20
2 21
2 25
2 41
2 48
2 53
2 56
2 62
2 63
3 4
3 5
3 14
3 19
3 26
3 28
3 29
3 30
3 31
3 34
3 46
3 47
3 59
7 8
7 9
7 22
7 24
7 27
7 32
7 33
7 36
7 40
7 43
7 45...

output:

DEFEND
0 1 2 3 7 4 
4
2 48
0 2
3 0
4 3
3
0 17
2 0
48 2
3
3 46
0 3
17 0
4
2 48
0 2
3 0
46 3
4
1 64
0 1
2 0
48 2
2
1 23
64 1
4
2 56
0 2
1 0
23 1
4
1 11
0 1
2 0
56 2
5
7 49
2 7
0 2
1 0
11 1
3
2 25
7 2
49 7
4
3 14
0 3
2 0
25 2
4
2 41
0 2
3 0
14 3
3
7 40
2 7
41 2
2
7 27
40 7
3
2 12
7 2
27 7
4
3 14
0 3
2 ...

result:

ok 

Test #81:

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

input:

66 32
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
32
38
42
44
45

result:

ok 

Test #82:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
8
15 33
6 15
2 6
0 2
1 0
4 1
11 4
25 11
8
21 45
9 21
3 9
0 3
2 0
6 2
15 6
33 15
4
20 42
9 20
21 9
45 21
6
19 40
8 19
3 8
9 3
20 9
42 20
8
13 28
5 13
1 5
0 1
3 0
8 3
19 8
40 19
7
23 49
10 23
4 10
1 4
5 1
13 5
28 13
9
19 40
8 ...

result:

ok 

Test #83:

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

input:

77 10
0 1
0 2
0 3
0 30
0 45
0 50
0 62
0 64
0 71
1 12
1 13
1 22
1 37
1 59
1 63
1 73
3 4
3 5
3 69
3 76
4 6
4 7
4 32
4 36
4 38
4 41
4 57
4 60
4 61
4 67
5 8
5 9
5 25
5 28
5 39
5 53
5 58
5 72
5 74
6 10
6 11
6 31
6 33
6 54
12 18
12 19
12 23
12 27
12 29
12 34
12 40
12 49
12 55
12 56
12 65
13 14
13 15
13 35...

output:

ATTACK
2
30

result:

ok 

Test #84:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
5
19 40
8 19
3 8
9 3
20 9
8
11 24
4 11
1 4
0 1
3 0
8 3
19 8
40 19
8
19 41
8 19
3 8
0 3
1 0
4 1
11 4
24 11
8
13 29
5 13
1 5
0 1
3 0
8 3
19 8
41 19
8
15 33
6 15
2 6
0 2
1 0
5 1
13 5
29 13
8
19 41
8 19
3 8
0 3
2 0
6 2
15 6
33 15
8
13 29
5 13
...

result:

ok 

Test #85:

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

input:

78 39
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 
9
35 73
16 35
7 16
2 7
0 2
3 0
8 3
18 8
38 18
10
27 57
12 27
5 12
1 5
0 1
2 0
7 2
16 7
35 16
73 35
10
30 62
14 30
6 14
2 6
0 2
1 0
5 1
12 5
27 12
57 27
9
21 44
9 21
3 9
0 3
2 0
6 2
14 6...

result:

ok 

Test #86:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 
7
10 23
4 10
1 4
0 1
3 0
9 3
21 9
6
13 28
5 13
1 5
4 1
10 4
23 10
8
16 35
7 16
2 7
0 2
1 0
5 1
13 5
28 13
6
14 31
6 14
2 6
7 2
16 7
35 16
6
16 35
7 16
2 7
6 2
14 6
31 14
4
17 36
7 17
16 7
35 16
8
10 23
4 10
1 4
0 1
2 0
7 2
17 7
36 17
8
...

result:

ok 

Test #87:

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

input:

65 32
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

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

result:

ok 

Test #88:

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

input:

83 2
0 1
0 2
0 3
0 6
0 7
0 10
0 11
0 13
0 18
0 20
0 25
0 26
0 32
0 33
0 34
0 35
0 36
0 38
0 39
0 43
0 45
0 46
0 47
0 49
0 50
0 54
0 55
0 56
0 57
0 60
0 61
0 64
0 65
0 66
0 68
0 70
0 71
0 72
0 73
0 77
0 79
0 80
0 81
2 4
2 5
2 8
2 9
2 12
2 14
2 15
2 16
2 17
2 19
2 21
2 22
2 23
2 24
2 27
2 28
2 29
2 30...

output:

ATTACK
1
3

result:

ok 

Test #89:

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

input:

82 41
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
9
37 76
17 37
7 17
2 7
0 2
3 0
8 3
19 8
40 19
6
35 72
16 35
7 16
17 7
37 17
76 37
8
30 63
14 30
6 14
2 6
7 2
16 7
35 16
72 35
10
22 47
10 22
4 10
1 4
0 1
2 0
6 2
14 6
30 14
63 30
...

result:

ok 

Test #90:

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

input:

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

output:

ATTACK
25
30
34
36
37

result:

ok 

Test #91:

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

input:

66 33
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 
6
16 34
7 16
2 7
6 2
15 6
32 15
9
29 61
13 29
5 13
1 5
0 1
2 0
7 2
16 7
34 16
9
16 34
7 16
2 7
0 2
1 0
5 1
13 5
29 13
61 29
9
26 54
12 26
5 12
1 5
0 1
2 0
7 2
16 7
34 16
4
27 57
12 27
26 12
54 26
8
22 46...

result:

ok 

Test #92:

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

input:

85 41
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
41
46
54
58
60
61

result:

ok 

Test #93:

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

input:

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

output:

ATTACK
21
22
26
28
29

result:

ok 

Test #94:

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

input:

57 4
0 1
0 2
0 3
0 21
0 23
0 26
0 32
0 33
0 35
0 43
0 53
2 4
2 5
2 12
2 17
2 20
2 22
2 24
2 27
2 29
2 34
2 41
2 42
2 44
2 47
2 50
2 52
2 55
2 56
5 6
5 7
5 10
5 15
5 18
5 19
5 25
5 30
5 31
5 37
5 38
5 39
5 40
5 46
5 48
5 54
7 8
7 9
7 11
7 13
7 14
7 16
7 28
7 36
7 45
7 49
7 51
0 2 5 7
1 0 1

output:

ATTACK
1
3

result:

ok 

Test #95:

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

input:

79 38
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
38
46
54
58
60
61

result:

ok 

Test #96:

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

input:

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

output:

ATTACK
21
22
26
28
29

result:

ok 

Test #97:

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

input:

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

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
5
19 40
8 19
3 8
9 3
20 9
8
11 24
4 11
1 4
0 1
3 0
8 3
19 8
40 19
8
19 41
8 19
3 8
0 3
1 0
4 1
11 4
24 11
8
13 29
5 13
1 5
0 1
3 0
8 3
19 8
41 19
8
15 33
6 15
2 6
0 2
1 0
5 1
13 5
29 13
8
19 41
8 19
3 8
0 3
2 0
6 2
15 6
33 15
8
13 29
5 13
...

result:

ok 

Test #98:

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

input:

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

output:

ATTACK
23
30
34
36
37

result:

ok 

Test #99:

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

input:

78 39
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 
9
35 73
16 35
7 16
2 7
0 2
3 0
8 3
18 8
38 18
10
27 57
12 27
5 12
1 5
0 1
2 0
7 2
16 7
35 16
73 35
10
30 62
14 30
6 14
2 6
0 2
1 0
5 1
12 5
27 12
57 27
9
21 44
9 21
3 9
0 3
2 0
6 2
14 6...

result:

ok 

Test #100:

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

input:

4 3
0 1
0 2
0 3
3
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
...

output:

DEFEND
0 1 2 
2
0 3
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
1 0
2
0 1
2 0
2
0 2
...

result:

ok 

Test #101:

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

input:

67 32
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

ATTACK
32
38
42
44
45

result:

ok 

Test #102:

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

input:

69 34
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

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

result:

ok 

Test #103:

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

input:

93 46
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 
9
30 63
14 30
6 14
2 6
0 2
3 0
9 3
21 9
45 21
10
41 85
19 41
8 19
3 8
0 3
2 0
6 2
14 6
30 14
63 30
10
24 51
11 24
4 11
1 4
0 1
3 0
8 3
19 8
41 19
85 41
10
43 89
20 ...

result:

ok 

Test #104:

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

input:

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

output:

ATTACK
6
33

result:

ok 

Test #105:

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

input:

55 26
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
25 54
...

output:

ATTACK
26
30
34
36
37

result:

ok 

Test #106:

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

input:

78 39
0 1
0 2
0 3
1 4
1 5
2 6
2 7
3 8
3 9
4 10
4 11
5 12
5 13
6 14
6 15
7 16
7 17
8 18
8 19
9 20
9 21
10 22
10 23
11 24
11 25
12 26
12 27
13 28
13 29
14 30
14 31
15 32
15 33
16 34
16 35
17 36
17 37
18 38
18 39
19 40
19 41
20 42
20 43
21 44
21 45
22 46
22 47
23 48
23 49
24 50
24 51
25 52
25 53
26 54
...

output:

DEFEND
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 
9
35 73
16 35
7 16
2 7
0 2
3 0
8 3
18 8
38 18
10
27 57
12 27
5 12
1 5
0 1
2 0
7 2
16 7
35 16
73 35
10
30 62
14 30
6 14
2 6
0 2
1 0
5 1
12 5
27 12
57 27
9
21 44
9 21
3 9
0 3
2 0
6 2
14 6...

result:

ok 

Test #107:

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

input:

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

output:

ATTACK
1
2

result:

ok