import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import lru_cache MOD = 10 ** 9 + 7 def cut(edges): if edges == [1, 1, 1]: raise StopIteration n = len(edges) # 辺上 for i in range(1, n): x = edges[i] for j in range(1, x): if i == n - 1 and j != x - 1: continue if i == 1 and edges[0] == 1 and j != 1: continue left = [edges[0] - 1] + list(edges[1:i]) + [j, 1] right = [1, x - j] + list(edges[i + 1:]) left = tuple(x for x in left if x > 0) right = tuple(x for x in right if x > 0) yield((left, right)) # 頂点 for i in range(2, n): if i == 2 and edges[0] == 1 and edges[1] != 1: continue if i == n - 1 and edges[n - 1] != 1: continue left = [edges[0] - 1] + list(edges[1:i]) + [1] right = [1] + list(edges[i:]) left = tuple(x for x in left if x) right = tuple(x for x in right if x) yield((left, right)) @lru_cache(None) def f(edges): if len(edges) < 3: return 1 if edges == (1, 1, 1): return 1 ret = sum(f(x) * f(y) for x, y in cut(edges)) ret %= MOD return ret N = int(readline()) m = map(int, read().split()) for a, b, c in zip(m, m, m): print(f((a + 1, b + 1, c + 1)))