from sys import stdin
from itertools import groupby
from operator import itemgetter, add
groups = stdin.read().split("\n\n")
keys = groups[::2]
values = groups[1::2]
by_key = groupby(sorted(zip(keys, values)), itemgetter(0))
res = {k: reduce(add, (s[1].split("\n") for s in v)) for k, v in by_key}
print res
ZnJvbSBzeXMgaW1wb3J0IHN0ZGluCmZyb20gaXRlcnRvb2xzIGltcG9ydCBncm91cGJ5CmZyb20gb3BlcmF0b3IgaW1wb3J0IGl0ZW1nZXR0ZXIsIGFkZAoKZ3JvdXBzID0gc3RkaW4ucmVhZCgpLnNwbGl0KCJcblxuIikKa2V5cyA9IGdyb3Vwc1s6OjJdCnZhbHVlcyA9IGdyb3Vwc1sxOjoyXQpieV9rZXkgPSBncm91cGJ5KHNvcnRlZCh6aXAoa2V5cywgdmFsdWVzKSksIGl0ZW1nZXR0ZXIoMCkpCnJlcyA9IHtrOiByZWR1Y2UoYWRkLCAoc1sxXS5zcGxpdCgiXG4iKSBmb3IgcyBpbiB2KSkgZm9yIGssIHYgaW4gYnlfa2V5fQpwcmludCByZXM=
{'key3': ['value1'], 'key2': ['value1', 'value2', 'value3', 'value4'], 'key1': ['extra1', 'extra2', 'value1', 'value2', 'value3'], 'key4': ['value1', 'value2']}