s = [input() for i in range(4)]
for i in range(4):
for j in range(i+1, 4):
print(s[i], s[j], sum(a!=b for (a, b) in [*zip(s[i], s[j])]))
print((lambda s:
([(
(s[i], s[j], sum(a != b for (a, b) in [*zip(s[i], s[j])]))
for i in range(4) for j in range(i+1, 4)
)])
)
(input() for i in range(4)))
print(*['{} {} {}'.format(*i) for i in (lambda s, a: (a, [[a.append((s[i], s[j], sum(a != b for (a, b) in [*zip(s[i], s[j])]))) for j in range(i+1, len(s))] for i in range(len(s)-1)]))([input() for i in range(4)], [])[0]], sep='\n')