import io import sys from collections import defaultdict, deque, Counter from itertools import permutations, combinations, accumulate from heapq import heappush, heappop from bisect import bisect_right, bisect_left from math import gcd import math _INPUT = """\ 6 7 3 5 4 3 2 1 9 4 1 1 2 2 5 1 2 3 4 5 3 1 1 1 12 4 8 9 10 3 6 4 2 1 7 11 9 """ def input(): return sys.stdin.readline()[:-1] def solve(test): N=int(input()) A=list(map(int, input().split())) ans=[] Y=defaultdict(int) for i in range(N): Y[A[i]]+=1 two=set([key for key in Y if Y[key]==2]) three=[key for key in Y if Y[key]>=3] if len(three)>0: # print('x') print(len(ans)) print(*ans) else: now=0 tmp=two.copy() while now