from collections import defaultdict

data = []
while True:
    try:
        data.append(input())
    except:
        break

cnt = defaultdict(int)
for line in data:
    line = line.replace("\t", " ")
    for token in line.split(" "):
        cnt[token] += 1
    
res = list([(-v, k) for k, v in cnt.items()])
res = sorted(res)
for (v, k) in res:
    print('{} {}'.format(-v, k))
423d1f472744abb9d1a580ce0ce98314d9cf2d16
<mask token>

<mask token>
while True:
    try:
        data.append(input())
    except:
        break
<mask token>
for line in data:
    line = line.replace('\t', ' ')
    for token in line.split(' '):
        cnt[token] += 1
<mask token>
for v, k in res:
    print('{} {}'.format(-v, k))

<mask token>
data = []
while True:
    try:
        data.append(input())
    except:
        break
cnt = defaultdict(int)
for line in data:
    line = line.replace('\t', ' ')
    for token in line.split(' '):
        cnt[token] += 1
res = list([(-v, k) for k, v in cnt.items()])
res = sorted(res)
for v, k in res:
    print('{} {}'.format(-v, k))

from collections import defaultdict
data = []
while True:
    try:
        data.append(input())
    except:
        break
cnt = defaultdict(int)
for line in data:
    line = line.replace('\t', ' ')
    for token in line.split(' '):
        cnt[token] += 1
res = list([(-v, k) for k, v in cnt.items()])
res = sorted(res)
for v, k in res:
    print('{} {}'.format(-v, k))

from collections import defaultdict

data = []
while True:
    try:
        data.append(input())
    except:
        break

cnt = defaultdict(int)
for line in data:
    line = line.replace("\t", " ")
    for token in line.split(" "):
        cnt[token] += 1
    
res = list([(-v, k) for k, v in cnt.items()])
res = sorted(res)
for (v, k) in res:
    print('{} {}'.format(-v, k))