QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#233086#7636. Fair Electionsucup-team1209AC ✓567ms4832kbC++201.5kb2023-10-31 13:05:412023-10-31 13:05:41

Judging History

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

  • [2023-10-31 13:05:41]
  • 评测
  • 测评结果:AC
  • 用时:567ms
  • 内存:4832kb
  • [2023-10-31 13:05:41]
  • 提交

answer

#include<bits/stdc++.h>
using std::cin, std::cout;
int n, m;
using pr = std::pair<int, int>;
const int N = 10005;
std::vector<pr> dp[N];
int rank[N][3];
int get(int x, int y, int z) {
	if(x >= y && x >= z) return 0;
	if(y > x && y >= z) return 1;
	return 2;
}
int per[3];
int min(int x, int y) { return per[x] < per[y] ? x : y; }
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for(int i = 1;i <= n;++i) {
		for(int j = 0;j < 3;++j) {
			cin >> rank[i][j];
			-- rank[i][j];
		}
	}
	for(int i = 0;i <= n;++i) {
		dp[i].emplace_back(get(i, 0, n - i), 0);
		for(int j = 1;j + i <= n;++j) {
			int w = get(i, j, n - i - j);
			if(w != dp[i].back().first) {
				dp[i].emplace_back(w, j);
			}
		}
		dp[i].emplace_back(0, n + 1);
	}
	for(int i = n;i >= 1;--i) {
		for(int j = 0;j < 3;++j) per[rank[i][j]] = j;
		for(int j = 0;j < i;++j) {
			static std::vector<pr> res; res.clear();
			auto & A = dp[j];
			auto & B = dp[j + 1];
			for(int i = 1;i + 1 < (int) A.size();++i) {
				if(per[A[i].first] < per[A[i - 1].first]) {
					-- A[i].second;
				}
			}
			int id = 0;
			int x = 0, y = 0;
			for(;id < i;) {
				for(;A[x + 1].second <= id;) x += 1;
				for(;B[y + 1].second <= id;) y += 1;
				int w = min(A[x].first, B[y].first);
				if(!id || w != res.back().first) {
					res.emplace_back(w, id);
				}
				id = std::min(A[x + 1].second, B[y + 1].second);
			}
			res.swap(dp[j]);
			dp[j].emplace_back(0, i);
		}
	}
	cout << dp[0][0].first + 1 << '\n';
}

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

详细

Test #1:

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

input:

3
3 2 1
1 2 3
2 1 3

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

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

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

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

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #5:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

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

output:

1

result:

ok 1 number(s): "1"

Test #7:

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

input:

20
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

20
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3

output:

1

result:

ok 1 number(s): "1"

Test #9:

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

input:

20
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
1 2 3
1 2 3
3 2 1
3 1 2
1 2 3
3 2 1
1 2 3
2 3 1
3 1 2
3 2 1
3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #10:

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

input:

20
3 1 2
3 2 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
1 2 3
3 2 1
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
2 3 1
2 3 1
1 2 3
2 1 3
2 1 3

output:

1

result:

ok 1 number(s): "1"

Test #11:

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

input:

20
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
1 2 3
2 3 1
3 1 2
3 1 2
2 3 1
3 2 1
1 3 2
2 1 3
2 1 3
1 2 3
2 3 1
2 3 1
3 2 1
2 1 3
1 3 2

output:

2

result:

ok 1 number(s): "2"

Test #12:

score: 0
Accepted
time: 546ms
memory: 4684kb

input:

10000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #13:

score: 0
Accepted
time: 546ms
memory: 4700kb

input:

10000
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
2 3 1
1 3 2
1 3 2
2 1 3
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
1 2 3
3 2 1
2 1 3
3 2 1
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
2 1 3
2 1 3
2 3 1
2 3 1
3 2 1
3 2 1
3 1 2
3 2 1
1 2 3
1 2 3
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
1 3 2
2 1 3
2 3 1
2 3 1
3 1 2
1 3 2
3 1 2
3 2 1
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #14:

score: 0
Accepted
time: 551ms
memory: 4716kb

input:

10000
3 2 1
3 1 2
3 2 1
3 2 1
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 1 2
3 2 1
3 2 1
3 2 1
2 3 1
3 1 2
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 1 2
2 1 3
1 2 3
2 3 1
2 3 1
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
1 2 3
1 2 3
1 3 2
3 1 2
1 2 3
2 1 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #15:

score: 0
Accepted
time: 554ms
memory: 4732kb

input:

10000
1 2 3
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
3 2 1
1 2 3
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
3 1 2
1 2 3
2 3 1
1 2 3
2 1 3
2 1 3
2 3 1
2 3 1
2 1 3
1 3 2
1 2 3
2 1 3
1 2 3
1 3 2
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
3 1 2
2 1 3
3 2 1
3 2 1
3 2 1
3 1 2
2 1 3
1 2 3
3 1 2
2 3 1
2 1 3
3 2 1
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #16:

score: 0
Accepted
time: 552ms
memory: 4732kb

input:

10000
1 2 3
3 1 2
3 2 1
1 2 3
2 3 1
3 1 2
3 1 2
3 1 2
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
1 3 2
1 3 2
1 2 3
2 1 3
1 3 2
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
1 2 3
2 1 3
1 2 3
1 3 2
1 2 3
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 1 3
1 2 3
1 2 3
2 1 3
1 3 2
3 2 1
3 2 1
3 2 1
1 2 3
3 2 1
3 2 1
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #17:

score: 0
Accepted
time: 553ms
memory: 4764kb

input:

10000
2 1 3
1 3 2
3 2 1
2 1 3
1 3 2
3 1 2
1 2 3
3 2 1
2 3 1
1 2 3
2 1 3
1 2 3
1 3 2
3 2 1
1 2 3
2 1 3
2 1 3
2 1 3
3 2 1
2 3 1
1 2 3
2 3 1
3 1 2
3 2 1
1 3 2
1 2 3
1 3 2
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
3 2 1
2 1 3
3 1 2
3 1 2
3 2 1
1 3 2
3 1 2
2 3 1
2 3 1
1 3 2
2 1 3
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #18:

score: 0
Accepted
time: 543ms
memory: 4764kb

input:

10000
3 1 2
2 3 1
3 2 1
2 3 1
2 1 3
3 1 2
2 1 3
3 1 2
3 2 1
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 1 2
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
3 2 1
3 1 2
1 2 3
3 1 2
1 3 2
2 3 1
1 2 3
1 3 2
2 1 3
2 3 1
1 3 2
1 3 2
2 3 1
2 3 1
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
3 1 2
1 2 3
1 2 3
1 2 3
1 2 3
2 3 1
1 2 3
3 1 2
2 1 3
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #19:

score: 0
Accepted
time: 546ms
memory: 4708kb

input:

10000
3 2 1
1 2 3
3 2 1
3 1 2
3 1 2
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
3 2 1
3 1 2
2 1 3
2 1 3
2 1 3
2 3 1
3 1 2
1 3 2
3 2 1
3 2 1
3 2 1
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
1 3 2
3 1 2
1 2 3
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 1 3
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 2 1
3 2 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #20:

score: 0
Accepted
time: 551ms
memory: 4820kb

input:

10000
3 1 2
1 2 3
1 2 3
2 3 1
3 1 2
1 2 3
2 3 1
3 2 1
1 2 3
3 2 1
3 2 1
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
3 2 1
3 1 2
2 3 1
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
3 1 2
1 2 3
1 3 2
3 2 1
2 1 3
3 2 1
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
3 1 2
1 2 3
3 1 2
3 1 2
3 1 2
2 3 1
2 3 1
3 2 1
2 1 3
2 3 1
2 1 3
1 2 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #21:

score: 0
Accepted
time: 548ms
memory: 4756kb

input:

10000
2 1 3
1 3 2
3 1 2
3 2 1
3 1 2
2 3 1
2 3 1
1 2 3
2 1 3
1 3 2
1 2 3
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
3 2 1
1 3 2
2 1 3
3 2 1
3 2 1
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
3 1 2
2 1 3
1 3 2
3 2 1
1 3 2
3 2 1
1 3 2
3 2 1
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #22:

score: 0
Accepted
time: 552ms
memory: 4628kb

input:

10000
3 2 1
3 1 2
3 2 1
2 1 3
3 2 1
1 3 2
3 2 1
2 1 3
1 3 2
1 3 2
1 3 2
2 3 1
3 1 2
3 2 1
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3
1 2 3
1 3 2
2 1 3
1 2 3
2 3 1
2 1 3
2 1 3
2 1 3
3 1 2
1 2 3
3 1 2
2 3 1
3 1 2
1 3 2
1 3 2
3 2 1
2 1 3
2 1 3
3 1 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
2 1 3
3 1 2
2 1 3
1 3 2
3 1 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #23:

score: 0
Accepted
time: 549ms
memory: 4728kb

input:

10000
2 3 1
2 1 3
2 3 1
2 3 1
3 2 1
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
1 2 3
1 3 2
3 1 2
3 2 1
3 2 1
3 1 2
1 2 3
3 2 1
2 3 1
2 3 1
1 3 2
1 3 2
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
1 3 2
1 3 2
1 3 2
2 3 1
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
2 3 1
1 2 3
2 1 3
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
3 2 1
3 2 1
1 2 3
3 2 1
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #24:

score: 0
Accepted
time: 548ms
memory: 4752kb

input:

10000
1 3 2
2 1 3
2 1 3
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
1 2 3
1 3 2
2 3 1
3 1 2
3 2 1
1 2 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
3 2 1
2 1 3
2 3 1
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
2 1 3
2 1 3
...

output:

3

result:

ok 1 number(s): "3"

Test #25:

score: 0
Accepted
time: 550ms
memory: 4724kb

input:

10000
2 1 3
2 3 1
3 2 1
1 2 3
3 1 2
2 1 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
3 2 1
1 2 3
2 3 1
3 1 2
3 1 2
2 3 1
1 2 3
1 2 3
3 1 2
2 3 1
2 1 3
1 3 2
1 3 2
2 3 1
1 2 3
2 3 1
2 1 3
3 2 1
1 2 3
1 2 3
1 2 3
1 3 2
2 1 3
1 2 3
1 3 2
1 2 3
1 2 3
3 2 1
2 1 3
2 1 3
1 3 2
1 3 2
1 2 3
3 2 1
2 1 3
3 1 2
1 3 2
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #26:

score: 0
Accepted
time: 549ms
memory: 4612kb

input:

10000
2 1 3
3 1 2
1 2 3
2 1 3
3 1 2
1 3 2
2 1 3
3 2 1
3 1 2
1 3 2
1 3 2
3 2 1
2 1 3
1 2 3
3 1 2
1 2 3
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
2 1 3
2 3 1
2 1 3
2 3 1
3 2 1
2 3 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
3 1 2
2 1 3
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
3 1 2
2 1 3
2 1 3
1 3 2
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #27:

score: 0
Accepted
time: 567ms
memory: 4744kb

input:

10000
3 2 1
2 1 3
1 2 3
1 3 2
3 2 1
3 2 1
1 3 2
3 1 2
1 3 2
3 2 1
1 3 2
1 3 2
3 2 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
2 1 3
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
1 3 2
1 2 3
2 1 3
2 1 3
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #28:

score: 0
Accepted
time: 549ms
memory: 4748kb

input:

10000
1 3 2
1 3 2
2 3 1
2 3 1
1 3 2
2 1 3
2 1 3
2 1 3
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
3 1 2
1 3 2
1 3 2
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
1 2 3
2 1 3
1 3 2
2 1 3
3 1 2
2 3 1
1 2 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
1 2 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
3 2 1
2 3 1
2 3 1
1 3 2
3 1 2
1 3 2
3 2 1
2 3 1
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #29:

score: 0
Accepted
time: 547ms
memory: 4684kb

input:

10000
2 1 3
3 1 2
3 1 2
1 2 3
1 3 2
3 1 2
2 3 1
2 3 1
1 3 2
1 2 3
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 2 1
3 2 1
3 2 1
3 2 1
3 1 2
3 1 2
2 3 1
3 1 2
3 1 2
1 2 3
3 1 2
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
2 3 1
2 3 1
1 3 2
2 1 3
1 3 2
3 1 2
3 1 2
1 3 2
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #30:

score: 0
Accepted
time: 549ms
memory: 4772kb

input:

10000
1 2 3
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
3 2 1
1 3 2
2 1 3
2 1 3
1 2 3
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
3 2 1
3 1 2
3 2 1
1 3 2
2 3 1
3 1 2
1 3 2
1 3 2
2 1 3
3 1 2
2 1 3
2 3 1
3 1 2
2 3 1
3 2 1
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
2 1 3
2 3 1
2 1 3
1 3 2
3 2 1
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #31:

score: 0
Accepted
time: 550ms
memory: 4724kb

input:

10000
3 1 2
3 2 1
2 3 1
2 1 3
3 2 1
1 2 3
2 3 1
2 3 1
2 1 3
2 1 3
3 1 2
2 1 3
2 1 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
1 2 3
3 1 2
2 1 3
2 1 3
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 1 2
3 2 1
2 3 1
2 1 3
2 3 1
2 1 3
2 1 3
2 1 3
2 1 3
1 3 2
2 3 1
3 2 1
3 1 2
3 2 1
3 1 2
3 2 1
2 3 1
2 1 3
...

output:

2

result:

ok 1 number(s): "2"

Test #32:

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

input:

1000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
1...

output:

2

result:

ok 1 number(s): "2"

Test #33:

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

input:

1000
2 3 1
3 2 1
2 1 3
1 3 2
1 2 3
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
2 3 1
3 2 1
2 1 3
3 2 1
3 1 2
3 2 1
2 1 3
1 3 2
3 1 2
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
1 2 3
2 1 3
1 3 2
3 1 2
1 2 3
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 2 1
1 3 2
3 2 1
2 3 1
2 3 1
3 1 2
3 2 1
3 1 2
1 2 3
1 3 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #34:

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

input:

1000
2 1 3
2 3 1
3 2 1
2 1 3
2 3 1
1 2 3
3 2 1
3 1 2
2 3 1
2 3 1
3 2 1
1 2 3
1 2 3
2 3 1
1 3 2
2 1 3
1 2 3
3 2 1
3 1 2
1 2 3
2 3 1
2 3 1
1 2 3
3 2 1
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
2 1 3
2 3 1
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
2 3 1
3 2 1
3 1 2
2 1 3
3 2 1
1 2 3
1 2 3
1...

output:

2

result:

ok 1 number(s): "2"

Test #35:

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

input:

1000
3 2 1
1 2 3
3 2 1
2 3 1
2 3 1
2 3 1
3 2 1
2 3 1
3 1 2
2 1 3
2 3 1
2 1 3
2 1 3
3 2 1
3 2 1
3 2 1
1 2 3
1 3 2
3 1 2
2 3 1
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
1 3 2
2 1 3
3 2 1
1 2 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
2 1 3
2 1 3
3 2 1
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
1...

output:

1

result:

ok 1 number(s): "1"

Test #36:

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

input:

1000
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
3 2 1
3 1 2
3 1 2
2 3 1
1 3 2
1 3 2
3 2 1
3 1 2
1 2 3
1 3 2
1 2 3
2 3 1
1 3 2
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
1 3 2
3 1 2
3 1 2
2 1 3
3 1 2
3 1 2
2 1 3
2 3 1
1 2 3
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
3 2 1
1 2 3
1 2 3
2 3 1
3 1 2
2 3 1
1 2 3
1 2 3
1 3 2
3 1 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #37:

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

input:

1000
1 3 2
3 1 2
2 1 3
3 2 1
2 1 3
1 2 3
3 2 1
1 2 3
3 2 1
3 2 1
1 2 3
3 1 2
3 1 2
2 3 1
1 2 3
1 3 2
3 1 2
3 2 1
1 2 3
3 2 1
2 3 1
3 2 1
2 1 3
1 3 2
1 3 2
3 2 1
1 2 3
3 1 2
1 2 3
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
2 3 1
1 2 3
3 2 1
2 3 1
2 1 3
1 3 2
3 2 1
3 1 2
1 2 3
1 2 3
3 1 2
3 1 2
1 3 2
3 2 1
3 1 2
2...

output:

3

result:

ok 1 number(s): "3"

Test #38:

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

input:

1000
1 2 3
1 3 2
2 1 3
2 3 1
3 2 1
2 3 1
2 1 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
3 2 1
1 2 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 1 2
3 2 1
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
2 3 1
3 1 2
2 3 1
1 2 3
2 3 1
2 3 1
1 3 2
1 3 2
2 3 1
3 1 2
1 3 2
1 2 3
2 1 3
3 2 1
2 3 1
2...

output:

2

result:

ok 1 number(s): "2"

Test #39:

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

input:

1000
1 2 3
1 3 2
1 2 3
2 1 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
3 1 2
3 1 2
3 2 1
1 2 3
1 3 2
3 2 1
1 3 2
3 1 2
3 1 2
3 2 1
3 1 2
2 3 1
2 1 3
3 2 1
2 1 3
2 1 3
3 2 1
3 1 2
2 3 1
1 3 2
3 1 2
1 2 3
1 2 3
1 3 2
2 1 3
1 3 2
1 2 3
1 3 2
2 1 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
3 2 1
2 1 3
1 3 2
3 1 2
1 3 2
3 1 2
1...

output:

3

result:

ok 1 number(s): "3"

Test #40:

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

input:

1000
1 2 3
2 3 1
1 2 3
1 3 2
1 3 2
2 1 3
1 3 2
2 1 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
3 2 1
1 2 3
2 1 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
1 3 2
2 3 1
3 1 2
2 1 3
1 3 2
2 3 1
2 1 3
1 3 2
3 2 1
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
3 2 1
3...

output:

3

result:

ok 1 number(s): "3"

Test #41:

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

input:

1000
1 2 3
3 1 2
2 3 1
3 2 1
3 2 1
2 3 1
3 2 1
1 2 3
2 1 3
2 1 3
3 1 2
2 1 3
2 3 1
3 2 1
2 1 3
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
3 2 1
2 1 3
1 2 3
1 3 2
2 1 3
1 3 2
2 1 3
1 2 3
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
1 3 2
1 3 2
1 2 3
2 3 1
1 2 3
2 3 1
2 3 1
2 1 3
1 3 2
2 1 3
2...

output:

1

result:

ok 1 number(s): "1"

Test #42:

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

input:

1000
1 3 2
1 3 2
2 3 1
2 3 1
1 3 2
2 1 3
1 2 3
3 2 1
2 1 3
3 1 2
3 1 2
1 3 2
2 1 3
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
2 3 1
3 2 1
1 2 3
3 1 2
1 2 3
1 3 2
3 2 1
2 1 3
1 2 3
3 2 1
3 1 2
2 1 3
2 3 1
3 1 2
2 3 1
1 3 2
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
1 2 3
2 1 3
3 1 2
2 1 3
3 2 1
2 1 3
2 3 1
3 2 1
2 1 3
2 3 1
1...

output:

1

result:

ok 1 number(s): "1"

Test #43:

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

input:

1000
3 1 2
1 3 2
1 3 2
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
3 2 1
1 3 2
3 2 1
2 3 1
2 3 1
3 1 2
3 1 2
2 3 1
3 2 1
1 2 3
3 2 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 1 3
2 3 1
3 1 2
2 1 3
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
3 2 1
3 1 2
2 3 1
3 2 1
3 1 2
2 1 3
1 3 2
1 3 2
2 1 3
3 1 2
3 2 1
3 2 1
1 3 2
1 2 3
1...

output:

3

result:

ok 1 number(s): "3"

Test #44:

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

input:

1000
1 3 2
1 2 3
2 3 1
1 2 3
3 2 1
3 1 2
3 1 2
1 3 2
2 1 3
1 3 2
1 2 3
3 1 2
1 3 2
1 2 3
3 2 1
1 2 3
1 2 3
3 1 2
2 1 3
3 2 1
3 1 2
3 1 2
3 1 2
3 2 1
3 2 1
2 1 3
2 1 3
1 3 2
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
1 2 3
3 2 1
2 1 3
1 2 3
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
3 2 1
2...

output:

2

result:

ok 1 number(s): "2"

Test #45:

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

input:

1000
2 3 1
3 2 1
1 3 2
1 2 3
1 3 2
3 1 2
1 2 3
1 3 2
3 1 2
3 2 1
3 2 1
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
1 3 2
1 2 3
2 3 1
3 2 1
2 1 3
2 1 3
3 2 1
1 3 2
3 1 2
2 1 3
1 3 2
3 1 2
3 2 1
3 2 1
2 3 1
1 3 2
2 1 3
3 1 2
2 3 1
1 2 3
2 3 1
3 1 2
3 2 1
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
2 1 3
1 2 3
3...

output:

3

result:

ok 1 number(s): "3"

Test #46:

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

input:

1000
2 1 3
3 1 2
2 3 1
2 3 1
3 1 2
2 1 3
1 3 2
2 1 3
1 3 2
2 3 1
2 1 3
1 2 3
3 1 2
2 1 3
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
1 3 2
1 3 2
3 1 2
3 1 2
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
1 3 2
2 1 3
2 3 1
1 2 3
2 3 1
1 2 3
2 3 1
1 2 3
1 2 3
2 1 3
1 3 2
1 2 3
3 2 1
3 1 2
1 2 3
2 1 3
1 2 3
3 2 1
2 1 3
1 3 2
1 3 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #47:

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

input:

1000
3 1 2
3 2 1
2 3 1
3 1 2
3 1 2
1 3 2
3 1 2
2 3 1
3 2 1
3 1 2
1 2 3
3 1 2
2 3 1
1 3 2
3 1 2
1 3 2
1 2 3
1 3 2
2 3 1
2 1 3
3 1 2
2 1 3
3 1 2
2 1 3
2 3 1
1 2 3
2 3 1
2 1 3
3 1 2
2 1 3
1 2 3
1 2 3
3 2 1
2 1 3
2 3 1
1 2 3
1 3 2
3 2 1
1 2 3
1 2 3
2 1 3
3 2 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
2 3 1
3 1 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #48:

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

input:

1000
2 3 1
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
2 3 1
1 3 2
1 2 3
3 1 2
3 2 1
1 2 3
1 3 2
2 1 3
3 2 1
1 2 3
3 1 2
1 2 3
2 3 1
2 3 1
1 3 2
1 3 2
2 3 1
3 2 1
2 3 1
3 1 2
3 2 1
2 1 3
3 1 2
3 1 2
1 2 3
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
1 2 3
1 3 2
3 1 2
2 1 3
3 1 2
1 3 2
1 3 2
1 3 2
1 3 2
1 2 3
2...

output:

2

result:

ok 1 number(s): "2"

Test #49:

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

input:

1000
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
1 3 2
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
3 2 1
2 3 1
3 2 1
2 1 3
2 3 1
3 1 2
2 3 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
2 3 1
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
2 1 3
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 2 1
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 2 1
3 2 1
3 1 2
3 1 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #50:

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

input:

1000
1 3 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
1 3 2
3 1 2
3 1 2
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
3 1 2
1 3 2
1 2 3
1 2 3
2 1 3
1 3 2
3 2 1
2 3 1
3 2 1
1 3 2
1 3 2
2 3 1
2 3 1
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
1 2 3
3 2 1
1 3 2
2 3 1
2 3 1
3 2 1
2 3 1
1...

output:

1

result:

ok 1 number(s): "1"

Test #51:

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

input:

1000
2 3 1
2 1 3
1 2 3
2 3 1
2 3 1
1 3 2
3 2 1
1 3 2
2 1 3
1 2 3
2 1 3
1 3 2
2 1 3
3 2 1
2 3 1
1 3 2
3 1 2
2 3 1
1 2 3
3 2 1
2 3 1
1 3 2
2 3 1
1 2 3
3 2 1
3 1 2
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
1 2 3
1 3 2
2 1 3
3 1 2
3 2 1
1 3 2
2 3 1
1 2 3
2 1 3
1 3 2
3 1 2
3 2 1
3 1 2
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #52:

score: 0
Accepted
time: 550ms
memory: 4828kb

input:

10000
1 3 2
3 2 1
1 2 3
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
1 2 3
1 3 2
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
3 1 2
2 1 3
2 1 3
3 1 2
3 1 2
2 1 3
1 2 3
2 1 3
3 1 2
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
3 1 2
1 3 2
3 2 1
3 1 2
2 3 1
2 3 1
2 3 1
3 1 2
1 3 2
2 1 3
1 3 2
2 3 1
2 3 1
3 1 2
3 1 2
3 2 1
2 3 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #53:

score: 0
Accepted
time: 542ms
memory: 4736kb

input:

10000
1 2 3
1 2 3
2 1 3
1 3 2
2 3 1
2 1 3
1 2 3
3 2 1
3 2 1
2 1 3
3 2 1
2 3 1
3 2 1
2 1 3
1 2 3
3 1 2
2 1 3
1 2 3
1 3 2
3 2 1
1 3 2
2 3 1
3 2 1
2 1 3
3 1 2
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
1 3 2
3 2 1
1 3 2
3 1 2
2 3 1
1 2 3
1 3 2
2 3 1
1 2 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 3 1
1 2 3
3 2 1
3 2 1
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #54:

score: 0
Accepted
time: 549ms
memory: 4716kb

input:

10000
3 2 1
2 1 3
1 3 2
2 3 1
2 3 1
1 2 3
1 2 3
3 1 2
1 2 3
1 3 2
1 2 3
1 3 2
3 2 1
2 3 1
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
2 3 1
1 3 2
2 1 3
3 1 2
2 1 3
1 2 3
2 3 1
3 2 1
3 1 2
3 1 2
3 1 2
3 2 1
2 3 1
3 2 1
3 1 2
3 2 1
2 1 3
1 3 2
2 1 3
3 2 1
1 3 2
2 3 1
3 1 2
2 1 3
3 1 2
2 3 1
2 1 3
3 1 2
2 3 1
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #55:

score: 0
Accepted
time: 541ms
memory: 4748kb

input:

10000
1 3 2
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
2 1 3
2 1 3
1 2 3
3 2 1
2 3 1
1 3 2
1 3 2
1 3 2
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
3 2 1
1 3 2
1 2 3
1 2 3
1 3 2
3 1 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
2 3 1
3 2 1
1 2 3
2 1 3
3 1 2
3 1 2
1 3 2
3 1 2
3 1 2
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 3 1
1 3 2
3 1 2
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #56:

score: 0
Accepted
time: 550ms
memory: 4728kb

input:

10000
3 1 2
2 1 3
2 3 1
1 3 2
2 3 1
1 2 3
3 1 2
1 3 2
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
3 2 1
1 2 3
1 3 2
2 1 3
1 2 3
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
1 2 3
3 2 1
3 1 2
1 3 2
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 2 3
1 3 2
2 1 3
1 3 2
3 1 2
1 3 2
2 3 1
1 2 3
1 2 3
3 2 1
1 2 3
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #57:

score: 0
Accepted
time: 548ms
memory: 4684kb

input:

10000
3 1 2
2 3 1
2 3 1
1 3 2
2 3 1
2 3 1
2 1 3
3 1 2
3 1 2
2 3 1
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
1 2 3
1 2 3
3 2 1
1 3 2
3 2 1
1 2 3
1 2 3
1 2 3
1 2 3
3 1 2
2 3 1
1 3 2
1 2 3
1 2 3
2 3 1
1 3 2
1 2 3
3 1 2
3 1 2
1 3 2
2 1 3
3 2 1
3 2 1
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 1 3
2 1 3
2 1 3
1 3 2
3 2 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #58:

score: 0
Accepted
time: 549ms
memory: 4772kb

input:

10000
3 2 1
2 1 3
1 3 2
3 1 2
1 3 2
3 1 2
1 3 2
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
2 3 1
3 2 1
2 1 3
1 2 3
2 1 3
1 3 2
3 1 2
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
1 3 2
1 3 2
2 3 1
3 1 2
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
2 1 3
3 2 1
2 3 1
3 1 2
2 1 3
2 1 3
1 3 2
3 2 1
2 1 3
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #59:

score: 0
Accepted
time: 546ms
memory: 4832kb

input:

10000
2 1 3
2 3 1
1 3 2
2 3 1
2 3 1
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
1 2 3
2 3 1
1 3 2
2 1 3
2 1 3
1 3 2
3 1 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
2 1 3
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
2 1 3
1 2 3
3 2 1
1 2 3
3 2 1
1 3 2
1 2 3
3 1 2
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #60:

score: 0
Accepted
time: 549ms
memory: 4744kb

input:

10000
2 1 3
1 2 3
1 3 2
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
2 1 3
1 2 3
2 3 1
2 1 3
3 1 2
1 2 3
2 1 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
3 2 1
2 3 1
1 3 2
2 3 1
3 1 2
2 1 3
1 2 3
3 1 2
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 1 2
3 1 2
2 1 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #61:

score: 0
Accepted
time: 550ms
memory: 4732kb

input:

10000
1 2 3
1 3 2
2 1 3
1 3 2
1 3 2
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
2 3 1
2 3 1
3 2 1
3 2 1
2 3 1
3 1 2
1 2 3
1 3 2
2 3 1
3 2 1
1 3 2
3 2 1
1 2 3
2 1 3
2 3 1
1 3 2
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
2 1 3
1 2 3
2 1 3
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
2 3 1
2 1 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #62:

score: 0
Accepted
time: 551ms
memory: 4756kb

input:

10000
1 2 3
3 1 2
3 1 2
2 1 3
1 3 2
2 1 3
2 1 3
3 1 2
1 2 3
3 2 1
2 1 3
2 1 3
1 2 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 2 3
1 3 2
2 3 1
3 2 1
2 3 1
2 3 1
2 1 3
1 2 3
2 3 1
1 3 2
1 3 2
1 3 2
1 2 3
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
3 1 2
3 1 2
2 3 1
2 3 1
3 2 1
1 3 2
1 2 3
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #63:

score: 0
Accepted
time: 547ms
memory: 4816kb

input:

10000
2 1 3
3 1 2
3 2 1
1 2 3
3 1 2
1 2 3
2 1 3
3 1 2
3 1 2
1 2 3
2 1 3
1 2 3
2 3 1
1 3 2
1 2 3
3 1 2
3 2 1
3 2 1
2 3 1
3 2 1
2 1 3
2 1 3
3 1 2
1 3 2
2 3 1
2 1 3
1 3 2
2 3 1
2 3 1
2 1 3
3 2 1
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
2 1 3
2 1 3
3 1 2
3 2 1
3 2 1
1 2 3
...

output:

2

result:

ok 1 number(s): "2"

Test #64:

score: 0
Accepted
time: 551ms
memory: 4680kb

input:

10000
2 3 1
3 2 1
1 2 3
2 3 1
1 2 3
1 2 3
3 1 2
1 3 2
2 3 1
1 2 3
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
1 3 2
2 3 1
1 2 3
1 2 3
3 2 1
2 1 3
2 3 1
1 2 3
3 2 1
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
1 2 3
1 3 2
1 3 2
3 1 2
3 1 2
2 1 3
3 1 2
1 3 2
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
2 3 1
2 3 1
1 3 2
2 3 1
1 3 2
2 1 3
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #65:

score: 0
Accepted
time: 545ms
memory: 4728kb

input:

10000
2 1 3
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
3 2 1
3 1 2
2 3 1
2 3 1
1 3 2
2 3 1
2 3 1
3 2 1
3 2 1
2 3 1
2 3 1
2 3 1
2 1 3
3 2 1
3 1 2
1 2 3
2 1 3
2 1 3
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
2 1 3
2 1 3
2 3 1
1 3 2
2 3 1
3 2 1
1 3 2
3 1 2
1 2 3
1 2 3
1 2 3
3 1 2
3 1 2
1 2 3
2 3 1
2 1 3
3 2 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #66:

score: 0
Accepted
time: 552ms
memory: 4824kb

input:

10000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #67:

score: 0
Accepted
time: 549ms
memory: 4752kb

input:

10000
1 3 2
1 3 2
2 3 1
1 2 3
3 1 2
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
2 3 1
2 1 3
1 3 2
2 3 1
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
3 2 1
3 1 2
2 1 3
3 1 2
3 1 2
2 3 1
3 1 2
1 3 2
3 2 1
3 1 2
1 2 3
2 3 1
3 2 1
1 3 2
2 1 3
1 2 3
2 1 3
1 2 3
3 2 1
3 2 1
1 3 2
1 3 2
2 1 3
1 3 2
3 1 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #68:

score: 0
Accepted
time: 554ms
memory: 4716kb

input:

10000
3 1 2
2 1 3
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
2 3 1
2 3 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
3 1 2
2 3 1
3 1 2
1 2 3
2 3 1
3 1 2
1 2 3
1 3 2
2 1 3
1 3 2
2 1 3
2 3 1
2 3 1
3 2 1
1 2 3
1 3 2
3 2 1
3 2 1
2 1 3
1 2 3
2 3 1
1 3 2
3 1 2
1 3 2
1 3 2
3 2 1
1 3 2
2 1 3
1 3 2
1 2 3
2 3 1
3 2 1
1 2 3
1 2 3
2 1 3
...

output:

2

result:

ok 1 number(s): "2"

Test #69:

score: 0
Accepted
time: 550ms
memory: 4760kb

input:

10000
3 2 1
3 1 2
2 1 3
1 2 3
1 3 2
3 2 1
1 2 3
3 1 2
1 2 3
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
3 1 2
3 1 2
3 2 1
3 2 1
2 3 1
1 2 3
1 2 3
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
2 1 3
2 1 3
2 3 1
1 3 2
1 2 3
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
2 1 3
2 3 1
1 2 3
2 1 3
3 1 2
1 3 2
3 2 1
2 3 1
2 1 3
2 1 3
2 1 3
2 1 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #70:

score: 0
Accepted
time: 548ms
memory: 4716kb

input:

10000
1 2 3
1 3 2
1 3 2
2 1 3
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 1 2
1 3 2
3 2 1
1 2 3
2 3 1
3 1 2
2 1 3
1 2 3
3 2 1
3 2 1
1 2 3
2 1 3
3 1 2
2 3 1
3 2 1
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
1 2 3
2 1 3
3 1 2
2 3 1
1 3 2
3 2 1
3 1 2
3 1 2
1 2 3
2 1 3
1 2 3
3 2 1
3 2 1
2 1 3
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #71:

score: 0
Accepted
time: 551ms
memory: 4752kb

input:

10000
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
1 2 3
1 3 2
2 3 1
2 1 3
1 2 3
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
3 2 1
1 3 2
3 1 2
1 2 3
3 2 1
2 1 3
3 2 1
1 2 3
2 3 1
1 2 3
3 2 1
1 3 2
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
2 1 3
1 3 2
1 3 2
1 2 3
3 1 2
1 2 3
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
3 1 2
1 2 3
2 1 3
1 3 2
1 3 2
2 1 3
...

output:

3

result:

ok 1 number(s): "3"

Test #72:

score: 0
Accepted
time: 543ms
memory: 4676kb

input:

10000
3 1 2
2 1 3
1 3 2
2 3 1
2 3 1
1 2 3
1 3 2
3 2 1
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
3 2 1
2 1 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
1 3 2
3 1 2
1 3 2
1 3 2
3 1 2
3 1 2
3 1 2
2 3 1
1 3 2
2 3 1
2 1 3
2 1 3
2 1 3
3 2 1
3 1 2
1 2 3
3 2 1
3 2 1
1 2 3
3 2 1
1 3 2
1 2 3
3 2 1
1 3 2
2 3 1
3 2 1
3 1 2
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #73:

score: 0
Accepted
time: 549ms
memory: 4824kb

input:

10000
1 3 2
3 1 2
3 1 2
3 2 1
3 1 2
1 3 2
1 2 3
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
3 2 1
2 3 1
3 1 2
3 2 1
2 3 1
2 3 1
2 3 1
1 3 2
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
3 2 1
2 3 1
2 3 1
1 2 3
3 2 1
2 3 1
1 3 2
3 2 1
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
1 2 3
...

output:

2

result:

ok 1 number(s): "2"

Test #74:

score: 0
Accepted
time: 550ms
memory: 4764kb

input:

10000
3 1 2
1 2 3
3 1 2
3 1 2
1 3 2
2 3 1
1 2 3
3 1 2
3 2 1
1 3 2
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
2 1 3
3 2 1
3 2 1
3 2 1
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
1 3 2
3 2 1
3 1 2
2 1 3
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
3 2 1
3 1 2
2 3 1
2 3 1
3 2 1
1 2 3
3 2 1
3 1 2
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #75:

score: 0
Accepted
time: 551ms
memory: 4828kb

input:

10000
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
2 3 1
3 1 2
3 1 2
1 2 3
3 2 1
2 1 3
1 3 2
1 3 2
3 2 1
2 3 1
1 3 2
1 3 2
2 1 3
3 2 1
1 3 2
3 2 1
2 3 1
2 1 3
1 3 2
1 2 3
2 3 1
2 3 1
2 3 1
1 2 3
1 2 3
3 1 2
1 3 2
2 3 1
2 1 3
2 3 1
2 1 3
3 1 2
1 2 3
1 3 2
2 3 1
1 3 2
1 3 2
3 2 1
1 3 2
2 3 1
1 2 3
2 1 3
2 1 3
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #76:

score: 0
Accepted
time: 550ms
memory: 4756kb

input:

10000
1 3 2
1 2 3
2 1 3
2 1 3
1 2 3
1 3 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
2 1 3
2 1 3
3 1 2
1 2 3
3 1 2
3 2 1
2 1 3
2 1 3
2 3 1
2 3 1
1 3 2
3 1 2
3 1 2
1 2 3
3 2 1
2 1 3
3 2 1
3 2 1
1 3 2
3 2 1
2 3 1
1 2 3
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
2 3 1
3 1 2
3 2 1
3 2 1
1 3 2
2 1 3
1 2 3
1 2 3
2 3 1
2 1 3
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #77:

score: 0
Accepted
time: 549ms
memory: 4684kb

input:

10000
2 1 3
3 2 1
3 1 2
1 2 3
1 2 3
2 3 1
1 2 3
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
2 1 3
1 3 2
1 3 2
2 1 3
1 2 3
3 2 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
2 3 1
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
2 1 3
2 1 3
3 2 1
2 3 1
2 1 3
3 2 1
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #78:

score: 0
Accepted
time: 549ms
memory: 4784kb

input:

10000
3 2 1
1 2 3
2 3 1
3 2 1
1 3 2
3 2 1
3 2 1
2 3 1
3 1 2
1 2 3
1 2 3
1 3 2
1 2 3
1 3 2
2 3 1
2 3 1
1 2 3
3 1 2
3 2 1
3 1 2
2 1 3
1 2 3
1 2 3
2 1 3
1 3 2
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 1 3
1 3 2
3 1 2
3 1 2
2 3 1
1 2 3
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
2 1 3
1 2 3
1 3 2
2 3 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #79:

score: 0
Accepted
time: 547ms
memory: 4736kb

input:

10000
3 1 2
2 1 3
3 2 1
2 1 3
3 1 2
1 2 3
2 3 1
2 1 3
3 1 2
3 2 1
1 3 2
3 2 1
2 3 1
1 2 3
2 3 1
1 3 2
2 3 1
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
3 2 1
3 1 2
3 2 1
1 2 3
2 1 3
3 2 1
2 1 3
2 3 1
1 3 2
1 3 2
3 2 1
2 1 3
1 3 2
2 3 1
3 1 2
2 1 3
3 1 2
3 2 1
1 2 3
2 1 3
1 3 2
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #80:

score: 0
Accepted
time: 547ms
memory: 4676kb

input:

10000
3 1 2
3 1 2
3 1 2
3 2 1
1 3 2
1 2 3
2 1 3
2 1 3
2 3 1
2 1 3
1 3 2
3 2 1
2 1 3
1 2 3
1 3 2
2 1 3
3 2 1
3 1 2
3 1 2
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
1 2 3
2 1 3
2 1 3
3 1 2
2 3 1
1 2 3
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
2 3 1
2 1 3
2 1 3
2 1 3
3 2 1
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #81:

score: 0
Accepted
time: 549ms
memory: 4744kb

input:

10000
3 1 2
2 1 3
2 1 3
3 1 2
1 3 2
1 3 2
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
1 2 3
3 2 1
2 3 1
3 2 1
3 2 1
2 3 1
2 1 3
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
2 1 3
2 3 1
2 1 3
3 2 1
3 1 2
2 1 3
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
3 1 2
3 1 2
1 2 3
3 1 2
2 1 3
3 2 1
1 3 2
2 1 3
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #82:

score: 0
Accepted
time: 550ms
memory: 4736kb

input:

10000
1 2 3
3 2 1
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
2 3 1
2 3 1
3 1 2
2 1 3
1 3 2
3 2 1
3 2 1
1 3 2
2 1 3
3 2 1
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
1 3 2
3 1 2
2 3 1
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
3 1 2
3 1 2
2 3 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
1 2 3
1 2 3
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
1 2 3
3 2 1
...

output:

3

result:

ok 1 number(s): "3"

Test #83:

score: 0
Accepted
time: 544ms
memory: 4804kb

input:

10000
1 3 2
2 3 1
1 3 2
2 1 3
1 3 2
3 1 2
3 1 2
2 3 1
3 1 2
2 3 1
2 3 1
3 1 2
3 2 1
3 1 2
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
1 3 2
1 2 3
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
3 1 2
2 3 1
1 3 2
3 1 2
2 3 1
3 1 2
3 1 2
3 2 1
3 1 2
3 2 1
3 1 2
3 2 1
1 2 3
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #84:

score: 0
Accepted
time: 549ms
memory: 4732kb

input:

10000
3 2 1
3 1 2
3 1 2
1 2 3
1 2 3
2 3 1
1 2 3
3 2 1
1 3 2
1 3 2
2 3 1
3 2 1
2 3 1
1 3 2
2 1 3
1 2 3
2 3 1
3 2 1
3 2 1
1 2 3
3 2 1
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
3 2 1
1 2 3
3 2 1
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
1 2 3
3 1 2
2 3 1
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
1 2 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #85:

score: 0
Accepted
time: 552ms
memory: 4732kb

input:

10000
3 1 2
1 3 2
2 3 1
2 3 1
3 1 2
2 1 3
2 1 3
2 3 1
2 1 3
2 1 3
3 2 1
3 2 1
3 1 2
3 2 1
3 1 2
2 1 3
1 3 2
3 2 1
2 3 1
1 3 2
3 2 1
1 2 3
3 2 1
1 3 2
1 3 2
3 2 1
1 3 2
1 2 3
2 1 3
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
1 2 3
3 2 1
3 1 2
2 1 3
2 1 3
2 1 3
1 2 3
1 2 3
3 1 2
2 1 3
2 3 1
1 3 2
1 2 3
2 1 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #86:

score: 0
Accepted
time: 549ms
memory: 4748kb

input:

10000
1 2 3
2 3 1
2 3 1
3 2 1
3 1 2
1 3 2
3 1 2
3 2 1
1 2 3
2 1 3
1 2 3
2 1 3
3 1 2
3 2 1
3 1 2
1 2 3
2 1 3
1 3 2
1 2 3
1 2 3
1 3 2
3 1 2
1 3 2
1 2 3
3 2 1
1 3 2
3 2 1
2 1 3
2 3 1
2 1 3
2 1 3
1 3 2
2 1 3
1 2 3
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
1 3 2
1 2 3
2 1 3
2 1 3
2 3 1
2 3 1
1 2 3
...

output:

3

result:

ok 1 number(s): "3"

Test #87:

score: 0
Accepted
time: 553ms
memory: 4712kb

input:

10000
1 3 2
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
3 1 2
3 2 1
3 2 1
1 2 3
3 1 2
1 3 2
3 2 1
2 3 1
3 2 1
2 1 3
3 2 1
2 1 3
3 2 1
3 1 2
2 3 1
3 1 2
3 2 1
2 1 3
2 1 3
1 2 3
1 2 3
1 3 2
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
3 2 1
1 3 2
3 1 2
3 1 2
2 3 1
2 3 1
3 1 2
3 1 2
2 1 3
2 1 3
2 3 1
1 2 3
2 3 1
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #88:

score: 0
Accepted
time: 545ms
memory: 4672kb

input:

10000
1 2 3
1 3 2
3 1 2
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
3 2 1
3 1 2
3 2 1
1 2 3
1 3 2
1 2 3
2 3 1
2 3 1
3 2 1
2 3 1
3 2 1
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
3 1 2
1 2 3
3 1 2
1 3 2
3 2 1
3 1 2
3 1 2
1 3 2
3 1 2
3 1 2
1 3 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
2 3 1
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #89:

score: 0
Accepted
time: 547ms
memory: 4716kb

input:

10000
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
3 1 2
2 1 3
2 1 3
2 1 3
3 1 2
2 1 3
1 2 3
3 2 1
2 1 3
3 1 2
3 1 2
2 1 3
2 1 3
1 2 3
1 3 2
1 2 3
3 2 1
3 2 1
2 1 3
2 1 3
1 2 3
2 3 1
3 2 1
1 3 2
2 3 1
1 3 2
3 1 2
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
3 2 1
3 2 1
2 1 3
3 2 1
3 1 2
3 2 1
1 2 3
2 1 3
3 1 2
2 1 3
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #90:

score: 0
Accepted
time: 543ms
memory: 4820kb

input:

10000
1 2 3
1 2 3
2 3 1
1 3 2
1 3 2
3 1 2
1 3 2
1 3 2
2 1 3
2 3 1
2 1 3
1 2 3
2 1 3
2 1 3
2 3 1
1 3 2
1 3 2
1 2 3
2 1 3
1 3 2
1 2 3
1 2 3
1 3 2
1 2 3
2 3 1
2 3 1
3 1 2
1 3 2
1 2 3
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
1 3 2
1 2 3
2 1 3
3 1 2
1 3 2
3 1 2
2 3 1
3 2 1
3 1 2
3 1 2
1 2 3
1 2 3
2 1 3
2 1 3
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #91:

score: 0
Accepted
time: 543ms
memory: 4688kb

input:

10000
3 2 1
3 1 2
1 2 3
2 3 1
2 3 1
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
1 3 2
2 3 1
2 1 3
3 2 1
2 1 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
1 2 3
3 1 2
1 2 3
2 3 1
1 2 3
3 1 2
1 3 2
1 2 3
1 2 3
1 3 2
3 2 1
2 1 3
1 2 3
1 2 3
2 1 3
3 2 1
1 3 2
3 1 2
1 3 2
2 3 1
3 2 1
3 2 1
2 1 3
3 1 2
1 3 2
3 2 1
3 2 1
3 2 1
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #92:

score: 0
Accepted
time: 551ms
memory: 4772kb

input:

10000
3 2 1
1 3 2
3 2 1
1 2 3
3 2 1
1 2 3
3 2 1
3 1 2
3 2 1
1 2 3
1 2 3
1 2 3
2 1 3
3 1 2
3 1 2
1 3 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
3 2 1
1 2 3
2 1 3
3 2 1
2 1 3
1 2 3
2 1 3
2 3 1
1 2 3
1 2 3
3 2 1
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
2 3 1
2 1 3
3 1 2
3 2 1
3 2 1
2 3 1
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #93:

score: 0
Accepted
time: 547ms
memory: 4816kb

input:

10000
2 3 1
3 2 1
3 2 1
3 2 1
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
1 2 3
1 2 3
2 3 1
2 3 1
1 2 3
2 1 3
1 3 2
1 2 3
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
1 3 2
2 1 3
1 3 2
2 3 1
1 3 2
3 1 2
1 3 2
2 3 1
2 3 1
3 1 2
3 2 1
2 3 1
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #94:

score: 0
Accepted
time: 549ms
memory: 4824kb

input:

10000
1 3 2
1 2 3
3 2 1
2 1 3
2 1 3
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
1 3 2
1 2 3
2 1 3
3 1 2
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
2 1 3
2 1 3
1 2 3
1 2 3
2 1 3
1 2 3
3 1 2
1 2 3
3 1 2
3 1 2
1 2 3
3 2 1
1 2 3
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
3 2 1
2 1 3
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
1 3 2
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #95:

score: 0
Accepted
time: 548ms
memory: 4740kb

input:

10000
1 3 2
3 2 1
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
3 2 1
2 3 1
2 3 1
2 3 1
2 3 1
3 2 1
2 1 3
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 1 2
2 1 3
1 3 2
2 3 1
3 2 1
2 1 3
2 3 1
3 1 2
3 1 2
1 3 2
3 2 1
3 1 2
1 3 2
2 3 1
1 2 3
3 1 2
2 3 1
2 3 1
3 2 1
3 2 1
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
3 1 2
2 1 3
3 1 2
1 3 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #96:

score: 0
Accepted
time: 550ms
memory: 4752kb

input:

10000
2 3 1
1 2 3
1 2 3
1 2 3
2 1 3
2 1 3
1 2 3
3 2 1
3 1 2
1 2 3
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
1 3 2
1 2 3
3 2 1
2 3 1
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
3 2 1
1 2 3
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
1 2 3
1 2 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #97:

score: 0
Accepted
time: 545ms
memory: 4744kb

input:

10000
1 3 2
2 3 1
3 1 2
2 3 1
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
1 3 2
2 3 1
3 1 2
3 1 2
1 2 3
3 1 2
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
2 1 3
2 1 3
2 3 1
2 3 1
2 3 1
2 1 3
1 3 2
2 3 1
3 1 2
1 3 2
1 2 3
1 3 2
3 2 1
3 1 2
3 1 2
2 1 3
2 1 3
2 1 3
1 2 3
3 1 2
1 2 3
1 2 3
3 1 2
2 1 3
3 1 2
1 2 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #98:

score: 0
Accepted
time: 552ms
memory: 4720kb

input:

10000
1 2 3
2 1 3
2 1 3
3 1 2
2 1 3
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
2 3 1
3 2 1
2 1 3
2 3 1
1 2 3
1 3 2
3 2 1
2 3 1
3 1 2
3 2 1
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
2 3 1
3 2 1
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
1 3 2
3 1 2
3 1 2
2 1 3
1 2 3
3 1 2
2 1 3
1 2 3
2 3 1
1 3 2
1 2 3
1 2 3
3 2 1
3 1 2
2 3 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #99:

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

input:

1
1 2 3

output:

1

result:

ok 1 number(s): "1"

Test #100:

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

input:

1
2 3 1

output:

2

result:

ok 1 number(s): "2"

Test #101:

score: 0
Accepted
time: 549ms
memory: 4668kb

input:

10000
2 3 1
3 1 2
3 2 1
3 2 1
1 2 3
1 2 3
2 3 1
3 2 1
1 3 2
1 3 2
2 3 1
1 2 3
3 2 1
3 2 1
2 3 1
1 3 2
2 1 3
1 3 2
2 1 3
1 3 2
1 3 2
3 1 2
2 3 1
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
1 2 3
3 2 1
1 2 3
2 3 1
2 3 1
2 3 1
2 3 1
2 3 1
2 1 3
2 1 3
2 1 3
2 3 1
2 3 1
2 3 1
2 3 1
3 2 1
2 1 3
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #102:

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

input:

1000
1 3 2
2 3 1
2 1 3
3 1 2
1 3 2
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
1 3 2
1 2 3
2 1 3
1 2 3
1 3 2
1 2 3
3 2 1
2 3 1
3 2 1
2 1 3
1 3 2
2 3 1
2 3 1
3 2 1
2 1 3
3 1 2
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
1 2 3
3 2 1
3 2 1
2 1 3
3 2 1
3 2 1
2 3 1
3 2 1
1 2 3
1 2 3
2 3 1
1 2 3
3 2 1
1 2 3
1 3 2
1 3 2
2 3 1
2 1 3
2...

output:

2

result:

ok 1 number(s): "2"

Test #103:

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

input:

500
1 3 2
2 3 1
2 1 3
2 1 3
3 1 2
2 1 3
3 1 2
2 3 1
3 2 1
1 2 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
3 1 2
3 1 2
3 1 2
1 3 2
1 2 3
2 1 3
1 3 2
2 1 3
3 2 1
1 3 2
1 3 2
3 1 2
1 2 3
2 3 1
3 2 1
1 2 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
3 2 1
2 3 1
1 3 2
2 1 3
2 1 3
3 ...

output:

1

result:

ok 1 number(s): "1"

Test #104:

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

input:

300
3 1 2
2 3 1
1 2 3
3 2 1
1 2 3
2 1 3
3 1 2
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
2 3 1
1 2 3
2 3 1
2 1 3
3 1 2
3 1 2
2 1 3
2 1 3
2 3 1
2 1 3
3 1 2
1 3 2
3 2 1
1 3 2
3 1 2
1 3 2
2 1 3
1 3 2
2 1 3
1 2 3
2 1 3
3 2 1
2 1 3
1 2 3
2 1 3
1 3 2
3 1 2
1 3 2
2 1 3
1 3 2
3 2 1
3 1 2
3 1 2
2 1 3
1 3 2
2 3 1
3 2 1
1 ...

output:

1

result:

ok 1 number(s): "1"

Test #105:

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

input:

100
3 2 1
3 1 2
1 2 3
2 1 3
3 2 1
3 2 1
1 2 3
1 3 2
3 1 2
3 2 1
3 1 2
1 3 2
3 2 1
2 1 3
2 1 3
3 2 1
2 1 3
3 2 1
1 3 2
3 2 1
1 2 3
1 3 2
3 2 1
3 1 2
1 3 2
3 1 2
3 1 2
3 1 2
1 3 2
3 1 2
2 1 3
1 3 2
1 2 3
3 1 2
3 2 1
1 2 3
1 3 2
3 2 1
1 3 2
1 3 2
2 1 3
1 3 2
3 2 1
3 2 1
2 1 3
1 3 2
3 1 2
1 2 3
1 2 3
2 ...

output:

2

result:

ok 1 number(s): "2"

Extra Test:

score: 0
Extra Test Passed