from collections import defaultdict D=defaultdict(lambda:[10**9]*10) for i in range(1,10**5): if 10**9