n = int(input()) # 读取测试数据的组数 for i in range(n): line = map(int,input().slipt()) count=sum(line)-max(line) print(count)