#1 判断大小写
letter = input()
if letter in ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']:
print("up")
else:
print('low')
#2 根据min max字符串输入返回对应结果
s = input()
a,b = list(map(int,input().split()))
if s == "min":
print(min(a,b))
else:
print(max(a,b))
#3 猜拳,0>2,1>0,2>1; 也就是石头剪刀布.
# 输入T场的 bob ,alice 拥有的 0 1 2 数量;
# 输出 T 场 alice 的最大的可赢场次;
def max_wins_against_bob(num_rounds, bob_moves, alice_counts):
bob_counts = {0: 0, 1: 0, 2: 0}
for move in bob_moves:
bob_counts[move] += 1
wins_with_rock = min(alice_counts[0], bob_counts[2])
wins_with_paper = min(alice_counts[1], bob_counts[0])
wins_with_scissors = min(alice_counts[2], bob_counts[1])
return wins_with_rock + wins_with_paper + wins_with_scissors
test_cases = int(input())
round_counts = []
bob_moves_list = []
alice_hand_counts = []
for _ in range(test_cases):
round_counts.append(int(input()))
bob_moves_list.append(list(map(int, input().split())))
alice_hand_counts.append(list(map(int, input().split())))
for i in range(test_cases):
print(max_wins_against_bob(round_counts[i], bob_moves_list[i], alice_hand_counts[i]))
#电信求职进展汇总##电信笔试#