2565_1_Quiz_2_1

Max Score = 100


6531311021
# 1661559, 2022-10-29 09:28:07, ----- (0%)

word = input().upper().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'A, E, I, L, N, O, R, S, T, U':
            p+=1
        if k in 'D, G':
            p+=2
        if k in 'B, C, M, P':
            p+=3
        if k in 'F, H, V, W, Y':
            p+=4
        if k in 'K':
            p+=5
        if k in 'J, X':
            p+=8
        if k in 'Q, Z':
            p+=10
    points.append([p,e])
points.sort(reverse=True)
for e in points:
    print(e[1],e[0])
# 1661611, 2022-10-29 09:29:21, ----- (0%)

word = input().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'A, E, I, L, N, O, R, S, T, U':
            p+=1
        if k in 'D, G':
            p+=2
        if k in 'B, C, M, P':
            p+=3
        if k in 'F, H, V, W, Y':
            p+=4
        if k in 'K':
            p+=5
        if k in 'J, X':
            p+=8
        if k in 'Q, Z':
            p+=10
    points.append([p,e])
points.sort(reverse=True)
for e in points:
    print(e[1],e[0])
# 1661664, 2022-10-29 09:31:05, ----- (0%)

word = input().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'A, E, I, L, N, O, R, S, T, U':
            p+=1
        if k in 'D, G':
            p+=2
        if k in 'B, C, M, P':
            p+=3
        if k in 'F, H, V, W, Y':
            p+=4
        if k in 'K':
            p+=5
        if k in 'J, X':
            p+=8
        if k in 'Q, Z':
            p+=10
    points.append([p,e])
points.sort(reverse=True)
for e in points:
    print(e[1],str(e[0]))
# 1662588, 2022-10-29 10:02:45, xxxxx (0%)

# word = input().strip().split()
# print(word)
# points=[]
# for e in word:
#     p=0
#     for k in e:
#         if k in 'A, E, I, L, N, O, R, S, T, U':
#             p+=1
#         if k in 'D, G':
#             p+=2
#         if k in 'B, C, M, P':
#             p+=3
#         if k in 'F, H, V, W, Y':
#             p+=4
#         if k in 'K':
#             p+=5
#         if k in 'J, X':
#             p+=8
#         if k in 'Q, Z':
#             p+=10
#     points.append([p,e])
# points.sort(reverse=True)
# for e in points:
#     print(e[1],e[0])
print(wrf)
# 1662977, 2022-10-29 10:14:05, ----- (0%)

word = input().upper().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'A, E, I, L, N, O, R, S, T, U':
            p+=1
        if k in 'D, G':
            p+=2
        if k in 'B, C, M, P':
            p+=3
        if k in 'F, H, V, W, Y':
            p+=4
        if k in 'K':
            p+=5
        if k in 'J, X':
            p+=8
        if k in 'Q, Z':
            p+=10
    points.append([e,p])
points.sort()
points = sorted(points, key = lambda stu:stu[1],reverse=True)
for e in points:
    print(e[0],e[1])
# 1663249, 2022-10-29 10:20:43, ----- (0%)

word = input().upper().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'A, E, I, L, N, O, R, S, T, U':
            p+=1
        if k in 'D, G':
            p+=2
        if k in 'B, C, M, P':
            p+=3
        if k in 'F, H, V, W, Y':
            p+=4
        if k in 'K':
            p+=5
        if k in 'J, X':
            p+=8
        if k in 'Q, Z':
            p+=10
    points.append([e,p])
points.sort()
points = sorted(points, key = lambda stu:stu[1],reverse=True)
for e in points:
    print(e[0],e[1])
# 1663287, 2022-10-29 10:21:44, ----- (0%)

word = input().upper().strip().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'AEILNORSTU':
            p+=1
        if k in 'DG':
            p+=2
        if k in 'BCMP':
            p+=3
        if k in 'FHVWY':
            p+=4
        if k in 'K':
            p+=5
        if k in 'JX':
            p+=8
        if k in 'QZ':
            p+=10
    points.append([e,p])
points.sort()
points = sorted(points, key = lambda stu:stu[1],reverse=True)
for e in points:
    print(e[0],e[1])
# 1663421, 2022-10-29 10:24:27, ----- (0%)

word = input().split()
print(word)
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'AEILNORSTU':
            p+=1
        if k in 'DG':
            p+=2
        if k in 'BCMP':
            p+=3
        if k in 'FHVWY':
            p+=4
        if k in 'K':
            p+=5
        if k in 'JX':
            p+=8
        if k in 'QZ':
            p+=10
    points.append([e,p])
points.sort()
points = sorted(points, key = lambda stu:stu[1],reverse=True)
for e in points:
    print(e[0],e[1])
# 1663439, 2022-10-29 10:24:47, PPPPP (100%)

word = input().split()
points=[]
for e in word:
    p=0
    for k in e:
        if k in 'AEILNORSTU':
            p+=1
        if k in 'DG':
            p+=2
        if k in 'BCMP':
            p+=3
        if k in 'FHVWY':
            p+=4
        if k in 'K':
            p+=5
        if k in 'JX':
            p+=8
        if k in 'QZ':
            p+=10
    points.append([e,p])
points.sort()
points = sorted(points, key = lambda stu:stu[1],reverse=True)
for e in points:
    print(e[0],e[1])

6531313221
# 1661306, 2022-10-29 09:19:36, PP--- (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["C", "B", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "K"]:
        return 8
    if c in ["Q", "Z"]:
        return 10
    return 0


words = []
for s in input().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
words = sorted(words)
for total, word in words:
    print(word, -total)

# 1661329, 2022-10-29 09:20:34, PP--- (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["C", "B", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10
    return 0


words = []
for s in input().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
words = sorted(words)
for total, word in words:
    print(word, -total)

# 1661798, 2022-10-29 09:37:28, PPxxx (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["C", "B", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10


words = []
for s in input().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
words = sorted(words)
for total, word in words:
    print(word, -total)
# 1661828, 2022-10-29 09:38:22, PPxxx (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["C", "B", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10


words = []
for s in input().split():
    total = 0
    for c in s.strip():
        total += score(c)
    words += [(-total, s)]
for total, word in sorted(words):
    print(word, -total)

# 1662382, 2022-10-29 09:56:32, PPxxx (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["B", "C", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10


words = []
for s in input().strip().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
for total, word in sorted(words):
    print(word, -total)

# 1662409, 2022-10-29 09:57:14, PP--- (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["B", "C", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10
    return 0


words = []
for s in input().strip().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
for total, word in sorted(words):
    print(word, -total)

# 1662428, 2022-10-29 09:57:46, PPxxx (40%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["B", "C", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W" "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10
    if c.isalpha():
        return
    return 0


words = []
for s in input().strip().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
for total, word in sorted(words):
    print(word, -total)

# 1662523, 2022-10-29 10:00:38, PPPPP (100%)

def score(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    if c in ["D", "G"]:
        return 2
    if c in ["B", "C", "M", "P"]:
        return 3
    if c in ["F", "H", "V", "W", "Y"]:
        return 4
    if c == 'K':
        return 5
    if c in ["J", "X"]:
        return 8
    if c in ["Q", "Z"]:
        return 10


words = []
for s in input().strip().split():
    total = 0
    for c in s:
        total += score(c)
    words += [(-total, s)]
for total, word in sorted(words):
    print(word, -total)


6530155221
# 1661475, 2022-10-29 09:25:39, P---- (20%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
for i in  range(len(words)):
    print(words[i], word_point(words[i]))
# 1661489, 2022-10-29 09:25:58, P---- (20%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
for i in  range(len(words)):
    print(words[i],  word_point(words[i]))
# 1661505, 2022-10-29 09:26:21, P---- (20%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
for i in  range(len(words)):
    print(words[i],' ',word_point(words[i]))
# 1661699, 2022-10-29 09:32:41, ----- (0%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
d = []
for i in range(len(words)):
    d.append([word_point(words[i]),words[i]])
d.sort()
for i in range(len(d)):
    print(d[i][0],' ',d[i][1])

# 1661703, 2022-10-29 09:32:52, ----- (0%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
d = []
for i in range(len(words)):
    d.append([word_point(words[i]),words[i]])
d.sort()
for i in range(len(d)):
    print(d[i][0],'',d[i][1])
# 1661900, 2022-10-29 09:40:24, PPPPP (100%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
d = []
for i in range(len(words)):
    d.append([word_point(words[i]),words[i]])
d.sort()
#print(d)
for i in range(len(d)):
    d[i][0] *= -1
#print(d)
d.sort()
#print(d)
for i in range(len(d)):
    d[i][0] *= -1
for i in range(len(d)):
    print(d[i][1], d[i][0])
#for i in  range(len(words)):
    #print(words[i], word_point(words[i]))

# 1661901, 2022-10-29 09:40:32, PPPPP (100%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'
def word_point(c):
 k = 0
 for e in c:
     if e in p1:
         k += 1
     elif e in p2:
         k += 2
     elif e in p3:
         k += 3
     elif e in p4:
         k += 4
     elif e in p5:
         k += 5
     elif e in p8:
         k += 8
     elif e in p10:
         k += 10
 return k
words = input().split()
d = []
for i in range(len(words)):
    d.append([word_point(words[i]),words[i]])
d.sort()
#print(d)
for i in range(len(d)):
    d[i][0] *= -1
#print(d)
d.sort()
#print(d)
for i in range(len(d)):
    d[i][0] *= -1
for i in range(len(d)):
    print(d[i][1], d[i][0])
#for i in  range(len(words)):
    #print(words[i], word_point(words[i]))

6532106921
# 1661497, 2022-10-29 09:26:09, PPxxx (40%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    if(c in point2): return 2
    if(c in point3): return 3
    if(c in point4): return 4
    if(c in point5): return 5
    if(c in point8): return 8
    if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
ans=sorted(ans,key=lambda x:x[1])
ans.reverse()
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1661838, 2022-10-29 09:38:51, PPxxx (40%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    if(c in point2): return 2
    if(c in point3): return 3
    if(c in point4): return 4
    if(c in point5): return 5
    if(c in point8): return 8
    if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1661943, 2022-10-29 09:42:04, P-xxx (20%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    if(c in point2): return 2
    if(c in point3): return 3
    if(c in point4): return 4
    if(c in point5): return 5
    if(c in point8): return 8
    if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
#ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1661956, 2022-10-29 09:42:29, P---- (20%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    # if(c in point1): return 1
    # if(c in point2): return 2
    # if(c in point3): return 3
    # if(c in point4): return 4
    # if(c in point5): return 5
    # if(c in point8): return 8
    # if(c in point10): return 10
    return 1
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
#ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1661965, 2022-10-29 09:42:54, P-xxx (20%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    if(c in point2): return 2
    if(c in point3): return 3
    # if(c in point4): return 4
    # if(c in point5): return 5
    # if(c in point8): return 8
    # if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
#ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1661971, 2022-10-29 09:43:07, Pxxxx (20%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','K']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    # if(c in point2): return 2
    # if(c in point3): return 3
    # if(c in point4): return 4
    # if(c in point5): return 5
    # if(c in point8): return 8
    # if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
#ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
# 1662008, 2022-10-29 09:44:21, PPPPP (100%)

point1=['A','E','I','L','N','O','R','S','T','U']
point2=['D','G']; point3=['B','C','M','P']
point4=['F','H','V','W','Y']; point5=['K']
point8=['J','X']; point10=['Q','Z']
ans=[]
def letter_point(c):
    if(c in point1): return 1
    if(c in point2): return 2
    if(c in point3): return 3
    if(c in point4): return 4
    if(c in point5): return 5
    if(c in point8): return 8
    if(c in point10): return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
for i in words:
    ans.append((i,word_point(i)))
#ans=sorted(ans,key=lambda x:(x[1],x[0]))
#ans=sorted(ans,key=lambda x:x[0],reverse=True)
ans=sorted(sorted(ans,key=lambda x:x[0]),key=lambda x:x[1],reverse=True)
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])

6531525021
# 1661773, 2022-10-29 09:36:01, P---- (20%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'
]
sc1 = ['D', 'G'
]
sc2 = ['B', 'C', 'M', 'P'
]
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 5
        if e[i] in sc6 :
            c += 10
    print(e, c)
    c = 0
            
# 1661980, 2022-10-29 09:43:19, PP--- (40%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'
]
sc1 = ['D', 'G'
]
sc2 = ['B', 'C', 'M', 'P'
]
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
x = []
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 5
        if e[i] in sc6 :
            c += 10
    x.append([-c, e])
    c = 0
x.sort()
for i in range(len(x)) :
    m , n = x[i][1] ,x[i][0]
    print(m , -n)
    
    
    
            

# 1662038, 2022-10-29 09:45:16, PP--- (40%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
sc1 = ['D', 'G']
sc2 = ['B', 'C', 'M', 'P']
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
x = []
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 5
        if e[i] in sc6 :
            c += 10
    x.append([-c, e])
    c = 0
x.sort()
for i in range(len(x)) :
    m , n = x[i][1] ,x[i][0]
    print(m , -n)
# 1663330, 2022-10-29 10:22:41, PP--- (40%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
sc1 = ['D', 'G']
sc2 = ['B', 'C', 'M', 'P']
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
x = []
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 5
        if e[i] in sc6 :
            c += 10
    x.append([-c, e])
    c = 0
x.sort()
for i in range(len(x)) :
    m , n = x[i][1] ,x[i][0]
    print(m ,-n)
# 1664167, 2022-10-29 10:37:31, PP--- (40%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
sc1 = ['D', 'G']
sc2 = ['B', 'C', 'M', 'P']
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
x = []
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 5
        if e[i] in sc6 :
            c += 10
    x.append([-c, e])
    c = 0
x.sort()
for i in range(len(x)) :
    m , n = x[i][1] ,-x[i][0]
    print(m ,n)
# 1664273, 2022-10-29 10:38:40, PPPPP (100%)

sc = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
sc1 = ['D', 'G']
sc2 = ['B', 'C', 'M', 'P']
sc3 = ['F', 'H', 'V', 'W', 'Y']
sc4 = ['K']
sc5 = ['J', 'X']
sc6 = ['Q', 'Z']
n = input().split()
x = []
for e in n :
    c = 0
    for i in range(len(e)):
        if e[i] in sc :
            c += 1
        if e[i] in sc1 :
            c += 2
        if e[i] in sc2 :
            c += 3
        if e[i] in sc3 :
            c += 4
        if e[i] in sc4 :
            c += 5
        if e[i] in sc5 :
            c += 8
        if e[i] in sc6 :
            c += 10
    x.append([-c, e])
    c = 0
x.sort()
for i in range(len(x)) :
    m , n = x[i][1] ,-x[i][0]
    print(m ,n)

6530071121
# 1661319, 2022-10-29 09:20:10, P---- (20%)

x = input().split()
c = 0
score = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","K"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
    score.append([x[i],c])
    c = 0
score.sort()
score = score[::-1]
for i in range(len(score)):
    print(score[i][0],score[i][1])
# 1661727, 2022-10-29 09:33:54, PP--- (40%)

x = input().split()
c = 0
score = []
data = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","K"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
    data.append([c,x[i]])
    score.append(c)
    c = 0
data.sort()
while len(score) > 0 :
    m = max(score)
    j = 0
    while len(data) > 0:
        if m == data[j][0]:
            print(data[j][1],data[j][0])
            data.pop(j)
            score.remove(m)
            j = 0
            break
        else :
            j += 1

# 1661889, 2022-10-29 09:40:07, PP--- (40%)

x = input().strip().split()
c = 0
score = []
data = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","K"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
    data.append([c,x[i]])
    score.append(c)
    c = 0
for j in range(len(data)-1):
    if data[j] == data[j+1]:
        data[j+1][0] += c
        data[j] = []
while [] in data:
    data.remove([])
data.sort()
while len(score) > 0 :
    m = max(score)
    j = 0
    while len(data) > 0:
        if m == data[j][0]:
            print(data[j][1],data[j][0])
            data.pop(j)
            score.remove(m)
            j = 0
            break
        else :
            j += 1
# 1661976, 2022-10-29 09:43:14, PP--- (40%)

x = input().strip().split()
c = 0
score = []
data = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","K"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
    data.append([c,x[i]])
    score.append(c)
    c = 0
for j in range(len(data)-1):
    if data[j] == data[j+1]:
        data[j+1][0] += data[j][0]
        t = score.index(data[j][0])
        score[t] += data[j][0]
        score.remove(data[j][0])
        data[j] = []
while [] in data:
    data.remove([])
data.sort()
while len(score) > 0 :
    m = max(score)
    j = 0
    while len(data) > 0:
        if m == data[j][0]:
            print(data[j][1],data[j][0])
            data.pop(j)
            score.remove(m)
            j = 0
            break
        else :
            j += 1
# 1662062, 2022-10-29 09:46:04, PP--- (40%)

x = input().strip().split()
c = 0
score = []
data = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","K"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
        else :
            c += 0
    data.append([c,x[i]])
    score.append(c)
    c = 0
for j in range(len(data)-1):
    if data[j] == data[j+1]:
        data[j+1][0] += data[j][0]
        t = score.index(data[j][0])
        score[t] += data[j][0]
        score.remove(data[j][0])
        data[j] = []
while [] in data:
    data.remove([])
data.sort()
while len(score) > 0 :
    m = max(score)
    j = 0
    while len(data) > 0:
        if m == data[j][0]:
            print(data[j][1],data[j][0])
            data.pop(j)
            score.remove(m)
            j = 0
            break
        else :
            j += 1
# 1662087, 2022-10-29 09:46:56, PPPPP (100%)

x = input().strip().split()
c = 0
score = []
data = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            c += 1
        elif x[i][j] in ["D","G"]:
            c += 2
        elif x[i][j] in ["B","C","M","P"]:
            c += 3
        elif x[i][j] in ["F","H","V","W","Y"]:
            c += 4
        elif x[i][j] in ["K"]:
            c += 5
        elif x[i][j] in ["J","X"]:
            c += 8
        elif x[i][j] in ["Q","Z"]:
            c += 10
        else :
            c += 0
    data.append([c,x[i]])
    score.append(c)
    c = 0
for j in range(len(data)-1):
    if data[j] == data[j+1]:
        data[j+1][0] += data[j][0]
        t = score.index(data[j][0])
        score[t] += data[j][0]
        score.remove(data[j][0])
        data[j] = []
while [] in data:
    data.remove([])
data.sort()
while len(score) > 0 :
    m = max(score)
    j = 0
    while len(data) > 0:
        if m == data[j][0]:
            print(data[j][1],data[j][0])
            data.pop(j)
            score.remove(m)
            j = 0
            break
        else :
            j += 1

6530159821
# 1661465, 2022-10-29 09:25:18, xxxxx (0%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
out=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i][1],+' '+str(-(ans[i][0])))
        

# 1661481, 2022-10-29 09:25:47, xxxxx (0%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
out=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
for i in range(len(ans)):
    print(str(ans[i][1])+' '+str(-(ans[i][0])))
# 1661499, 2022-10-29 09:26:11, compilation error (0%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
out=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i][1],ans[i][0])))
# 1661507, 2022-10-29 09:26:23, ----- (0%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
ans=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
print(ans)
for i in range(len(ans)):
    print(ans[i][1],abs(ans[i][0]))
        

# 1661523, 2022-10-29 09:27:04, PPPPP (100%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
ans=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i][1],abs(ans[i][0]))
# 1661538, 2022-10-29 09:27:36, PPPPP (100%)

did={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'V':4,'H':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,
     }
x=input().split()
p=0
ans=[]
for e in x:
    p=0
    for i in range(len(e)):
        p+=did[e[i]]
    ans+=[[e,p]]
ans=[[-m,k] for k,m in ans]
ans=sorted(ans)
for i in range(len(ans)):
    print(str(ans[i][1])+" "+str(abs(ans[i][0])))

6531807021
# 1661702, 2022-10-29 09:32:50, --xx- (0%)

data = input()
data1 = data.split()
data1.sort()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JK':
        return 8
    if a in 'QZ':
        return 10

data2 = []
for i in data1:
    data2.append([score(i),i])
    data2.sort(reverse = True)

for i in data2:
    print(i[0],i[1])


# 1662124, 2022-10-29 09:48:10, --xxx (0%)

data = input()
data1 = data.split()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JX':
        return 8
    if a in 'QZ':
        return 10

data2 = []
for i in data1:
    data2.append([-score(i),i])
    data2.sort()

data3 = []
for i in data2:
    data3.append([i[1],-i[0]])

        


for i in data3:
    print(i[0],i[1])
# 1662134, 2022-10-29 09:48:29, --xxx (0%)

data = input().strip()
data1 = data.split()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JX':
        return 8
    if a in 'QZ':
        return 10

data2 = []
for i in data1:
    data2.append([-score(i),i])
    data2.sort()

data3 = []
for i in data2:
    data3.append([i[1],-i[0]])

        


for i in data3:
    print(i[0],i[1])
# 1662401, 2022-10-29 09:57:08, ----- (0%)

data = input()
data1 = data.split()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JX':
        return 8
    if a in 'QZ':
        return 10

def score1(b):
    c = 0
    for i in b:
         c += score(i)
    return(c)

data2 = []
for i in data1:
    data2.append([-score1(i),i])
    data2.sort()

data3 = []
for i in data2:
    data3.append([i[1],-i[0]])
# 1662775, 2022-10-29 10:08:38, ----- (0%)

data = input()
data1 = data.split()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JX':
        return 8
    if a in 'QZ':
        return 10

def score1(b):
    c = 0
    for i in b:
         c += score(i)
    return(c)

data2 = []
for i in data1:
    data2.append([-score1(i),i])
    data2.sort()

data3 = []
for i in data2:
    data3.append([i[1],-i[0]])
print(data3)
# 1662812, 2022-10-29 10:09:20, PPPPP (100%)

data = input()
data1 = data.split()


def score(a):
    if a in 'AEILNORSTU':
        return 1
    if a in 'DG':
        return 2
    if a in 'BCMP':
        return 3
    if a in 'FHVWY':
        return 4
    if a in 'K':
        return 5
    if a in 'JX':
        return 8
    if a in 'QZ':
        return 10

def score1(b):
    c = 0
    for i in b:
         c += score(i)
    return(c)

data2 = []
for i in data1:
    data2.append([-score1(i),i])
    data2.sort()

data3 = []
for i in data2:
    data3.append([i[1],-i[0]])

        


for i in data3:
    print(i[0],i[1])


6530065421
# 1661472, 2022-10-29 09:25:35, ----- (0%)

def letter_point(c):
    a = ['A','E','I','L','N','O','R','S','T','U']
    b = ['D','G']
    z = [ 'B', 'C', 'M', 'P']
    d = ['F', 'H', 'V', 'W', 'Y']
    e = ['K']
    f = ['J', 'X']
    g = ['Q', 'Z']

    s = 0
    for i in c :
        if i in a :
            s += 1
        elif i in b:
            s += 2
        elif i in z :
            s += 3
        elif i in d :
            s += 4
        elif i in e :
            s += 5
        elif i in f :
            s += 8
        elif i in g :
            s += 10
    return s
        
            
def word_point(w):
    return (w,letter_point(w))
 

words = input().split()
print(word_point(words))

# 1661759, 2022-10-29 09:35:32, ----- (0%)

def letter_point(c):
    a = ['A','E','I','L','N','O','R','S','T','U']
    b = ['D','G']
    z = [ 'B', 'C', 'M', 'P']
    d = ['F', 'H', 'V', 'W', 'Y']
    e = ['K']
    f = ['J', 'X']
    g = ['Q', 'Z']

    s = 0
    for i in c :
        if i in a :
            s += 1
        elif i in b:
            s += 2
        elif i in z :
            s += 3
        elif i in d :
            s += 4
        elif i in e :
            s += 5
        elif i in f :
            s += 8
        elif i in g :
            s += 10
    return s
        
            
def word_point(w):
    for i in w :
        print( i,letter_point(i))
    
        
        
    
 

words = input().split()
for i in range(len(words)) :
    print(word_point(words))

# 1661881, 2022-10-29 09:39:49, ----- (0%)

def letter_point(c):
    a = ['A','E','I','L','N','O','R','S','T','U']
    b = ['D','G']
    z = [ 'B', 'C', 'M', 'P']
    d = ['F', 'H', 'V', 'W', 'Y']
    e = ['K']
    f = ['J', 'X']
    g = ['Q', 'Z']

    s = 0
    for i in c :
        if i in a :
            s += 1
        elif i in b:
            s += 2
        elif i in z :
            s += 3
        elif i in d :
            s += 4
        elif i in e :
            s += 5
        elif i in f :
            s += 8
        elif i in g :
            s += 10
    return s
        
            
def word_point(w):
    
    for i in w :       
      return ( i,letter_point(i))
    
        

# 1662014, 2022-10-29 09:44:30, P---- (20%)

def letter_point(c):
    a = ['A','E','I','L','N','O','R','S','T','U']
    b = ['D','G']
    z = [ 'B', 'C', 'M', 'P']
    d = ['F', 'H', 'V', 'W', 'Y']
    e = ['K']
    f = ['J', 'X']
    g = ['Q', 'Z']

    s = 0
    for i in c :
        if i in a :
            s += 1
        elif i in b:
            s += 2
        elif i in z :
            s += 3
        elif i in d :
            s += 4
        elif i in e :
            s += 5
        elif i in f :
            s += 8
        elif i in g :
            s += 10
    return s
        
            
def word_point(w):
    
    for i in w :       
      return ( i,letter_point(i))
    
        
        
    
 

words = input().split()
a = words
for i in range(len(words)) :
    print(str(a[i])+" "+str(letter_point(a[i])))

# 1662325, 2022-10-29 09:54:29, PPPPP (100%)

def letter_point(c):
    a = ['A','E','I','L','N','O','R','S','T','U']
    b = ['D','G']
    z = [ 'B', 'C', 'M', 'P']
    d = ['F', 'H', 'V', 'W', 'Y']
    e = ['K']
    f = ['J', 'X']
    g = ['Q', 'Z']

    s = 0
    for i in c :
        if i in a :
            s += 1
        elif i in b:
            s += 2
        elif i in z :
            s += 3
        elif i in d :
            s += 4
        elif i in e :
            s += 5
        elif i in f :
            s += 8
        elif i in g :
            s += 10
    return s
        
            
def word_point(w):
    
    for i in w :       
      return ( i,letter_point(i))

words = input().split()
a = words
b = []
for i in range(len(words)) :
    b.append([-1*letter_point(a[i]),a[i]])
b.sort()
for i in range(len(b)) :
    print(b[i][1],-1*b[i][0])
    
    
    
    


6530171221
# 1661441, 2022-10-29 09:24:32, compilation error (0%)

words = input().split()
spoint = []
for j in range(len(words)):
    point = 0
    for i in words[j]:
        if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            point += 1
        elif i in ['D', 'G']:
            point += 2
        elif i in ['B', 'C', 'M', 'P']:
            point += 3
        elif i in ['F', 'H', 'V', 'W', 'Y'
]:
            point += 4
        elif i in ['K']:
            point += 5
        elif i in ['J', 'X']:
            point += 8
        elif i in ['Q', 'Z']:
            point += 10
     
    spoint.append([-point,words[j]])
spoint.sort()
for k in range(len(spoint)):
    print(spoint[k][1],-spoint[k][0]
# 1661445, 2022-10-29 09:24:44, compilation error (0%)

words = input().split()
spoint = []
for j in range(len(words)):
    point = 0
    for i in words[j]:
        if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            point += 1
        elif i in ['D', 'G']:
            point += 2
        elif i in ['B', 'C', 'M', 'P']:
            point += 3
        elif i in ['F', 'H', 'V', 'W', 'Y']:
            point += 4
        elif i in ['K']:
            point += 5
        elif i in ['J', 'X']:
            point += 8
        elif i in ['Q', 'Z']:
            point += 10
     
    spoint.append([-point,words[j]])
spoint.sort()
for k in range(len(spoint)):
    print(spoint[k][1],-spoint[k][0]
# 1661470, 2022-10-29 09:25:29, compilation error (0%)

words = input().split()
spoint = []
for j in range(len(words)):
    point = 0
    for i in words[j]:
        if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            point += 1
        elif i in ['D', 'G']:
            point += 2
        elif i in ['B', 'C', 'M', 'P']:
            point += 3
        elif i in ['F', 'H', 'V', 'W', 'Y'
]:
            point += 4
        elif i in ['K']:
            point += 5
        elif i in ['J', 'X']:
            point += 8
        elif i in ['Q', 'Z']:
            point += 10
     
    spoint.append([-point,words[j]])
spoint.sort()
for k in range(len(spoint)):
    print(spoint[k][1],-spoint[k][0]
# 1661483, 2022-10-29 09:25:48, compilation error (0%)

words = input().split()
spoint = []
for j in range(len(words)):
    point = 0
    for i in words[j]:
        if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            point += 1
        elif i in ['D', 'G']:
            point += 2
        elif i in ['B', 'C', 'M', 'P']:
            point += 3
        elif i in ['F', 'H', 'V', 'W', 'Y']:
            point += 4
        elif i in ['K']:
            point += 5
        elif i in ['J', 'X']:
            point += 8
        elif i in ['Q', 'Z']:
            point += 10
    spoint.append([-point,words[j]])
spoint.sort()
for k in range(len(spoint)):
    print(spoint[k][1],-spoint[k][0]
# 1661652, 2022-10-29 09:30:47, PPPPP (100%)

words = input().split()
spoint = []
for j in range(len(words)):
    point = 0
    for i in words[j]:
        if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:point += 1
        elif i in ['D', 'G']:point += 2
        elif i in ['B', 'C', 'M', 'P']:point += 3
        elif i in ['F', 'H', 'V', 'W', 'Y']:point += 4
        elif i in ['K']:point += 5
        elif i in ['J', 'X']:point += 8
        elif i in ['Q', 'Z']:point += 10  
    spoint.append([-point,words[j]])
spoint.sort()
for k in range(len(spoint)):
    print(spoint[k][1],-spoint[k][0])
    

6532082421
# 1661849, 2022-10-29 09:39:06, PPP-- (60%)

def letter_point(c):
    if (c.upper() in "AEILNORSTU"):
        return 1
    if (c.upper() in "DG"):
        return 2
    if (c.upper() in "BCMP"):
        return 3
    if (c.upper() in "FHVWY"):
        return 4
    if (c.upper() in "K"):
        return 5
    if (c.upper() in "JX"):
        return 8
    return 10


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total


words = input().split()
lst = dict()
for e in words:
    pt = word_point(e)
    if (pt in lst):
        lst[pt].append(e)
    else:
        lst[pt] = [e]
lst = sorted(lst.items(), reverse=True)
for e in lst:
    for j in e[1]:
        print(j, e[0])

# 1661931, 2022-10-29 09:41:35, PPP-- (60%)

def letter_point(c):
    if (c.upper() in "AEILNORSTU"):
        return 1
    if (c.upper() in "DG"):
        return 2
    if (c.upper() in "BCMP"):
        return 3
    if (c.upper() in "FHVWY"):
        return 4
    if (c.upper() in "K"):
        return 5
    if (c.upper() in "JX"):
        return 8
    return 10


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total


words = input().split()
lst = dict()
for e in words:
    pt = word_point(e)
    if (pt in lst):
        lst[pt].append(e)
    else:
        lst[pt] = [e]
lst = sorted(lst.items(), reverse=True)
for e in lst:
    print(e[1][0], e[0])
    # for j in e[1]:
    #     print(j, e[0])

# 1661941, 2022-10-29 09:41:54, ----- (0%)

def letter_point(c):
    if (c.upper() in "AEILNORSTU"):
        return 1
    if (c.upper() in "DG"):
        return 2
    if (c.upper() in "BCMP"):
        return 3
    if (c.upper() in "FHVWY"):
        return 4
    if (c.upper() in "K"):
        return 5
    if (c.upper() in "JX"):
        return 8
    return 10


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total


words = input().split()
lst = dict()
for e in words:
    pt = word_point(e)
    if (pt in lst):
        lst[pt].append(e)
    else:
        lst[pt] = [e]
lst = sorted(lst.items(), reverse=True)
for e in lst:
    print(e[1][0], e[0])
    for j in e[1]:
        print(j, e[0])

# 1661948, 2022-10-29 09:42:11, PPP-- (60%)

def letter_point(c):
    if (c.upper() in "AEILNORSTU"):
        return 1
    if (c.upper() in "DG"):
        return 2
    if (c.upper() in "BCMP"):
        return 3
    if (c.upper() in "FHVWY"):
        return 4
    if (c.upper() in "K"):
        return 5
    if (c.upper() in "JX"):
        return 8
    return 10


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total


words = input().split()
lst = dict()
for e in words:
    pt = word_point(e)
    if (pt in lst):
        lst[pt].append(e)
    else:
        lst[pt] = [e]
lst = sorted(lst.items(), reverse=True)
for e in lst:
    for j in e[1]:
        print(j, e[0])

# 1662018, 2022-10-29 09:44:37, PPPPP (100%)

def letter_point(c):
    if (c.upper() in "AEILNORSTU"):
        return 1
    if (c.upper() in "DG"):
        return 2
    if (c.upper() in "BCMP"):
        return 3
    if (c.upper() in "FHVWY"):
        return 4
    if (c.upper() in "K"):
        return 5
    if (c.upper() in "JX"):
        return 8
    return 10


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total


words = input().split()
lst = dict()
for e in words:
    pt = word_point(e)
    if (pt in lst):
        lst[pt].append(e)
    else:
        lst[pt] = [e]
key = sorted(lst, reverse=True)
# print(key)
# print(lst)
for e in key:
    newLst = lst[e]
    newLst.sort()
    for j in newLst:
        print(j, e)


6531019821
# 1661639, 2022-10-29 09:30:22, x--xx (0%)

def point(x):
    x = str(x)
    if x in ['A' ,'E','I','N','O','R','S','T','U']:
        y = 1
    elif x in ['D','G']:
        y = 2
    elif x in ['B','C','M','P']:
        y = 3
    elif x in ['F' ,'H','V' ,'W','Y']:
        y = 4
    elif x in ['R']:
        y = 5
    elif x in ['J','X']:
        y = 8
    elif x in ['Q' , 'Z']:
        y = 10
    return y
words = input().split()
y = []
for word in words:
    score = 0
    for e in word:
        score += int(point(e))
    y.append(word)
    y.append(score)
for i in range(0,len(y),2):
    print(y[i],y[i+1])
# 1661732, 2022-10-29 09:34:14, xPPxx (40%)

def point(x):
    x = str(x)
    if x in ['A' ,'E','I','N','O','R','S','T','U']:
        y = 1
    elif x in ['D','G']:
        y = 2
    elif x in ['B','C','M','P']:
        y = 3
    elif x in ['F' ,'H','V' ,'W','Y']:
        y = 4
    elif x in ['R']:
        y = 5
    elif x in ['J','X']:
        y = 8
    elif x in ['Q' , 'Z']:
        y = 10
    return y
words = input().split()
y = []
for word in words:
    score = 0
    for e in word:
        score += int(point(e))
    y.append([score,word])
y.sort()
y = y[::-1]
for i in y:
    print(i[1],i[0])
# 1661760, 2022-10-29 09:35:38, xPPxx (40%)

def point(x):
    x = str(x)
    if x in ['A' ,'E','I','N','O','R','S','T','U']:
        y = 1
    elif x in ['D','G']:
        y = 2
    elif x in ['B','C','M','P']:
        y = 3
    elif x in ['F' ,'H','V' ,'W','Y']:
        y = 4
    elif x in ['R']:
        y = 5
    elif x in ['J','X']:
        y = 8
    elif x in ['Q' , 'Z']:
        y = 10
    return y
words = input().split()
y = []
for word in words:
    score = 0
    for e in word:
        score += int(point(e))
    y.append([-score,word])
y.sort()
for i in y:
    print(i[1],-i[0])
# 1661811, 2022-10-29 09:37:55, PPPxx (60%)

def point(x):
    x = str(x)
    if x in ['A' ,'E','I','L','N','O','R','S','T','U']:
        y = 1
    elif x in ['D','G']:
        y = 2
    elif x in ['B','C','M','P']:
        y = 3
    elif x in ['F' ,'H','V' ,'W','Y']:
        y = 4
    elif x in ['R']:
        y = 5
    elif x in ['J','X']:
        y = 8
    elif x in ['Q' , 'Z']:
        y = 10
    return y
words = input().split()
y = []
for word in words:
    score = 0
    for e in word:
        score += int(point(e))
    y.append([-score,word])
y.sort()
for i in y:
    print(i[1], -i[0])
# 1661922, 2022-10-29 09:41:11, PPPPP (100%)

def point(x):
    x = str(x)
    if x in ['A' ,'E','I','L','N','O','R','S','T','U']:
        y = 1
    elif x in ['D','G']:
        y = 2
    elif x in ['B','C','M','P']:
        y = 3
    elif x in ['F' ,'H','V' ,'W','Y']:
        y = 4
    elif x in ['K']:
        y = 5
    elif x in ['J','X']:
        y = 8
    elif x in ['Q' , 'Z']:
        y = 10
    return y
words = input().split()
y = []
for word in words:
    score = 0
    for e in word:
        score += int(point(e))
    y.append([-score,word])
y.sort()
for i in y:
    print(i[1], -i[0])

6230098921
# 1661271, 2022-10-29 09:17:55, ----- (0%)

point = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
a = input().split()
re = 0
en = []
for e in a :
    for k in e :
        re += point[k]
    en.append([-re,e])
    re = 0
for c in en :
    print(c[1],str(c[0]))
# 1661298, 2022-10-29 09:19:14, P---- (20%)

point = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
a = input().split()
re = 0
en = []
for e in a :
    for k in e :
        re += point[k]
    en.append([-re,e])
    re = 0
for c in en :
    print(c[1],str(-c[0]))
# 1661320, 2022-10-29 09:20:16, P---- (20%)

point = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
a = input().split()
re = 0
en = []
for e in a :
    for k in e :
        re += point[k]
    en.append([-re,e])
    re = 0
for c in en :
    print(c[1],-c[0])
# 1661361, 2022-10-29 09:21:43, PPPPP (100%)

point = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
a = input().split()
re = 0
en = []
for e in a :
    for k in e :
        re += point[k]
    en.append([-re,e])
    re = 0
en.sort()
for c in en :
    print(c[1],-c[0])

6530017321
# 1662249, 2022-10-29 09:51:46, xPPPx (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in 'AELNORSTU':
     return int(1)
 if c in 'DG':
     return int(2)
 if c in 'BCMP':
     return int(3)
 if c in 'FHVWY':
     return int(4)
 if c in 'K':
     return int(5)
 if c in 'JX':
     return int(8)
 if c in 'QZ':
     return int(10)


def word_point(w):
 out = 0
 for i in w:
     out += int(letter_point(i))
 return out
 #return out
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split()
ans=[]
for i in words:
    ans.append([-word_point(i),i])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1],-ans[i][0]) 
# 1662631, 2022-10-29 10:04:09, -PPP- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in 'AELNORSTU':
     return int(1)
 elif c in 'DG':
     return int(2)
 elif c in 'BCMP':
     return int(3)
 elif c in 'FHVWY':
     return int(4)
 elif c in 'K':
     return int(5)
 elif c in 'JX':
     return int(8)
 elif c in 'QZ':
     return int(10)
 else:
     return int(0)


def word_point(w):
 out = 0
 for i in w:
     out += int(letter_point(i))
 return out
 #return out
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
ans=[]
for i in words:
    ans.append([-word_point(i),i])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1],-ans[i][0]) 

# 1662737, 2022-10-29 10:07:23, -PPP- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in 'AELNORSETU':
     return int(1)
 elif c in 'DG':
     return int(2)
 elif c in 'BCMP':
     return int(3)
 elif c in 'FHVWY':
     return int(4)
 elif c in 'K':
     return int(5)
 elif c in 'JX':
     return int(8)
 elif c in 'QZ':
     return int(10)
 else:
     return int(0)


def word_point(w):
 out = 0
 for i in w:
     out += int(letter_point(i))
 return out
 #return out
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
ans=[]
for i in words:
    ans.append([-word_point(i),i])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1],-ans[i][0]) 

# 1662778, 2022-10-29 10:08:42, PPPPP (100%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in 'AELNORSITU':
     return int(1)
 elif c in 'DG':
     return int(2)
 elif c in 'BCMP':
     return int(3)
 elif c in 'FHVWY':
     return int(4)
 elif c in 'K':
     return int(5)
 elif c in 'JX':
     return int(8)
 elif c in 'QZ':
     return int(10)
 else:
     return int(0)


def word_point(w):
 out = 0
 for i in w:
     out += int(letter_point(i))
 return out
 #return out
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
ans=[]
for i in words:
    ans.append([-word_point(i),i])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1],-ans[i][0]) 


6530141421
# 1661242, 2022-10-29 09:15:04, xxxxx (0%)

one = "AEILNORSTU"
two = "DG"
three = "BCMP"
four = "FHVWY"
five = "K"
eight = "JX"
ten = "QZ"
sum = 0
x = input().strip().split()
for e in x:
    for f in e:
        if f in one:
            sum += 1
        elif f in two:
            sum += 2
        elif f in three:
            sum += 3
        elif f in four:
            sum += 4
        elif f in five:
            sum += 5
        elif f in eight:
            sum += 8
        elif f in ten:
            sum += 10
print(x + " " + sum)
# 1661254, 2022-10-29 09:16:51, P---- (20%)

one = "AEILNORSTU"
two = "DG"
three = "BCMP"
four = "FHVWY"
five = "K"
eight = "JX"
ten = "QZ"
sum = 0
x = input().strip().split()
for e in x:
    e = str(e)
    for f in e:
        if f in one:
            sum += 1
        elif f in two:
            sum += 2
        elif f in three:
            sum += 3
        elif f in four:
            sum += 4
        elif f in five:
            sum += 5
        elif f in eight:
            sum += 8
        elif f in ten:
            sum += 10
    print(e+" "+str(sum))
    sum = 0
# 1661314, 2022-10-29 09:19:48, PPPPP (100%)

one = "AEILNORSTU"
two = "DG"
three = "BCMP"
four = "FHVWY"
five = "K"
eight = "JX"
ten = "QZ"
sum = 0
ans = []
x = input().strip().split()
for e in x:
    e = str(e)
    for f in e:
        if f in one:
            sum += 1
        elif f in two:
            sum += 2
        elif f in three:
            sum += 3
        elif f in four:
            sum += 4
        elif f in five:
            sum += 5
        elif f in eight:
            sum += 8
        elif f in ten:
            sum += 10
    ans.append([-sum,e])
    sum = 0
ans.sort()
for e in ans:
    sum,y = e
    print(y,-sum)



# 1663254, 2022-10-29 10:20:53, PPPPP (100%)

one = "AEILNORSTU"
two = "DG"
three = "BCMP"
four = "FHVWY"
five = "K"
eight = "JX"
ten = "QZ"
sum = 0
ans = []
x = input().strip().split()
for e in x:
    e = str(e)
    for f in e:
        if f in one: sum += 1
        elif f in two: sum += 2
        elif f in three: sum += 3
        elif f in four: sum += 4
        elif f in five: sum += 5
        elif f in eight: sum += 8
        elif f in ten: sum += 10
    ans.append([-sum,e])
    sum = 0
ans.sort()
for e in ans:
    sum,y = e
    print(y,-sum)

6530175821
# 1661295, 2022-10-29 09:18:58, P---- (20%)

data = {
    1:"AEILNORSTU:",
    2:"DG",
    3:"BCMP",
    4:"FHVWY",
    5:"K",
    8:"JX",
    10:"QZ",
    }
x = list(input())
score = 0
for i in x :
    if i in data[1] :
        score += 1
    if i in data[2] :
        score += 2
    if i in data[3] :
        score += 3
    if i in data[4] :
        score += 4
    if i in data[5] :
        score += 5
    if i in data[8] :
        score += 8
    if i in data[10] :
        score += 10
print("".join(x), score)

# 1661411, 2022-10-29 09:23:39, P---- (20%)

data = {
    1:"AEILNORSTU:",
    2:"DG",
    3:"BCMP",
    4:"FHVWY",
    5:"K",
    8:"JX",
    10:"QZ",
    }
x = input().split(" ")
for i in x :
    score = 0
    for e in i :
        if e in data[1] :
            score += 1
        if e in data[2] :
            score += 2
        if e in data[3] :
            score += 3
        if e in data[4] :
            score += 4
        if e in data[5] :
            score += 5
        if e in data[8] :
            score += 8
        if e in data[10] :
            score += 10
    print(i, score)

# 1661656, 2022-10-29 09:30:50, P---- (20%)

data = {
    1:"AEILNORSTU:",
    2:"DG",
    3:"BCMP",
    4:"FHVWY",
    5:"K",
    8:"JX",
    10:"QZ",
    }
x = input().split(" ")
x = sorted(x, reverse=True)
for i in x :
    score = 0
    for e in i :
        if e in data[1] :
            score += 1
        if e in data[2] :
            score += 2
        if e in data[3] :
            score += 3
        if e in data[4] :
            score += 4
        if e in data[5] :
            score += 5
        if e in data[8] :
            score += 8
        if e in data[10] :
            score += 10
    print(i, score)

# 1661855, 2022-10-29 09:39:13, PPPPP (100%)

data = {
    1:"AEILNORSTU:",
    2:"DG",
    3:"BCMP",
    4:"FHVWY",
    5:"K",
    8:"JX",
    10:"QZ",
    }
x = input().split(" ")
y = []
for i in x :
    score = 0
    for e in i :
        if e in data[1] :
            score += 1
        if e in data[2] :
            score += 2
        if e in data[3] :
            score += 3
        if e in data[4] :
            score += 4
        if e in data[5] :
            score += 5
        if e in data[8] :
            score += 8
        if e in data[10] :
            score += 10
    y += [[-score, i]]
y = sorted(y)
for i in y :
    print(i[1], str(i[0])[1:])


6530185021
# 1661512, 2022-10-29 09:26:34, compilation error (0%)

def letter_point(c):
    a = []
    point = 0
    for e in c:
        a.append(e)
    for f in a:
        if f in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        elif f in ["D","G"]
            point += 2
        elif f in ["B","C","M","P"]:
            point += 3
        elif f in ["F","H","V","W","Y"]
            point += 4
        elif f == "K":
            point += 5
        elif f in ["J","X"]
            point += 8
        elif f in ["Q","Z"]
            point += 10
    return point
words = input().split()
s = []
for g in words:
    s.append([letter_point(g),g])
s.sort()
print(s)
# 1661577, 2022-10-29 09:28:28, ----- (0%)

def letter_point(c):
    a = []
    point = 0
    for e in c:
        a.append(e)
    for f in a:
        if f in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        elif f in ["D","G"]:
            point += 2
        elif f in ["B","C","M","P"]:
            point += 3
        elif f in ["F","H","V","W","Y"]:
            point += 4
        elif f == "K":
            point += 5
        elif f in ["J","X"]:
            point += 8
        elif f in ["Q","Z"]:
            point += 10
    return point
words = input().split()
s = []
for g in words:
    s.append([letter_point(g),g])
s.sort()
print(s)
# 1661770, 2022-10-29 09:35:57, P---- (20%)

def letter_point(c):
    a = []
    point = 0
    for e in c:
        a.append(e)
    for f in a:
        if f in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        elif f in ["D","G"]:
            point += 2
        elif f in ["B","C","M","P"]:
            point += 3
        elif f in ["F","H","V","W","Y"]:
            point += 4
        elif f == "K":
            point += 5
        elif f in ["J","X"]:
            point += 8
        elif f in ["Q","Z"]:
            point += 10
    return point
words = input().split()
s = []
s1 = []
s2 = []
for g in words:
    s.append([letter_point(g),g])
s.sort()
for i in range(len(s)):
    s1 += s[i][::-1]
for k in s1:
    s2.append(str(k))
print(" ".join(s2))
# 1663206, 2022-10-29 10:19:39, PPPPP (100%)

def letter_point(c):
    a = []
    point = 0
    for e in c:
        a.append(e)
    for f in a:
        if f in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        elif f in ["D","G"]:
            point += 2
        elif f in ["B","C","M","P"]:
            point += 3
        elif f in ["F","H","V","W","Y"]:
            point += 4
        elif f == "K":
            point += 5
        elif f in ["J","X"]:
            point += 8
        elif f in ["Q","Z"]:
            point += 10
    return point
words = input().split()
s = []
s1 = []
s2 = []
for g in words:
    s.append([-letter_point(g),g])
s.sort()
for i in range(len(s)):
    s1 += s[i][::-1]
for i in range(1,len(s1),2):
    if s1[i] < 0:
        s1[i] *= -1
for k in s1:
    s2.append(str(k))
for i in range(0,len(s2),2):
    print(s2[i]+" "+s2[i+1])

6530204321
# 1661513, 2022-10-29 09:26:37, PPP-- (60%)

l = [['A','E','I','O','L','N','R','S','T','U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V','W','Y'],['K'],['J','X'],['Q','Z'],]
s=[1,2,3,4,5,8,10]
def letter(c):
    score=0
    for i in range(len(c)):
        for u in range(len(l)):
            if c[i] in l[u]:
                score+=s[u]
    return score
words = input().split()
ansl=[]
for i in words:
    ans=letter(i)
    ansl.append([ans,i])
ansl.sort(reverse=True)
for i in ansl:
    print(i[1],i[0])
        

# 1661613, 2022-10-29 09:29:24, PPP-- (60%)

l = [['A','E','I','O','L','N','R','S','T','U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V','W','Y'],['K'],['J','X'],['Q','Z'],]
s=[1,2,3,4,5,8,10]
def letter(c):
    score=0
    for i in range(len(c)):
        for u in range(len(l)):
            if c[i] in l[u]:
                score+=s[u]
    return score
words = input().split()
ansl=[]
for i in words:
    ans=letter(i)
    ansl.append([ans,i])
ansl.sort(reverse=True)
for i in ansl:
    print(i[1].upper(),i[0])
        

# 1661787, 2022-10-29 09:36:49, PPP-- (60%)

l = [['A','E','I','O','L','N','R','S','T','U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V','W','Y'],['K'],['J','X'],['Q','Z'],]
s=[1,2,3,4,5,8,10]
def letter(c):
    t=False
    score=0
    for i in range(len(c)):
        for u in range(len(l)):
            if c[i] in l[u]:
                score+=s[u]
                t=True
    if t == False:
        return None
    return score
words = input().strip().split()
ansl=[]
for i in words:
    ans=letter(i)
    if ans == None:
        continue
    ansl.append([ans,i])
ansl.sort(reverse=True)
for i in ansl:
    print(i[1],i[0])


# 1662187, 2022-10-29 09:50:06, PPPPP (100%)

l = [['A','E','I','O','L','N','R','S','T','U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V','W','Y'],['K'],['J','X'],['Q','Z'],]
s=[1,2,3,4,5,8,10]
def letter(c):
    score=0
    for i in range(len(c)):
        for u in range(len(l)):
            if c[i] in l[u]:
                score+=s[u]
    return score
words = input().strip().split()
ansl=[]
c=[]
for i in words:
    ans=letter(i)
    ansl.append([ans,i])
    if ans not in c:
        c.append(ans)
        
ansl.sort(reverse=True)
d={}
check=[]
for i in ansl:
    if i[0] not in check:
        check.append(i[0])
        d[i[0]] = [i[1]]
    else:
        d[i[0]].append(i[1])

for i in sorted(c)[::-1]:
    for u in sorted(d[i]):
        print(u,i)



6531319021
# 1661357, 2022-10-29 09:21:38, xxxxx (0%)

def letter_point(c):
    n = 0
    if c in 'AEILNORSTU':
        n = 1
    elif c in 'DG':
        n = 2
    elif c in 'BCMP':
        c = 3
    elif c in 'FHVWY':
        n = 4
    elif c == 'K':
        n = 5
    elif c in 'JX':
        n = 8
    elif c in 'QZ':
        n = 10
    return n

def word_point(w):
    k = 0
    for c in w:
        k += letter_point(c)
    return k

word = input().strip().split()
for i in word:
    print(i, word_point(i))



exec(input().strip())
# 1661365, 2022-10-29 09:21:51, xxxxx (0%)

def letter_point(c):
    n = 0
    if c in 'AEILNORSTU':
        n = 1
    elif c in 'DG':
        n = 2
    elif c in 'BCMP':
        c = 3
    elif c in 'FHVWY':
        n = 4
    elif c == 'K':
        n = 5
    elif c in 'JX':
        n = 8
    elif c in 'QZ':
        n = 10
    return n

def word_point(w):
    k = 0
    for c in w:
        k += letter_point(c)
    return k

word = input().strip().split()
for i in word:
    print(i, word_point(i))

exec(input().strip())
# 1661592, 2022-10-29 09:28:47, P---- (20%)

def letter_point(c):
    n = 0
    if c in 'AEILNORSTU':
        n = 1
    elif c in 'DG':
        n = 2
    elif c in 'BCMP':
        c = 3
    elif c in 'FHVWY':
        n = 4
    elif c == 'K':
        n = 5
    elif c in 'JX':
        n = 8
    elif c in 'QZ':
        n = 10
    return n

def word_point(w):
    k = 0
    for c in w:
        k += letter_point(c)
    return k

word = input().split()
r = []
for i in word:
    r.append([-(word_point(i)), i])
r.sort()

for score,rr in r:
    print(rr, -score)
# 1661737, 2022-10-29 09:34:26, PPPPP (100%)

def letter_point(c):
    n = 0
    if c in 'AEILNORSTU':
        n = 1
    elif c in 'DG':
        n = 2
    elif c in 'BCMP':
        n = 3
    elif c in 'FHVWY':
        n = 4
    elif c == 'K':
        n = 5
    elif c in 'JX':
        n = 8
    elif c in 'QZ':
        n = 10
    return n

def word_point(w):
    k = 0
    for c in w:
        k += letter_point(c)
    return k

word = input().split()
r = []
for i in word:
    r.append([-(word_point(i)), i])
r.sort()

for score,rr in r:
    print(rr, -score)

6531321221
# 1661280, 2022-10-29 09:18:20, Pxxxx (20%)

point = {
    "A": 1,
    "E": 1,
    "I": 1,
    "L": 1,
    "N": 1,
    "O": 1,
    "R": 1,
    "S": 1,
    "T": 1,
    "U": 1,
    "D": 2,
    "G": 2,
    "B": 3,
    "C": 3,
    "M": 3,
    "P": 3,
    "F": 4,
    "H": 4,
    "V": 4,
    "W": 4,
    "Y": 4,
    "K": 5,
    "J": 8,
    "X": 8,
    "Q": 10,
    "Z": 10,
}
a = input()
p = 0
for s in a:
    p += point[s]
print(a + " " + str(p))

# 1661285, 2022-10-29 09:18:34, Pxxxx (20%)

point = {
    "A": 1,
    "E": 1,
    "I": 1,
    "L": 1,
    "N": 1,
    "O": 1,
    "R": 1,
    "S": 1,
    "T": 1,
    "U": 1,
    "D": 2,
    "G": 2,
    "B": 3,
    "C": 3,
    "M": 3,
    "P": 3,
    "F": 4,
    "H": 4,
    "V": 4,
    "W": 4,
    "Y": 4,
    "K": 5,
    "J": 8,
    "X": 8,
    "Q": 10,
    "Z": 10,
}
a = input().strip()
p = 0
for s in a:
    p += point[s]
print(a + " " + str(p))
# 1661328, 2022-10-29 09:20:30, P---- (20%)

point = {
    "A": 1,
    "E": 1,
    "I": 1,
    "L": 1,
    "N": 1,
    "O": 1,
    "R": 1,
    "S": 1,
    "T": 1,
    "U": 1,
    "D": 2,
    "G": 2,
    "B": 3,
    "C": 3,
    "M": 3,
    "P": 3,
    "F": 4,
    "H": 4,
    "V": 4,
    "W": 4,
    "Y": 4,
    "K": 5,
    "J": 8,
    "X": 8,
    "Q": 10,
    "Z": 10,
}
a = input().split()
p = 0
for lst in a:
    for s in lst:
        p += point[s]
    print(lst + " " + str(p))
    p = 0

# 1661420, 2022-10-29 09:23:48, PPPPP (100%)

point = {
    "A": 1,
    "E": 1,
    "I": 1,
    "L": 1,
    "N": 1,
    "O": 1,
    "R": 1,
    "S": 1,
    "T": 1,
    "U": 1,
    "D": 2,
    "G": 2,
    "B": 3,
    "C": 3,
    "M": 3,
    "P": 3,
    "F": 4,
    "H": 4,
    "V": 4,
    "W": 4,
    "Y": 4,
    "K": 5,
    "J": 8,
    "X": 8,
    "Q": 10,
    "Z": 10,
}
a = input().split()
p = 0
ans = []
for lst in a:
    for s in lst:
        p += point[s]
    ans.append([-p, lst])
    p = 0
ans.sort()
for poi, lst in ans:
    print(lst + " " + str(-poi))


6531323521
# 1661274, 2022-10-29 09:18:02, P---- (20%)

word = [e for e in input().split()]
result = []
point = {1:"AEILNORSTU",2:"DG",3:"BCMP",4:"FHVWY",5:"K",8:"JX",10:"QZ"}
for i in range(len(word)) :
    x = 0
    for j in word[i] :
        for k in point :
            if j in point[k] :
                x += k
                break
    result.append([word[i],x])
for i in result :
    print(i[0],i[1])
# 1661341, 2022-10-29 09:20:59, PPP-- (60%)

word = [e for e in input().split()]
result = []
point = {1:"AEILNORSTU",2:"DG",3:"BCMP",4:"FHVWY",5:"K",8:"JX",10:"QZ"}
for i in range(len(word)) :
    x = 0
    for j in word[i] :
        for k in point :
            if j in point[k] :
                x += k
                break
    result.append([x,word[i]])
result.sort()
result = result[-1::-1]
for i in result :
    print(i[1],i[0])
# 1661966, 2022-10-29 09:42:56, ----- (0%)

word = [e for e in input().split()]
point = {1:"AEILNORSTU",2:"DG",3:"BCMP",4:"FHVWY",5:"K",8:"JX",10:"QZ"}
pointt = {}
score = []
result = []
for i in range(len(word)) :
    x = 0
    for j in word[i] :
        for k in point :
            if j in point[k] :
                x += k
                break
    if x not in pointt :
        pointt[x] = [word[i]]
        score.append(x)
    else :
        pointt[x].append(word[i])
        pointt[x].sort()
    score.sort()
print(pointt)
score = score[-1::-1]
for i in score :
    result.append([pointt[i],i])
for i in range(len(result)):
    for j in result[i][0] :
        for k in j :
            print(j,result[i][1])
            break


        





    
    
    
    
    
#     #result.append([x,word[i]])
# result.sort()
# result = result[-1::-1]
# sortf = []
# for i in range(len(result)): 





# for i in result :
#     print(i[1],i[0])
# 1661983, 2022-10-29 09:43:23, PPPPP (100%)

word = [e for e in input().split()]
point = {1:"AEILNORSTU",2:"DG",3:"BCMP",4:"FHVWY",5:"K",8:"JX",10:"QZ"}
pointt = {}
score = []
result = []
for i in range(len(word)) :
    x = 0
    for j in word[i] :
        for k in point :
            if j in point[k] :
                x += k
                break
    if x not in pointt :
        pointt[x] = [word[i]]
        score.append(x)
    else :
        pointt[x].append(word[i])
        pointt[x].sort()
    score.sort()
score = score[-1::-1]
for i in score :
    result.append([pointt[i],i])
for i in range(len(result)):
    for j in result[i][0] :
        for k in j :
            print(j,result[i][1])
            break


        





    
    
    
    
    
#     #result.append([x,word[i]])
# result.sort()
# result = result[-1::-1]
# sortf = []
# for i in range(len(result)): 





# for i in result :
#     print(i[1],i[0])

6531330921
# 1661292, 2022-10-29 09:18:46, xxxxx (0%)

score = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4,"G":2,"H":4,"I":1,"J":8,"K":5,"L":1,"M":3,"N":1,"O":1,"P":3,"Q":10,"R":1,"S":1,"T":1,"U":1,"V":4,"W":4,"X":8,"Y":4,"Z":10}
scount = []
s = 0
words = input.split()
for word in words:
    for c in word:
        s += score[c]
    scount.append([-1*s,word])

scount.sort()
for e in scount:
    print(-1*e[0])
# 1661331, 2022-10-29 09:20:40, ----- (0%)

score = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4,"G":2,"H":4,"I":1,"J":8,"K":5,"L":1,"M":3,"N":1,"O":1,"P":3,"Q":10,"R":1,"S":1,"T":1,"U":1,"V":4,"W":4,"X":8,"Y":4,"Z":10}
scount = []
s = 0
words = input().split()
for word in words:
    for c in word:
        s += score[c]
    scount.append([-1*s,word])

scount.sort()
for e in scount:
    print(-1*e[0])
# 1661355, 2022-10-29 09:21:31, ----- (0%)

score = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4,"G":2,"H":4,"I":1,"J":8,"K":5,"L":1,"M":3,"N":1,"O":1,"P":3,"Q":10,"R":1,"S":1,"T":1,"U":1,"V":4,"W":4,"X":8,"Y":4,"Z":10}
scount = []
words = input().split()
for word in words:
    s = 0
    for c in word:
        s += score[c]
    scount.append([-1*s,word])

scount.sort()
for e in scount:
    print(-1*e[0])
# 1661382, 2022-10-29 09:22:34, PPPPP (100%)

score = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4,"G":2,"H":4,"I":1,"J":8,"K":5,"L":1,"M":3,"N":1,"O":1,"P":3,"Q":10,"R":1,"S":1,"T":1,"U":1,"V":4,"W":4,"X":8,"Y":4,"Z":10}
scount = []
words = input().split()
for word in words:
    s = 0
    for c in word:
        s += score[c]
    scount.append([-1*s,word])

scount.sort()
for e in scount:
    print(e[1],-1*e[0])

6531344721
# 1661459, 2022-10-29 09:25:07, PPP-- (60%)

def letter_point(c):
    p = 0
    s1 = "AEILNORSTU"
    s2 = "DG"
    s3 = "BCMP"
    s4 = "FHVWY"
    s5 = "K"
    s8 = "JX"
    s10 = "QZ"
    if c in s1:
        return 1
    if c in s2:
        return 2
    if c in s3:
        return 3
    if c in s4:
        return 4
    if c in s5:
        return 5
    if c in s8:
        return 8
    if c in s10:
        return 10


def word_point(w):
    po = 0
    for e in w:
        po += letter_point(e)
    return po


d = []
t = input().split()
for e in t:
    d.append([word_point(e), e])
d.sort()
d = d[::-1]
for poi, wor in d:
    print(wor, poi)
# 1662043, 2022-10-29 09:45:24, ----- (0%)

def letter_point(c):
    p = 0
    s1 = "AEILNORSTU"
    s2 = "DG"
    s3 = "BCMP"
    s4 = "FHVWY"
    s5 = "K"
    s8 = "JX"
    s10 = "QZ"
    if c in s1:
        return 1
    if c in s2:
        return 2
    if c in s3:
        return 3
    if c in s4:
        return 4
    if c in s5:
        return 5
    if c in s8:
        return 8
    if c in s10:
        return 10


def word_point(w):
    po = 0
    for e in w:
        po += letter_point(e)
    return po


d = []
t = input().split()
for e in t:
    d.append([word_point(e), e])
d.sort()
d = d[::-1]
p1 = d[0][0]
print(p1)
d1 = []

for i in range(len(d)):
    if d[i][0] == p1:
        d1.append(d[i][::-1])
        p1 = d[i][0]
    else:
        d1.sort()
        for a, b in d1:
            print(a, b)
        d1 = []
        d1.append(d[i][::-1])
        p1 = d[i][0]
for a, b in d1:
    print(a, b)

# 1662065, 2022-10-29 09:46:08, PPPP- (80%)

def letter_point(c):
    p = 0
    s1 = "AEILNORSTU"
    s2 = "DG"
    s3 = "BCMP"
    s4 = "FHVWY"
    s5 = "K"
    s8 = "JX"
    s10 = "QZ"
    if c in s1:
        return 1
    if c in s2:
        return 2
    if c in s3:
        return 3
    if c in s4:
        return 4
    if c in s5:
        return 5
    if c in s8:
        return 8
    if c in s10:
        return 10


def word_point(w):
    po = 0
    for e in w:
        po += letter_point(e)
    return po


d = []
t = input().split()
for e in t:
    d.append([word_point(e), e])
d.sort()
d = d[::-1]
p1 = d[0][0]

d1 = []

for i in range(len(d)):
    if d[i][0] == p1:
        d1.append(d[i][::-1])
        p1 = d[i][0]
    else:
        d1.sort()
        for a, b in d1:
            print(a, b)
        d1 = []
        d1.append(d[i][::-1])
        p1 = d[i][0]
for a, b in d1:
    print(a, b)
# 1662143, 2022-10-29 09:49:01, PPPPP (100%)

def letter_point(c):
    p = 0
    s1 = "AEILNORSTU"
    s2 = "DG"
    s3 = "BCMP"
    s4 = "FHVWY"
    s5 = "K"
    s8 = "JX"
    s10 = "QZ"
    if c in s1:
        return 1
    if c in s2:
        return 2
    if c in s3:
        return 3
    if c in s4:
        return 4
    if c in s5:
        return 5
    if c in s8:
        return 8
    if c in s10:
        return 10


def word_point(w):
    po = 0
    for e in w:
        po += letter_point(e)
    return po


d = []
t = input().split()
for e in t:
    d.append([word_point(e), e])
d.sort()
d = d[::-1]
p1 = d[0][0]

d1 = []

for i in range(len(d)):
    if d[i][0] == p1:
        d1.append(d[i][::-1])
        p1 = d[i][0]
    else:
        d1.sort()

        for a, b in d1:
            print(a, b)
        d1 = []
        d1.append(d[i][::-1])
        p1 = d[i][0]
d1.sort()
for a, b in d1:
    print(a, b)

6532054921
# 1661272, 2022-10-29 09:17:55, PPP-- (60%)

def letter_point(c):
    p = [[1,"AEILNORSTU"],
    [2,"DG"],
    [3,"BCMP"],
    [4,"FHVWY"],
    [5,"K"],
    [8,"JX"],
    [10,"QZ"]]
    for i in p :
        if(c in i[1]) :
            return i[0]
def word_point(w):
    sum = 0
    for i in w :
        sum += letter_point(i)
    return sum
words = input().split()
l = []
for i in words :
    l.append([word_point(i),i])
l.sort()
for j in l[::-1] :
    print(j[1],j[0])
# 1661594, 2022-10-29 09:28:49, PPPPP (100%)

def letter_point(c):
    p = [[1,"AEILNORSTU"],
    [2,"DG"],
    [3,"BCMP"],
    [4,"FHVWY"],
    [5,"K"],
    [8,"JX"],
    [10,"QZ"]]
    for i in p :
        if(c in i[1]) :
            return i[0]
def word_point(w):
    sum = 0
    for i in w :
        sum += letter_point(i)
    return sum
words = input().split()
l = []
for i in words :
    l.append([word_point(i),i])
l.sort()
l = l[::-1]
result = [[-1,[]]]
for i in l :
    if result[-1][0] == i[0] :
        result[-1][1].append(i[1])
    else :
        result.append([i[0],[i[1]]])
for a in range(1,len(result)) :
    result[a][1].sort()
    for k in range(len(result[a][1])) :
        print(result[a][1][k],result[a][0])
# 1663569, 2022-10-29 10:27:18, xxxxx (0%)

def letter_point(c):
    Number = (4837.4234 * (ord(c) - 6) // 4) & (len(c) + 7) ^ 0
    for Linear in ord(c) : Number ^= 2 & ord(c)
    Polalizer = [[1,'A'],[1,'E'],[1,'I'],[1,'L'],[1,'N'],[1,'O'],[1,'R'],[1,'S'],[1,'T'],[1,'U'],[2,'D'],[2,'G'],[3,'B'],[3,'C'],[3,'M'],[3,'P'],[4,'F'],[4,'H'],[4,'V'],[4,'W'],[4,'Y'],[5,'K'],[8,'J'],[8,'X'],[10,'Q'],[10,'Z']]
    for Linear in Polalizer : 
        if c in Linear[1] and Linear[0] not in "_--54870**" : return Linear[0]
    if(Number & ord(c) + 1.2 < 0) : return "&"
def word_point(w):
    Neural_Network = []
    Bias_Contributor = [123,453]
    for _EX_Engine in range(len(w),1) :
        Neural_Network += Bias_Contributor * _EX_Engine
    Cumulative_Multiplier = -12
    for _EX_Engine in w :
        Cumulative_Multiplier += letter_point(_EX_Engine)
        Neural_Network.append(Cumulative_Multiplier**2)
    if(Cumulative_Multiplier + 13 != 0) :
        return Cumulative_Multiplier + (9 * 8) - (5 * 12)
    return Neural_Network[0:Cumulative_Multiplier + 12]
words = input().split()
Lower_bound = []
for i in words : Lower_bound.append([word_point(i),i])
Lower_bound.sort()
Lower_bound = Lower_bound[::-1][::1][0:len(Lower_bound)][::-1][len(Lower_bound)::-1]
convex_Geometric = [[-1,[]]]
for _Matrix_handler in Lower_bound :
    if convex_Geometric[-1][0] == _Matrix_handler[0] : convex_Geometric[-1][1].append(_Matrix_handler[1])
    else : convex_Geometric.append([_Matrix_handler[0],[_Matrix_handler[1]]])
for Binary_destructor in range(1,len(convex_Geometric)) :
    convex_Geometric[Binary_destructor][1].sort()
    for k in range(len(convex_Geometric[Binary_destructor][1])) :
        print(convex_Geometric[Binary_destructor][1][k],convex_Geometric[Binary_destructor][0])
# 1663586, 2022-10-29 10:27:34, PPPPP (100%)

def letter_point(c):
    p = [[1,"AEILNORSTU"],
    [2,"DG"],
    [3,"BCMP"],
    [4,"FHVWY"],
    [5,"K"],
    [8,"JX"],
    [10,"QZ"]]
    for i in p :
        if(c in i[1]) :
            return i[0]
def word_point(w):
    sum = 0
    for i in w :
        sum += letter_point(i)
    return sum
words = input().split()
l = []
for i in words :
    l.append([word_point(i),i])
l.sort()
l = l[::-1]
result = [[-1,[]]]
for i in l :
    if result[-1][0] == i[0] :
        result[-1][1].append(i[1])
    else :
        result.append([i[0],[i[1]]])
for a in range(1,len(result)) :
    result[a][1].sort()
    for k in range(len(result[a][1])) :
        print(result[a][1][k],result[a][0])

6231720721
# 1661347, 2022-10-29 09:21:18, Pxxxx (20%)

d = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4, 'V':4, 'W':4, 'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
s= input()
c=0
for ch in s:
    c+=d[ch]
print(s,c)
    

# 1661555, 2022-10-29 09:28:00, P---- (20%)

d = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4, 'V':4, 'W':4, 'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
s= input().split()
c=0
st=''

for l in s:
    for ch in l:
        c+=d[ch]
    st=l
    print(l,c)
    c=0
    
#     

# 1661761, 2022-10-29 09:35:42, PPPPP (100%)

d = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4, 'V':4, 'W':4, 'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
s= input().split()
c=0
st=''
ls=[]
for l in s:
    for ch in l:
        c+=d[ch]
    
    ls.append([-c,l])
    c=0
ls.sort()
# print(ls)

for e in ls:
    print(e[1],-e[0])
    
  


6230046221
# 1661413, 2022-10-29 09:23:42, P---- (20%)

data = [0,['A','E','I','L','N','O','R','S','T','U'],['D','G'],['B', 'C', 'M', 'P'],['F','H','V','W', 'Y'
],['K'],['J','X'],['Q','Z']]
a = ['A','E','I','L','N','O','R','S','T','U']
b = ['D','G']
c = ['B', 'C', 'M', 'P']
d = ['F','H','V','W', 'Y'
]
e = ['K']
f = ['J','X']
g = ['Q','Z']
n = input().split()
value = []
for i in range(len(n)):
    value.append(n[i])
    count = 0
    for j in n[i]:
        if j in a:
            count += 1
        elif j in b:
            count += 2
        elif j in c:
            count += 3
        elif j in d:
            count += 4
        elif j in e:
            count += 5
        elif j in f:
            count += 8
        elif j in g:
            count += 10
    value.append(str(count))
    count = 0
for i in range(0,len(value),2):
    print(value[i],value[i+1])
     
            

# 1661756, 2022-10-29 09:35:29, PPP-- (60%)

a = ['A','E','I','L','N','O','R','S','T','U']
b = ['D','G']
c = ['B', 'C', 'M', 'P']
d = ['F','H','V','W', 'Y'
]
e = ['K']
f = ['J','X']
g = ['Q','Z']
n = input().split()
value = []
for i in range(len(n)):
    count = 0
    for j in n[i]:
        if j in a:
            count += 1
        elif j in b:
            count += 2
        elif j in c:
            count += 3
        elif j in d:
            count += 4
        elif j in e:
            count += 5
        elif j in f:
            count += 8
        elif j in g:
            count += 10
    value.append([count,n[i]])
    count = 0
final = sorted(value)
for i in range(-1,-(len(final)+1),-1):
    print(final[i][1],final[i][0])

# 1663310, 2022-10-29 10:22:09, PPPPP (100%)

a = ['A','E','I','L','N','O','R','S','T','U']
b = ['D','G']
c = ['B', 'C', 'M', 'P']
d = ['F','H','V','W', 'Y'
]
e = ['K']
f = ['J','X']
g = ['Q','Z']
n = input().split()
value = []
for i in range(len(n)):
    count = 0
    for j in n[i]:
        if j in a:
            count += 1
        elif j in b:
            count += 2
        elif j in c:
            count += 3
        elif j in d:
            count += 4
        elif j in e:
            count += 5
        elif j in f:
            count += 8
        elif j in g:
            count += 10
    value.append([-count,n[i]])
    count = 0
final = sorted(value)
for e in range(len(final)):
    print(final[e][1],(-1)*(final[e][0]))


6230423121
# 1661749, 2022-10-29 09:35:16, P---- (20%)

words = input().split()
answer = []
for i in range(len(words)):
    score = 0
    for j in range(len(words[i])):
        if words[i][j] in 'AEILNORSTU':
            score += 1
        elif words[i][j] in 'DG':
            score += 2
        elif words[i][j] in 'BCMP':
            score += 3
        elif words[i][j] in 'FHVWY':
            score += 4
        elif words[i][j] in 'K':
            score += 5
        elif words[i][j] in 'JX':
            score += 8
        elif words[i][j] in 'QZ':
            score += 10
    answer.append ([words[i], score])
answer.sort()
answer = answer[::-1]
for i in range(len(answer)):
    print (answer[i][0], answer[i][1])
# 1662156, 2022-10-29 09:49:18, P---- (20%)

def letter_point(c):
    score = 0
    if c in 'AEILNORSTU':
        score = 1
    elif c in 'DG':
        score = 2
    elif c in 'BCMP':
        score = 3
    elif c in 'FHVWY':
        score = 4
    elif c in 'K':
        score = 5
    elif c in 'JX':
        score = 8
    elif c in 'QZ':
        score = 10
    return score

def word_point(w):
    wscore = 0
    for i in w:
        wscore += letter_point(i)
    return wscore
        
    
    
words = input().split()

answer = []
for i in range(len(words)):
    answer.append ([words[i], word_point(words[i])])
answer.sort()
answer = answer[::-1]
for i in range(len(answer)):
    print (answer[i][0], answer[i][1])
# 1662498, 2022-10-29 09:59:38, PPPPP (100%)

def letter_point(c):
    score = 0
    if c in 'AEILNORSTU':
        score = 1
    elif c in 'DG':
        score = 2
    elif c in 'BCMP':
        score = 3
    elif c in 'FHVWY':
        score = 4
    elif c in 'K':
        score = 5
    elif c in 'JX':
        score = 8
    elif c in 'QZ':
        score = 10
    return score

def word_point(w):
    wscore = 0
    for i in w:
        wscore += letter_point(i)
    return wscore
        
    
    
words = input().split()

answer = []
for i in range(len(words)):
    answer.append ([words[i], word_point(words[i])])
answer.sort()
for k in range(len(answer)-1):
    for i in range(len(answer)-1):
        if answer[i][1] < answer[i+1][1]:
            answer[i],answer[i+1] = answer[i+1],answer[i]

for i in range(len(answer)):
    print (answer[i][0], answer[i][1])

6430224821
# 1661625, 2022-10-29 09:30:02, P---- (20%)

def word_point(w):
    n = 0
    for e in w:
        if e in one:
            n += 1
        if e in two:
            n += 2
        if e in three:
            n += 3
        if e in four:
            n += 4
        if e in five:
            n += 5
        if e in eight:
            n += 8
        if e in ten:
            n += 10
    return n
'----------------------------------'
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
'-----------------------------------'
x = input().split()
es = []
bn = []
for i in x:
    y = word_point(i)
    es.append(y)
for w in range(len(es)):
    bn.append([es[w],x[w]])
    
bn.sort()
for d in bn:
    print(d[1],d[0])
# 1661698, 2022-10-29 09:32:35, PP--- (40%)

def word_point(w):
    n = 0
    for e in w:
        if e in one:
            n += 1
        if e in two:
            n += 2
        if e in three:
            n += 3
        if e in four:
            n += 4
        if e in five:
            n += 5
        if e in eight:
            n += 8
        if e in ten:
            n += 10
    return n
'----------------------------------'
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
'-----------------------------------'
x = input().split()
es = []
bn = []
for i in x:
    y = word_point(i)
    es.append(y)
for w in range(len(es)):
    bn.append([es[w],x[w]])
    
bn.sort()
bn[0],bn[-1] = bn[-1],bn[0]
for d in bn:
    print(d[1],d[0])
# 1663736, 2022-10-29 10:30:34, PPPPP (100%)

def word_point(w):
    n = 0
    for e in w:
        if e in one:
            n += 1
        if e in two:
            n += 2
        if e in three:
            n += 3
        if e in four:
            n += 4
        if e in five:
            n += 5
        if e in eight:
            n += 8
        if e in ten:
            n += 10
    return n
'----------------------------------'
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
'-----------------------------------'
x = input().split()
es = []
bn = []
for i in x:
    y = word_point(i)
    es.append(y)
for w in range(len(es)):
    bn.append([-es[w],x[w]])
    
bn.sort()

for d in bn:
    print(d[1],-d[0])
    

6530112221
# 1661403, 2022-10-29 09:23:21, P---- (20%)

def letter_point(c):
    letter = {1:['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'], 2 : ['D', 'G'], 3 : ['B', 'C', 'M', 'P'], 4 : ['F', 'H', 'V', 'W', 'Y'], 5 : ['K'], 8 : ['J', 'X'], 10 : ['Q', 'Z']}
    for j in letter:
        if c in letter[j]:
            return j

def word_point(w):
    point = 0
    for i in w:
        point += letter_point(i)
        
    return point

words = input().split()
for i in words:
    print(i, word_point(i))

# 1662842, 2022-10-29 10:10:15, ----- (0%)

def letter_point(c):
    letter = {1:['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'], 2 : ['D', 'G'], 3 : ['B', 'C', 'M', 'P'], 4 : ['F', 'H', 'V', 'W', 'Y'], 5 : ['K'], 8 : ['J', 'X'], 10 : ['Q', 'Z']}
    for j in letter:
        if c in letter[j]:
            return j

def word_point(w):
    point = 0
    for i in w:
        point += letter_point(i)
        
    return point

words = input().split()

rank = []
for i in words:
    rank.append([word_point(i), i])


rank.sort(reverse = True)
same = 0
temp = []
ans = []
found = False

for i in rank:
    
    if i[0] == same:
        temp.append([i[1], i[0]])
        
    else:
        for j in sorted(temp):
            ans.append(j)
        temp = []
        same = i[0]
        
        temp.append([i[1], i[0]])
    
for j in sorted(temp):
        ans.append(j)
for i in ans:
    print(i[1] , i[0])


# 1662856, 2022-10-29 10:10:38, PPPPP (100%)

def letter_point(c):
    letter = {1:['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'], 2 : ['D', 'G'], 3 : ['B', 'C', 'M', 'P'], 4 : ['F', 'H', 'V', 'W', 'Y'], 5 : ['K'], 8 : ['J', 'X'], 10 : ['Q', 'Z']}
    for j in letter:
        if c in letter[j]:
            return j

def word_point(w):
    point = 0
    for i in w:
        point += letter_point(i)
        
    return point

words = input().split()

rank = []
for i in words:
    rank.append([word_point(i), i])


rank.sort(reverse = True)
same = 0
temp = []
ans = []
found = False

for i in rank:
    
    if i[0] == same:
        temp.append([i[1], i[0]])
        
    else:
        for j in sorted(temp):
            ans.append(j)
        temp = []
        same = i[0]
        
        temp.append([i[1], i[0]])
    
for j in sorted(temp):
        ans.append(j)
for i in ans:
    print(i[0] , i[1])



6530139221
# 1661921, 2022-10-29 09:41:06, PPP-- (60%)

Word_Input = input().split()
Score = [1, 2, 3, 4, 5, 8, 10]
Word = [['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],
        ['D', 'G'],
        ['B', 'C', 'M', 'P'],
        ['F', 'H', 'V', 'W', 'Y'],
        ['K'],
        ['J', 'X'],
        ['Q', 'Z']]

Result = []

for word in Word_Input:
    Score_Cal = 0
    for char in word:
        for i in range(len(Word)):
            if char in Word[i]:
                #print(char)
                Score_Cal += Score[i]
                
    Result.append([word, Score_Cal])
    
Result.sort(key=lambda x:x[0], reverse=True)
Result.sort(key=lambda x:x[1], reverse=True)
for x in Result:
    print(x[0], x[1])
# 1664241, 2022-10-29 10:38:23, PPP-- (60%)

Word_Input = input().split()
Score = [1, 2, 3, 4, 5, 8, 10]
Word = [['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],
        ['D', 'G'],
        ['B', 'C', 'M', 'P'],
        ['F', 'H', 'V', 'W', 'Y'],
        ['K'],
        ['J', 'X'],
        ['Q', 'Z']]

Result = []

for word in Word_Input:
    Score_Cal = 0
    for char in word:
        for i in range(len(Word)):
            if char in Word[i]:
                #print(char)
                Score_Cal += Score[i]
                
    Result.append([word, Score_Cal])
    
Result.sort(key=lambda x:x[0], reverse=True)
Result.sort(key=lambda x:x[1], reverse=True)
for x in Result:
    print(x[0], x[1])
# 1664345, 2022-10-29 10:39:22, PPPPP (100%)

Word_Input = input().split()
Score = [1, 2, 3, 4, 5, 8, 10]
Word = [['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],
        ['D', 'G'],
        ['B', 'C', 'M', 'P'],
        ['F', 'H', 'V', 'W', 'Y'],
        ['K'],
        ['J', 'X'],
        ['Q', 'Z']]

Result = []

for word in Word_Input:
    Score_Cal = 0
    for char in word:
        for i in range(len(Word)):
            if char in Word[i]:
                #print(char)
                Score_Cal += Score[i]
                
    Result.append([word, Score_Cal])
    
Result.sort(key=lambda x:x[0])
Result.sort(key=lambda x:x[1], reverse=True)
for x in Result:
    print(x[0], x[1])

6530196021
# 1661434, 2022-10-29 09:24:27, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        total += 1
    elif c in 'DG':
        total += 2
    elif c in 'BCMP':
        total += 3
    elif c in 'FHVWY':
        total += 4
    elif c =='K':
        total += 5
    elif c in 'JX':
        total += 8
    elif c in 'QZ':
        total += 10
    return total

def word_point(w):
    total = 0
    for e in w:
        if e in 'AEILNORSTU':
            total += 1
        elif e in 'DG':
            total += 2
        elif e in 'BCMP':
            total += 3
        elif e in 'FHVWY':
            total += 4
        elif e =='K':
            total += 5
        elif e in 'JX':
            total += 8
        elif e in 'QZ':
            total += 10
    return total

words = input().split()
for i in range(len(words)):
    ans = ''
    for e in words[i]:
        ans += e
    print(ans, word_point(ans))

# 1661501, 2022-10-29 09:26:12, P---- (20%)

def word_point(w):
    total = 0
    for e in w:
        if e in 'AEILNORSTU':
            total += 1
        elif e in 'DG':
            total += 2
        elif e in 'BCMP':
            total += 3
        elif e in 'FHVWY':
            total += 4
        elif e =='K':
            total += 5
        elif e in 'JX':
            total += 8
        elif e in 'QZ':
            total += 10
    return total

words = input().split()
for i in range(len(words)):
    ans = ''
    for e in words[i]:
        ans += e
    print(ans, word_point(ans))
# 1661722, 2022-10-29 09:33:31, PPPPP (100%)

def word_point(w):
    total = 0
    for e in w:
        if e in 'AEILNORSTU':
            total += 1
        elif e in 'DG':
            total += 2
        elif e in 'BCMP':
            total += 3
        elif e in 'FHVWY':
            total += 4
        elif e =='K':
            total += 5
        elif e in 'JX':
            total += 8
        elif e in 'QZ':
            total += 10
    return total
a = []
words = input().split()
for i in range(len(words)):
    ans = ''
    for r in words[i]:
        ans += r
    a.append([word_point(ans), ans])
    for j in range(len(a)):
        a[j][0] = -1*a[j][0]
    a.sort()
    for k in range(len(a)):
        a[k][0] = -1*a[k][0]
for r in range(len(a)):
    print(a[r][1],a[r][0])

6530206621
# 1661241, 2022-10-29 09:15:00, P-xxx (20%)

d = {}
for a in 'AEILNORSTU':
    d[a] = 1
for a in 'DG':
    d[a] = 2
for a in 'BCMP':
    d[a] = 3
for a in 'FHVWY':
    d[a] = 4
d["k"] = 5
for a in 'JK':
    d[a] = 8
for a in "QZ":
    d[a] = 10

t = input().split()

for a in t:
    c = 0
    for i in range(len(a)):
        c += d[a[i]]
    print(a,c)

# 1661247, 2022-10-29 09:15:48, P---- (20%)

d = {}
for a in 'AEILNORSTU':
    d[a] = 1
for a in 'DG':
    d[a] = 2
for a in 'BCMP':
    d[a] = 3
for a in 'FHVWY':
    d[a] = 4
d["K"] = 5
for a in 'JX':
    d[a] = 8
for a in "QZ":
    d[a] = 10

t = input().split()

for a in t:
    a = a.upper()
    c = 0
    for i in range(len(a)):
        c += d[a[i]]
    print(a,c)

# 1661291, 2022-10-29 09:18:42, PPPPP (100%)

d = {}
for a in 'AEILNORSTU':
    d[a] = 1
for a in 'DG':
    d[a] = 2
for a in 'BCMP':
    d[a] = 3
for a in 'FHVWY':
    d[a] = 4
d["K"] = 5
for a in 'JX':
    d[a] = 8
for a in "QZ":
    d[a] = 10

t = input().split()
l = []

for a in t:
    a = a.upper()
    c = 0
    for i in range(len(a)):
        c += d[a[i]]
    l.append([-c,a])

l.sort()

for word,point in l:
    print(point,-1*word)


6530209521
# 1661385, 2022-10-29 09:22:38, PPPxx (60%)

def letter_point(c):
    if c in 'AEILNORSTU' :
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c == 'k' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ' :
        return 10
    
def word_point(w):
    score = 0
    for i in w :
        score += letter_point(i)
    return score
f = []
words = input().split()
for h in words :
    f.append([word_point(h),h])
f.sort(reverse = True)
for dd in f :
    print(dd[1],dd[0])

# 1661478, 2022-10-29 09:25:45, PPPxx (60%)

def letter_point(c):
    if c in 'AEILNORSTU' :
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c == 'k' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ' :
        return 10
    
def word_point(w):
    score = 0
    for i in w :
        score += letter_point(i)
    return score
f = []

words = input().split()
for h in words :
    f.append([-word_point(h),h])
f.sort()
for dd in f :
    print(dd[1],-dd[0])

# 1661564, 2022-10-29 09:28:13, PPPPP (100%)

def letter_point(c):
    if c in 'AEILNORSTU' :
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c == 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ' :
        return 10
    
def word_point(w):
    score = 0
    for i in w :
        score += letter_point(i)
    return score
f = []

words = input().split()
for h in words :
    f.append([-word_point(h),h])
f.sort()
for dd in f :
    print(dd[1],-dd[0])

6531322921
# 1661541, 2022-10-29 09:27:40, xxxxx (0%)

def letter_point(c):
    point = {["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:1,["D", "G"]:2,["B", "C", "M", "P"]:3,
    ["F", "H", "V", "W", "Y"]:4,["K"]:5,["J", "X"]:8,["Q", "Z"]:10}
    for p in point:
        if c in p:
            return point[p]
def word_point(c):
    total = 0
    for a in c:
        total += letter_point(a)
    return total
word = input().split()
all = {}
score = []
for w in word:
    t = word_point(w)
    score.append(t)
    if t not in all:
        all[t] = [w]
    else:
        all[t].append(w)
for b in all:
    all[b].sort()
score.sort(reverse=True)
for n in score:
    for m in all[n]:
        print(m,n)
# 1661633, 2022-10-29 09:30:10, PPP-- (60%)

def letter_point(c):
    point = {("A", "E", "I", "L", "N", "O", "R", "S", "T", "U"):1,("D", "G"):2,("B", "C", "M", "P"):3,
    ("F", "H", "V", "W", "Y"):4,("K",):5,("J", "X"):8,("Q", "Z"):10}
    for p in point:
        if c in p:
            return point[p]
def word_point(c):
    total = 0
    for a in c:
        total += letter_point(a)
    return total
word = input().split()
all = {}
score = []
for w in word:
    t = word_point(w)
    score.append(t)
    if t not in all:
        all[t] = [w]
    else:
        all[t].append(w)
for b in all:
    all[b].sort()
score.sort(reverse=True)
for n in score:
    for m in all[n]:
        print(m,n)
# 1661726, 2022-10-29 09:33:50, PPPPP (100%)

def letter_point(c):
    point = {("A", "E", "I", "L", "N", "O", "R", "S", "T", "U"):1,("D", "G"):2,("B", "C", "M", "P"):3,
    ("F", "H", "V", "W", "Y"):4,("K",):5,("J", "X"):8,("Q", "Z"):10}
    for p in point:
        if c in p:
            return point[p]
def word_point(c):
    total = 0
    for a in c:
        total += letter_point(a)
    return total
word = input().split()
all = {}
score = []
for w in word:
    t = word_point(w)
    if t not in score:
        score.append(t)
    if t not in all:
        all[t] = [w]
    else:
        all[t].append(w)
for b in all:
    all[b].sort()
score.sort(reverse=True)
for n in score:
    for m in all[n]:
        print(m,n)

6531339621
# 1661278, 2022-10-29 09:18:17, ----- (0%)

def letter_point(char):
    if(char == 'Z' or char == 'Q'):
        return 10
    if(char == 'J' or char == 'X'):
        return 8
    if(char == 'K'):
        return 5
    if(char in 'FHVWY'):
        return 4
    if(char in 'BCMP'):
        return 3
    if(char in 'DG'):
        return 2
    return 1


def word_point(word):
    pts = 0
    for char in word:
        pts += letter_point(char)
    return pts


wordList = [(word_point(word), word) for word in input().split()]
wordList.sort(reverse=True)
print(wordList)
for pair in wordList:
    print(pair[1], pair[0])

# 1661309, 2022-10-29 09:19:40, PPP-- (60%)

def letter_point(char):
    if(char == 'Z' or char == 'Q'):
        return 10
    if(char == 'J' or char == 'X'):
        return 8
    if(char == 'K'):
        return 5
    if(char in 'FHVWY'):
        return 4
    if(char in 'BCMP'):
        return 3
    if(char in 'DG'):
        return 2
    return 1


def word_point(word):
    pts = 0
    for char in word:
        pts += letter_point(char)
    return pts


wordList = [(word_point(word), word) for word in input().split()]
wordList.sort(reverse=True)

for pair in wordList:
    print(pair[1], pair[0])
# 1661527, 2022-10-29 09:27:12, PPPPP (100%)

def letter_point(char):
    if(char == 'Z' or char == 'Q'):
        return 10
    if(char == 'J' or char == 'X'):
        return 8
    if(char == 'K'):
        return 5
    if(char in 'FHVWY'):
        return 4
    if(char in 'BCMP'):
        return 3
    if(char in 'DG'):
        return 2
    return 1


def word_point(word):
    pts = 0
    for char in word:
        pts += letter_point(char)
    return pts


def compare(pair1, pair2):
    if(pair1[0] != pair2[0]):
        return pair1[0] < pair2[0]
    else:
        return pair1[1] > pair2[1]


def bubbleSort(pairList):
    while(True):
        isSorted = True
        # check section
        for i in range(len(pairList) - 1):
            if(compare(pairList[i], pairList[i+1])):
                isSorted = False
                # swap
                pairList[i], pairList[i+1] = pairList[i+1], pairList[i]
        if(isSorted):
            break
    return None


inList = input().split()
wordList = []
for word in inList:
    wordList.append([word_point(word), word])
bubbleSort(wordList)
for pair in wordList:
    print(pair[1], pair[0])


6532027021
# 1661245, 2022-10-29 09:15:24, P--PP (60%)

def letter_point(c) :
    if c in "AEILNORSTU" :
        return 1
    elif c in "DG" :
        return 2
    elif c in "BCMP" :
        return 3
    elif c in "FHVWY" :
        return 4
    elif c in "K" :
        return 5
    elif c in "JX" :
        return 8
    elif c in "QZ" :
        return 10

words = input().split(' ')
tmp = []
for w in words :
    sum_point = 0
    for c in w :
        sum_point += letter_point(c)
    
    tmp.append((-sum_point, w))

tmp.sort()

for t in tmp :
    print(t[1], -t[0])
# 1661255, 2022-10-29 09:16:54, P--PP (60%)

def letter_point(c) :
    if c in "AEILNORSTU" :
        return 1
    elif c in "DG" :
        return 2
    elif c in "BCMP" :
        return 3
    elif c in "FHVWY" :
        return 4
    elif c in "K" :
        return 5
    elif c in "JX" :
        return 8
    elif c in "QZ" :
        return 10
    return 0

words = input().split(' ')
tmp = []
for w in words :
    sum_point = 0
    for c in w.strip() :
        sum_point += letter_point(c)
    
    tmp.append((-sum_point, w))

tmp.sort()

for t in tmp :
    print(t[1], -t[0])
# 1662002, 2022-10-29 09:44:07, PPPPP (100%)

def letter_point(c) :
    if c in "AEILNORSTU" :
        return 1
    elif c in "DG" :
        return 2
    elif c in "BCMP" :
        return 3
    elif c in "FHVWY" :
        return 4
    elif c in "K" :
        return 5
    elif c in "JX" :
        return 8
    elif c in "QZ" :
        return 10
    return 0

def word_point(w) :
    sum_point = 0
    for c in w :
        sum_point += letter_point(c)
    return sum_point

words = input().split()
tmp = []
for w in words :    
    tmp.append((-word_point(w), w))

tmp.sort()

for t in tmp :
    print(t[1], -t[0])

6532125821
# 1661312, 2022-10-29 09:19:47, P---- (20%)

score = {}

score['A'] = 1
score['E'] = 1
score['I'] = 1
score['L'] = 1
score['N'] = 1
score['O'] = 1
score['R'] = 1
score['S'] = 1
score['T'] = 1
score['U'] = 1

score['D'] = 2
score['G'] = 2

score['B'] = 3
score['C'] = 3
score['M'] = 3
score['P'] = 3

score['F'] = 4
score['H'] = 4
score['V'] = 4
score['W'] = 4
score['Y'] = 4

score['K'] = 5

score['J'] = 8
score['X'] = 8

score['Q'] = 10
score['Z'] = 10

def Q(word):
    ans = 0
    for c in word:
        ans += score[c]
    return ans

word_list = input().split()

for word in word_list:
    print(word , Q(word))
# 1661336, 2022-10-29 09:20:51, P---- (20%)

score = {}

score['A'] = 1
score['E'] = 1
score['I'] = 1
score['L'] = 1
score['N'] = 1
score['O'] = 1
score['R'] = 1
score['S'] = 1
score['T'] = 1
score['U'] = 1

score['D'] = 2
score['G'] = 2

score['B'] = 3
score['C'] = 3
score['M'] = 3
score['P'] = 3

score['F'] = 4
score['H'] = 4
score['V'] = 4
score['W'] = 4
score['Y'] = 4

score['K'] = 5

score['J'] = 8
score['X'] = 8

score['Q'] = 10
score['Z'] = 10

def Q(word):
    ans = 0
    for c in word:
        ans += score[c]
    return ans

word_list = input().split()
word_list.sort()
word_list = word_list[-1::-1]

for word in word_list:
    print(word , Q(word))
# 1661561, 2022-10-29 09:28:09, PPPPP (100%)

score = {}

score['A'] = 1
score['E'] = 1
score['I'] = 1
score['L'] = 1
score['N'] = 1
score['O'] = 1
score['R'] = 1
score['S'] = 1
score['T'] = 1
score['U'] = 1

score['D'] = 2
score['G'] = 2

score['B'] = 3
score['C'] = 3
score['M'] = 3
score['P'] = 3

score['F'] = 4
score['H'] = 4
score['V'] = 4
score['W'] = 4
score['Y'] = 4

score['K'] = 5

score['J'] = 8
score['X'] = 8

score['Q'] = 10
score['Z'] = 10

def Q(word):
    ans = 0
    for c in word:
        ans += score[c]
    return ans

ans = {}
word_list = input().split()

for word in word_list:
    Q_call = Q(word)
    if(Q_call not in ans.keys()):
        ans[Q_call] = []
    ans[Q_call].append(word)
    ans[Q_call].sort()

point_list = list(ans.keys())
point_list.sort()
point_list = point_list[-1::-1]

for point in point_list:
    for word in ans[point]:
        print(word , point)


6532157921
# 1661374, 2022-10-29 09:22:07, PPPxx (60%)

def poi(c):
    if c in "AEILNORSTU":
        return 1
    if c in "DG":
        return 2
    if c in "BCMP":
        return 3
    if c in "FHVWY":
        return 4
    if c in "k":
        return 5
    if c in "JX":
        return 8
    if c in "QZ":
        return 10

def sum(s):
    now = 0
    for i in s:
        now+=poi(i)
    return now

a = input().split()
ans = []
for i in a:
    ans+=[[sum(i)*-1,i]]
ans.sort()

for i in ans:
    print(i[1],i[0]*-1)


# 1661410, 2022-10-29 09:23:38, PPP-- (60%)

def poi(c):
    if c in "AEILNORSTU":
        return 1
    if c in "DG":
        return 2
    if c in "BCMP":
        return 3
    if c in "FHVWY":
        return 4
    if c in "k":
        return 5
    if c in "JX":
        return 8
    if c in "QZ":
        return 10
    return 0

def sum(s):
    now = 0
    for i in s:
        now+=poi(i)
    return now

a = input().strip().split()
ans = []
for i in a:
    ans+=[[sum(i)*-1,i]]
ans.sort()

for i in ans:
    print(i[1],i[0]*-1)


# 1661440, 2022-10-29 09:24:32, PPPPP (100%)

def poi(c):
    if c in "AEILNORSTU":
        return 1
    if c in "DG":
        return 2
    if c in "BCMP":
        return 3
    if c in "FHVWY":
        return 4
    if c in "K":
        return 5
    if c in "JX":
        return 8
    if c in "QZ":
        return 10
    return 0

def sum(s):
    now = 0
    for i in s:
        now+=poi(i)
    return now

a = input().strip().split()
ans = []
for i in a:
    ans+=[[sum(i)*-1,i]]
ans.sort()

for i in ans:
    print(i[1],i[0]*-1)

6532182521
# 1661453, 2022-10-29 09:25:01, xxxxx (0%)

from cv2 import sort


def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10


def word_point(word):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum([letter_point(w) for w in word])


words = input().split()
myDict = dict()
for word in words:
    ws = word_point(word)
    if myDict.get(ws) == None:
        myDict[ws] = []
    myDict[ws].append(word)

myScore = list(myDict.keys())
myScore.sort()

for sc in myScore[::-1]:
    curList = myDict[sc]
    curList.sort()
    for word in curList:
        print(word, sc)

# 1661553, 2022-10-29 09:27:57, xxxxx (0%)

from cv2 import sort


def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10


def word_point(word):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum([letter_point(w) for w in word])


words = input().split()
myScore = []
for word in words:
    ws = word_point(word)
    myScore.append([-ws, word])

myScore.sort()
for cur in myScore:
    print(cur[1], -cur[0])

# 1661571, 2022-10-29 09:28:23, PPPPP (100%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10


def word_point(word):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum([letter_point(w) for w in word])


words = input().split()
myScore = []
for word in words:
    ws = word_point(word)
    myScore.append([-ws, word])

myScore.sort()
for cur in myScore:
    print(cur[1], -cur[0])


6532203021
# 1661560, 2022-10-29 09:28:07, ----- (0%)

from operator import le


def letter_point(c):   
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้   
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J', 'X']:
        return 8
    elif c in ['Q', 'Z']:
        return 10
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return sum

words = input().split()
ans = {}
for i in words:
    score = word_point(i)
    if score not in ans:
        ans[score] = []
    ans[score].append(i)

b=[]
for key in ans:
    ans[key].sort()
    b.append([key])
    for i in ans[key]:
        b[len(b)-1].append(i)

b.sort(reverse=True)
# print(b)
for i in range(len(b)):
    for j in range(1, len(b[i])):
        print(b[i][0], b[i][j])
# 1661602, 2022-10-29 09:29:05, PPPPP (100%)

from operator import le


def letter_point(c):   
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้   
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J', 'X']:
        return 8
    elif c in ['Q', 'Z']:
        return 10
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return sum

words = input().split()
ans = {}
for i in words:
    score = word_point(i)
    if score not in ans:
        ans[score] = []
    ans[score].append(i)

b=[]
for key in ans:
    ans[key].sort()
    b.append([key])
    for i in ans[key]:
        b[len(b)-1].append(i)

b.sort(reverse=True)
# print(b)
for i in range(len(b)):
    for j in range(1, len(b[i])):
        print(b[i][j], b[i][0])
# 1661609, 2022-10-29 09:29:19, PPPPP (100%)

def letter_point(c):   
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้   
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J', 'X']:
        return 8
    elif c in ['Q', 'Z']:
        return 10
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return sum

words = input().split()
ans = {}
for i in words:
    score = word_point(i)
    if score not in ans:
        ans[score] = []
    ans[score].append(i)

b=[]
for key in ans:
    ans[key].sort()
    b.append([key])
    for i in ans[key]:
        b[len(b)-1].append(i)

b.sort(reverse=True)
# print(b)
for i in range(len(b)):
    for j in range(1, len(b[i])):
        print(b[i][j], b[i][0])

6531020321
# 1661289, 2022-10-29 09:18:40, P---- (20%)

s = input().upper().split()
for i in range(len(s)):
    sumn = 0
    for c in s[i]:
        if c in 'AEILNORSTU':
            sumn+=1
        elif c in 'DG':
            sumn+=2
        elif c in 'BCMP':
            sumn+=3
        elif c in 'FHVWY':
            sumn+=4
        elif c in 'K':
            sumn+=5
        elif c in 'JX':
            sumn+=8
        elif c in 'QZ':
            sumn+=10
    print(s[i],sumn)
# 1661763, 2022-10-29 09:35:47, P-P-- (40%)

s = input().upper().split()
x = []
score = []
for i in range(len(s)):
    sumn = 0
    for c in s[i]:
        if c in 'AEILNORSTU':
            sumn+=1
        elif c in 'DG':
            sumn+=2
        elif c in 'BCMP':
            sumn+=3
        elif c in 'FHVWY':
            sumn+=4
        elif c in 'K':
            sumn+=5
        elif c in 'JX':
            sumn+=8
        elif c in 'QZ':
            sumn+=10
    x.append(str(sumn)+' '+s[i])
x = sorted(x)
p = []
for e in x[::-1]:
    p += e.split()
for i in range(0,len(p)-1,2):
    print(p[i+1]+' '+p[i])
# 1662112, 2022-10-29 09:47:43, PPPPP (100%)

s = input().upper().split()
x = []
for i in range(len(s)):
    sumn = 0
    for c in s[i]:
        if c in 'AEILNORSTU':
            sumn+=1
        elif c in 'DG':
            sumn+=2
        elif c in 'BCMP':
            sumn+=3
        elif c in 'FHVWY':
            sumn+=4
        elif c in 'K':
            sumn+=5
        elif c in 'JX':
            sumn+=8
        elif c in 'QZ':
            sumn+=10
    x.append([-sumn,s[i]])
x = sorted(x)
for i in range(len(x)):
    print(x[i][1]+' '+str(abs(x[i][0])))

6531028421
# 1661421, 2022-10-29 09:23:48, P---- (20%)

def point(c):
    P = 0
    for i in c :
        if i in 'AEILNORSTU':
            P += 1
        if i in 'DG':
            P += 2
        if i in 'BCMP':
            P += 3
        if i in 'FHVWY':
            P += 4
        if i in 'K':
            P += 5
        if i in 'JX':
            P += 8
        if i in 'QZ':
            P += 10
    return P
word = input().split()
for k in range(len(word)):
    print(word[k],point(word[k]))




# 1661962, 2022-10-29 09:42:45, PPP-- (60%)

def point(c):
    P = 0
    for i in c :
        if i in 'AEILNORSTU':
            P += 1
        if i in 'DG':
            P += 2
        if i in 'BCMP':
            P += 3
        if i in 'FHVWY':
            P += 4
        if i in 'K':
            P += 5
        if i in 'JX':
            P += 8
        if i in 'QZ':
            P += 10
    return P
word = input().split()
ls = []
for k in range(len(word)):
    ls += [[point(word[k]),(word[k])]]
ls_so = sorted(ls)[::-1]
for l in range(len(ls_so)):
    ls_so[l][0],ls_so[l][1] = ls_so[l][1],ls_so[l][0]
for o in range(len(ls_so)):
    t = ''
    t = ls_so[o][0]
    b = ls_so[o][1]
    print(t,b)
    





# 1662020, 2022-10-29 09:44:48, PPPPP (100%)

def point(c):
    P = 0
    for i in c :
        if i in 'AEILNORSTU':
            P += 1
        if i in 'DG':
            P += 2
        if i in 'BCMP':
            P += 3
        if i in 'FHVWY':
            P += 4
        if i in 'K':
            P += 5
        if i in 'JX':
            P += 8
        if i in 'QZ':
            P += 10
    return P
word = input().split()
ls = []
for k in range(len(word)):
    ls += [[-point(word[k]),(word[k])]]
ls_so = sorted(ls)
for l in range(len(ls_so)):
    ls_so[l][0],ls_so[l][1] = ls_so[l][1],-ls_so[l][0]
for o in range(len(ls_so)):
    t = ''
    t = ls_so[o][0]
    b = ls_so[o][1]
    print(t,b)
    






6531806321
# 1661395, 2022-10-29 09:22:48, ----- (0%)

l1=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'
]
l2=['D','G']
l3=['B','C','M','P']
l4=['F','C','M','P']
l5=['K']
l8=['J','X']
l10=['Q','Z']
s=input().split()
l=list()
for e in s:
    pts=int()
    for a in e:
        if a in l1:
            pts+=1
        elif a in l2:
            pts+=2
        elif a in l3:
            pts+=3
        elif a in l4:
            pts+=4
        elif a in l5:
            pts+=5
        elif a in l8:
            pts+=8
        elif a in l10:
            pts+=10
    l.append([-pts,e])
l.sort()
for e in l:
    print(e[1])
# 1661433, 2022-10-29 09:24:24, PP--- (40%)

l1=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
l2=['D','G']
l3=['B','C','M','P']
l4=['F','C','M','P']
l5=['K']
l8=['J','X']
l10=['Q','Z']
s=input().split()
l=list()
for e in s:
    pts=int()
    for a in e:
        if a in l1:
            pts+=1
        elif a in l2:
            pts+=2
        elif a in l3:
            pts+=3
        elif a in l4:
            pts+=4
        elif a in l5:
            pts+=5
        elif a in l8:
            pts+=8
        elif a in l10:
            pts+=10
    l.append([-pts,e])
l.sort()
for e in l:
    print(e[1],-e[0])
# 1661519, 2022-10-29 09:26:56, PPPPP (100%)

l1=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'
]
l2=['D','G']
l3=['B','C','M','P']
l4=['F','H','V','W','Y']
l5=['K']
l8=['J','X']
l10=['Q','Z']
s=input().split()
l=list()
for e in s:
    pts=int()
    for a in e:
        if a in l1:
            pts+=1
        elif a in l2:
            pts+=2
        elif a in l3:
            pts+=3
        elif a in l4:
            pts+=4
        elif a in l5:
            pts+=5
        elif a in l8:
            pts+=8
        elif a in l10:
            pts+=10
    l.append([-pts,e])
l.sort()
for e in l:
    print(e[1],-e[0])


6230083421
# 1661286, 2022-10-29 09:18:35, P---- (20%)

di = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
      'D':2,'G':2,
      'B':3,'C':3,'M':3,'P':3,
      'F':4,'H':4,'V':4,'W':4,'Y':4,
      'K':5,
      'J':8,'X':8,
      'Q':10,'Z':10}
x = input().split()
out = []
for a in x:
    c = 0
    for b in a:
        c += di[b]
    out.append([a,str(c)])
for c in out:
    print(' '.join(c))

# 1661338, 2022-10-29 09:20:56, PPPPP (100%)

di = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
      'D':2,'G':2,
      'B':3,'C':3,'M':3,'P':3,
      'F':4,'H':4,'V':4,'W':4,'Y':4,
      'K':5,
      'J':8,'X':8,
      'Q':10,'Z':10}
x = input().split()
out = []
for a in x:
    c = 0
    for b in a:
        c += di[b]
    out.append([-c,a])
out.sort()    
for a,b in out:
    c = [b,str(-a)]
    print(' '.join(c))


6231422721
# 1661244, 2022-10-29 09:15:12, P---- (20%)

a = input().split()
total = 0
def find(a) :
    count = 0
    for i in a :
        if i.lower() in "aeilnorstu" :
            count += 1
        if i.lower() in "dg" :
            count += 2
        if i.lower() in "bcmp" :
            count += 3
        if i.lower() in "fhvwy" :
            count += 4
        if i.lower() in "k" :
            count += 5
        if i.lower() in "jx" :
            count += 8
        if i.lower() in "qz" :
            count += 10
    return count
for i in a :
    print(i,find(i))
# 1661264, 2022-10-29 09:17:28, PPPPP (100%)

a = input().split()
total = 0
def find(a) :
    count = 0
    for i in a :
        if i.lower() in "aeilnorstu" :
            count += 1
        if i.lower() in "dg" :
            count += 2
        if i.lower() in "bcmp" :
            count += 3
        if i.lower() in "fhvwy" :
            count += 4
        if i.lower() in "k" :
            count += 5
        if i.lower() in "jx" :
            count += 8
        if i.lower() in "qz" :
            count += 10
    return count
result = []
for i in a :
    result.append([-find(i),i])
result.sort()
for i in result :
    print(i[1],-i[0])

6230259621
# 1661678, 2022-10-29 09:31:38, PPPPP (100%)

def letter_point(c):
    lp=[]
    if c in 'AEILNORSTU' :
        lp+=[1]
        return lp
    if c in 'DG' :
        lp+=[2]
        return lp
    if c in 'BCMP' :
        lp+=[3]
        return lp
    if c in 'FHVWY' :
        lp+=[4]
        return lp
    if c in 'K' :
        lp+=[5]
        return lp
    if c in 'JX' :
        lp+=[8]
        return lp
    if c in 'QZ' :
        lp+=[10]
        return lp
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    s=[]
    for i in w:
        s+=letter_point(i)
    return sum(s)
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
#words = input().split()
 
words = input().split()
s=[]
for i in words:
    m=word_point(i)
    s+=[[-m,i]]
s.sort()
for j in s:
    print(j[1],-j[0])
# 1661682, 2022-10-29 09:31:45, PPPPP (100%)

def letter_point(c):
    lp=[]
    if c in 'AEILNORSTU' :
        lp+=[1]
        return lp
    if c in 'DG' :
        lp+=[2]
        return lp
    if c in 'BCMP' :
        lp+=[3]
        return lp
    if c in 'FHVWY' :
        lp+=[4]
        return lp
    if c in 'K' :
        lp+=[5]
        return lp
    if c in 'JX' :
        lp+=[8]
        return lp
    if c in 'QZ' :
        lp+=[10]
        return lp
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    s=[]
    for i in w:
        s+=letter_point(i)
    return sum(s)
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
#words = input().split()
 
words = input().split()
s=[]
for i in words:
    m=word_point(i)
    s+=[[-m,i]]
s.sort()
for j in s:
    print(j[1],-j[0])

6230322421
# 1661565, 2022-10-29 09:28:13, PPP-- (60%)

a = input().strip().split(' ')
score = [0]*len(a)
for i in range(0,len(a)):
    for e in a[i]:
        if e in 'AEILNORSTU':
            score[i] += 1
        elif e in 'DG':
            score[i] += 2
        elif e in 'BCMP':
            score[i] += 3
        elif e in 'FHVWY':
            score[i] += 4
        elif e in 'K':
            score[i] += 5
        elif e in 'JX':
            score[i] += 8
        elif e in 'QZ':
            score[i] += 10
        else:
            pass
    c = 0
combine = []    
for i in range(0,len(a)):
    combine += [[score[i],a[i]]]
    
combine.sort(reverse = True)

for a,b in combine :
    print(b,a)
# 1662379, 2022-10-29 09:56:30, PPPPP (100%)

al = 'zyxwvutsr'
a = input().strip().split(' ')
score = [0]*len(a)
for i in range(0,len(a)):
    for e in a[i]:
        if e in 'AEILNORSTU':
            score[i] += 1
        elif e in 'DG':
            score[i] += 2
        elif e in 'BCMP':
            score[i] += 3
        elif e in 'FHVWY':
            score[i] += 4
        elif e in 'K':
            score[i] += 5
        elif e in 'JX':
            score[i] += 8
        elif e in 'QZ':
            score[i] += 10
        else:
            pass
count = 0
combine = []    
for i in range(0,len(a)):
    combine += [[score[i],a[i]]]
    
combine.sort()
combine +=[[100,'ZZ']]
combine_1 = []
num = []
for i in range(0,len(combine)-1):
    c,d = combine[i]
    e,f = combine[i+1]
    if c in num :
        combine_1 += [[c,al[count]+d]]
        count += 1
    elif e == c :
        combine_1 += [[c,al[count]+d]]
        count += 1
    
    
    else:
        num += [c]
        combine_1 += [combine[i]]
combine_1.sort(reverse=True)

for i in range(0,len(combine_1)) :
    a,b = combine_1[i]
    if b[0] in al:
        g = b[1:]
    else:
        g = b
    print(g,a)

6431523621
# 1661416, 2022-10-29 09:23:45, PPP-- (60%)

def point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    point = {'A':1,'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1 \
             ,'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3 \
             ,'F':4, 'H':4, 'V':4, 'W':4, 'Y':4\
             , 'K':5,'J':8, 'X':8,'Q':10,'Z':10}
    num = 0
    for i in c:
        num+=point[i]
    return num
def word(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    show = []
    for i in w :
        show.append([point(i),i])
    show.sort()
    return show[::-1]
words = input().split()
for c,w in word(words) :
    print(w, c)

# 1661482, 2022-10-29 09:25:47, PPPPP (100%)

def point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    point = {'A':1,'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1 \
             ,'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3 \
             ,'F':4, 'H':4, 'V':4, 'W':4, 'Y':4\
             , 'K':5,'J':8, 'X':8,'Q':10,'Z':10}
    num = 0
    for i in c:
        num+=point[i]
    return num
def word(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    show = []
    for i in w :
        show.append([-point(i),i])
    show.sort()
    return show
words = input().split()
for c,w in word(words) :
    print(w, -c)


6430206521
# 1661578, 2022-10-29 09:28:28, P---- (20%)

x=input().split()
sum_ch = 0
for e in x:
    for i in range(len(e)):
        if e[i] in'AEILNORSTU':
            sum_ch +=1
        elif e[i] in'DG':
            sum_ch += 2
        elif e[i] in 'BCMP':
            sum_ch +=3
        elif e[i] in 'FHVWY':
            sum_ch += 4
        elif e[i] in 'K':
            sum_ch += 5
        elif e[i] in 'JX':
            sum_ch += 8
        elif e[i] in 'QZ':
            sum_ch += 10
    print(e,sum_ch)
    sum_ch = 0
# 1661705, 2022-10-29 09:32:54, PPPPP (100%)

x=input().split()
sum_ch = 0
out=[]
for e in x:
    for i in range(len(e)):
        if e[i] in'AEILNORSTU':
            sum_ch +=1
        elif e[i] in'DG':
            sum_ch += 2
        elif e[i] in 'BCMP':
            sum_ch +=3
        elif e[i] in 'FHVWY':
            sum_ch += 4
        elif e[i] in 'K':
            sum_ch += 5
        elif e[i] in 'JX':
            sum_ch += 8
        elif e[i] in 'QZ':
            sum_ch += 10
    out.append([-sum_ch,e])
    sum_ch = 0
out.sort()
for i in range(len(out)):
    print(out[i][1],-out[i][0])

6530003521
# 1661529, 2022-10-29 09:27:19, PPPxx (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU' :
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c in 'JX' :
        return 8
    elif c in 'QZ' :
        return 10
    
def word_point(w):
    point = 0
    for e in w :
        point += letter_point(e)
    return point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split()
a = [[-word_point(e),e ]for e in words]
a.sort()
ans = [[a[i][1],-a[i][0]] for i in range(len(a))]
for e in ans :
    print(*e)
# 1661604, 2022-10-29 09:29:12, PPPPP (100%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU' :
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c == 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ' :
        return 10
    
def word_point(w):
    point = 0
    for e in w :
        point += letter_point(e)
    return point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split()
a = [[-word_point(e),e ]for e in words]
a.sort()
ans = [[a[i][1],-a[i][0]] for i in range(len(a))]
for e in ans :
    print(*e)

6531202221
# 1661248, 2022-10-29 09:16:03, P---- (20%)

a = input().upper()
so = 0
for c in a:
    if c in 'AEILNORSTU':
        so += 1
    elif c in 'DG':
        so += 2
    elif c in 'BCMP':
        so += 3
    elif c in 'FHVWY':
        so += 4
    elif c in 'K':
        so += 5
    elif c in 'JX':
        so += 8
    elif c in 'QZ':
        so += 10
print(a,so)
# 1661932, 2022-10-29 09:41:37, PPPPP (100%)

a = input().upper().split()
ans = []
for x in a:
    so = 0
    for c in x:
        if c in 'AEILNORSTU':
            so += 1
        elif c in 'DG':
            so += 2
        elif c in 'BCMP':
            so += 3
        elif c in 'FHVWY':
            so += 4
        elif c in 'K':
            so += 5
        elif c in 'JX':
            so += 8
        elif c in 'QZ':
            so += 10
    ans += [[so*-1,' '+x]]
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i][-1],-1*ans[i][0])

6531403021
# 1661912, 2022-10-29 09:40:51, PPPP- (80%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = {'A':1 ,'E':1,'I':1,'L':1,'N':1
         ,'O':1,'R':1,'S':1,'T':1,'U' :1
         ,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3
         ,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5
         ,'J':8,'X':8,'Q':10,'Z':10}
    return s[c]
    
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum1 = 0
    for i in w :
        sum1+=letter_point(i)
    return sum1

words = input().split()
r = list()
for i in words :
    r.append([word_point(i),i])
r.sort(reverse = True)
for i in range (len(r)) :
    for j in range (i,len(r)-i,1) :
        if r[i][0] == r[j][0] :
            if r[i][1] > r[j][1] :
                x = r[j][1]
                r[j][1] = r[i][1]
                r[i][1] = x
            
for i in r :
    print(i[1],i[0])

# 1661961, 2022-10-29 09:42:43, PPPPP (100%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = {'A':1 ,'E':1,'I':1,'L':1,'N':1
         ,'O':1,'R':1,'S':1,'T':1,'U' :1
         ,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3
         ,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5
         ,'J':8,'X':8,'Q':10,'Z':10}
    return s[c]
    
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum1 = 0
    for i in w :
        sum1+=letter_point(i)
    return sum1

words = input().split()
r = list()
for i in words :
    r.append([word_point(i),i])
r.sort(reverse = True)
for i in range (len(r)) :
    for j in range (0,len(r),1) :
        if r[i][0] == r[j][0] :
            if r[i][1] < r[j][1] :
                x = r[j][1]
                r[j][1] = r[i][1]
                r[i][1] = x
            
for i in r :
    print(i[1],i[0])


6531514021
# 1661641, 2022-10-29 09:30:28, PPPxx (60%)

point = dict()
p1 = 'AEILNORSTU'
for e in p1 : point[e] = 1
p2 = 'DG'
for e in p2 : point[e] = 2
p3 = 'BCMP'
for e in p3 : point[e] = 3
p4 = 'FHVWY'
for e in p4 : point[e] = 4
p5 = 'k'
for e in p5 : point[e] = 5
p8 = 'JX'
for e in p8 : point[e] = 8
p10 = 'QZ'
for e in p10 : point[e] = 10
w = input().split()
c = 0 
for i in range(len(w)) :
    for n in w[i] :
        c += point[n]
    w[i] = [-c, w[i]]
    c = 0
w.sort()
for i in range(len(w)) :
    print(w[i][1], -w[i][0])
# 1661680, 2022-10-29 09:31:42, PPPPP (100%)

point = dict()
p1 = 'AEILNORSTU'
for e in p1 : point[e] = 1
p2 = 'DG'
for e in p2 : point[e] = 2
p3 = 'BCMP'
for e in p3 : point[e] = 3
p4 = 'FHVWY'
for e in p4 : point[e] = 4
p5 = 'K'
for e in p5 : point[e] = 5
p8 = 'JX'
for e in p8 : point[e] = 8
p10 = 'QZ'
for e in p10 : point[e] = 10
w = input().split()
c = 0 
for i in range(len(w)) :
    for n in w[i] :
        c += point[n]
    w[i] = [-c, w[i]]
    c = 0
w.sort()
for i in range(len(w)) :
    print(w[i][1], -w[i][0])

6530037921
# 1661907, 2022-10-29 09:40:42, PPP-- (60%)

words = input().split()
all_score = []
word_score=[]
P1=['A','E','I','L','N','O','R','S','T','U']
P2=['D','G']
P3=['B','C','M','P']
P4=['F','H','V','W','Y']
P5=['K']
P8=['J','X']
P10=['Q','Z']
def sum_score(i,sm):
    for w in words[i]:
        if w in P1:
            sm += 1
        elif w in P2:
            sm += 2
        elif w in P3:
            sm += 3
        elif w in P4:
            sm += 4
        elif w in P5:
            sm += 5
        elif w in P8:
            sm += 8
        elif w in P10:
            sm += 10
    score = sm
    return score

for i in range(len(words)):
    sm = 0
    sm = sum_score(i,sm)
    #print(words[i],sm)
    word_score.append([sm,words[i]])
word_score.sort()
word_score = word_score[::-1]
for k in range(len(word_score)):
    print(word_score[k][1],word_score[k][0])
# 1662603, 2022-10-29 10:03:05, PPPPP (100%)

words = input().split()
all_score = []
word_score=[]
P1=['A','E','I','L','N','O','R','S','T','U']
P2=['D','G']
P3=['B','C','M','P']
P4=['F','H','V','W','Y']
P5=['K']
P8=['J','X']
P10=['Q','Z']
def sum_score(i,sm):
    for w in words[i]:
        if w in P1:
            sm -= 1
        elif w in P2:
            sm -= 2
        elif w in P3:
            sm -= 3
        elif w in P4:
            sm -= 4
        elif w in P5:
            sm -= 5
        elif w in P8:
            sm -= 8
        elif w in P10:
            sm -= 10
    score = sm
    return score

for i in range(len(words)):
    sm = 0
    sm = sum_score(i,sm)
    #print(words[i],sm)
    word_score.append([sm,words[i]])
word_score.sort()
for k in range(len(word_score)):
    print(word_score[k][1],-(word_score[k][0]))

6530045921
# 1662545, 2022-10-29 10:01:15, PP--- (40%)

n = input().upper().split()
def letter_point(c) :
    return c

def word_point(w) :
    t = 0
    if w in "AEILNORSTU" :
        t += 1
    elif w in "DG" :
        t += 2
    elif w in "BCMP" :
        t += 3
    elif w in "FHVWY" :
        t += 4
    elif w in "K" :
        t += 5
    elif w in "JK" :
        t += 8
    elif w in "QZ" :
        t += 10
    return t

word = []
for i in range (len(n)) :
    total = 0
    for j in range (len(n[i])) :
        total += word_point(n[i][j])
    word.append([-total,n[i]])
word.sort()
for i in range (len(word)) :
    print(word[i][1],-word[i][0])
# 1662634, 2022-10-29 10:04:14, PPPPP (100%)

n = input().upper().split()
def letter_point(c) :
    return c

def word_point(w) :
    t = 0
    if w in "AEILNORSTU" :
        t += 1
    elif w in "DG" :
        t += 2
    elif w in "BCMP" :
        t += 3
    elif w in "FHVWY" :
        t += 4
    elif w in "K" :
        t += 5
    elif w in "JX" :
        t += 8
    elif w in "QZ" :
        t += 10
    return t

word = []
for i in range (len(n)) :
    total = 0
    for j in range (len(n[i])) :
        total += word_point(n[i][j])
    word.append([-total,n[i]])
word.sort()
for i in range (len(word)) :
    print(word[i][1],-word[i][0])

6530049421
# 1661267, 2022-10-29 09:17:39, PPPPP (100%)

#QUIZ 2 p1
def value(a):
    if a in 'AEILNORSTU':
        return 1
    if a in "DG":
        return 2
    if a in 'BCMP':
        return 3
    if a in "FHVWY":
        return 4
    if a == "K":
        return 5
    if a in "JX":
        return 8
    if a in 'QZ':
        return 10
    return 0

words = input().split()
output = []
for w in words:
    score = 0
    for e in w:
        score += value(e)
    output.append([-score,w])
    
output.sort()

for score,word in output:
    print(word, -score)

# 1663644, 2022-10-29 10:28:41, PPPPP (100%)

#QUIZ 2 p1
def value(a):
    if a in 'AEILNORSTU':
        return 1
    if a in "DG":
        return 2
    if a in 'BCMP':
        return 3
    if a in "FHVWY":
        return 4
    if a == "K":
        return 5
    if a in "JX":
        return 8
    if a in 'QZ':
        return 10
    return 0

words = input().split()
output = []
for w in words:
    score = 0
    for e in w:
        score += value(e)
    output.append([-score,w])
    
output.sort()

for score,word in output:
    print(word, -score)
    
# Code by Kanisorn P.

6530104221
# 1661231, 2022-10-29 08:59:29, ----- (0%)

x=input()
print(x)
# 1661290, 2022-10-29 09:18:40, PPPPP (100%)

def letter_point(c):
    x1 = ['A','E','I','L','N','O','R','S','T','U']
    x2 = ['D','G']
    x3 = ['B','C','M','P']
    x4 = ['F','H','V','W','Y']
    x5 = ['K']
    x6 = ['J','X']
    x7 = ['Q','Z']
    if c in x1:
        return 1
    elif c in x2:
        return 2
    elif c in x3:
        return 3
    elif c in x4:
        return 4
    elif c in x5:
        return 5
    elif c in x6:
        return 8
    elif c in x7:
        return 10
    
def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score
# คืนคะแนนของคําที่เก็บในตัวแปรwที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรในw ???
words = input().split()
ans =[]
for f in words:
    ans.append([(-1)*word_point(f),f])
    ans.sort()

for j in ans:
    print(j[1]+' '+str(j[0]*-1))


6530113921
# 1661373, 2022-10-29 09:22:05, PPP-- (60%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        p = 1
    elif c in ['D','G']:
        p = 2
    elif c in ['B','C','M','P']:
        p = 3
    elif c in ['F','H','V','W','Y']:
        p = 4
    elif c in 'K':
        p = 5
    elif c in 'JX':
        p = 8
    else:
        p = 10
    return p

def word_point(w):
    a = 0
    for i in w:
        a += letter_point(i)
    return a

words = input().split()
l = []
for i in words:
    l.append([word_point(i),i])
l.sort(reverse=True)
for i in range(len(l)):
    print(l[i][1], l[i][0])

# 1661621, 2022-10-29 09:29:44, PPPPP (100%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        p = 1
    elif c in ['D','G']:
        p = 2
    elif c in ['B','C','M','P']:
        p = 3
    elif c in ['F','H','V','W','Y']:
        p = 4
    elif c in 'K':
        p = 5
    elif c in 'JX':
        p = 8
    else:
        p = 10
    return p

def word_point(w):
    a = 0
    for i in w:
        a += letter_point(i)
    return a

words = input().split()
l = []
for i in words:
    l.append([word_point(i),i])
l.sort(reverse=True)
while True:
    count = 0
    for i in range(1,len(l)):
        if l[i][0] == l[i-1][0]:
            if l[i][1] < l[i-1][1]:
                l[i],l[i-1] = l[i-1],l[i]
                count += 1
    if count == 0:
        break
        
for i in range(len(l)):
    print(l[i][1], l[i][0])


6530118021
# 1662069, 2022-10-29 09:46:13, PP--- (40%)

n = input().strip().split()
l = []
for e in n:
  sc = 0
  for a in e:
    if a in 'AEILNORSTU':
      sc += 1
    elif a in 'DG':
      sc += 2
    elif a in 'BCMP':
      sc += 3
    elif a in 'FHVWY':
      sc += 4
    elif a == 'K':
      sc += 5
    elif a in 'JK':
      sc += 8
    elif a in 'QZ':
      sc += 10
  l.append([sc,e])
l.sort()
l = l[::-1]
lnew = [[l[0]]]
for i in range(1,len(l)):
  if l[i][0] == l[i-1][0]:
    lnew[len(lnew)-1] += [l[i]]
  else:
    lnew.append([l[i]])
lnew = [e[::-1] for e in lnew]
b = []
for e in lnew:
  for a in e:
    b.append(a)
b = [e[::-1] for e in b]
for i in range(len(b)):
  b[i][1] = str(b[i][1])
for e in b:
  print(' '.join(e))
# 1662105, 2022-10-29 09:47:31, PPPPP (100%)

n = input().strip().split()
l = []
for e in n:
  sc = 0
  for a in e:
    if a in 'AEILNORSTU':
      sc += 1
    elif a in 'DG':
      sc += 2
    elif a in 'BCMP':
      sc += 3
    elif a in 'FHVWY':
      sc += 4
    elif a == 'K':
      sc += 5
    elif a in 'JX':
      sc += 8
    elif a in 'QZ':
      sc += 10
  l.append([sc,e])
l.sort()
l = l[::-1]
lnew = [[l[0]]]
for i in range(1,len(l)):
  if l[i][0] == l[i-1][0]:
    lnew[len(lnew)-1] += [l[i]]
  else:
    lnew.append([l[i]])
lnew = [e[::-1] for e in lnew]
b = []
for e in lnew:
  for a in e:
    b.append(a)
b = [e[::-1] for e in b]
for i in range(len(b)):
  b[i][1] = str(b[i][1])
for e in b:
  print(' '.join(e))

6530152321
# 1661436, 2022-10-29 09:24:29, P---- (20%)

p = {'A':1,'B':3,'C':3,'D':2,'E':1,'F':4,'G':2,'H':4,'I':1,'J':8,'K':5,'L':1,'M':3,'N':1,'O':1,'P':3,'Q':10,'R':1,'S':1,'T':1,'U':1,'V':4,'W':4,'X':8,'Y':4,'Z':10}
def letter_point(c):
    out = 0
    for k in c:
        out += int(p[k])
    return out

words = input().split()
for e in words:
    print(e,letter_point(e))

# 1661568, 2022-10-29 09:28:20, PPPPP (100%)

p = {'A':1,'B':3,'C':3,'D':2,'E':1,'F':4,'G':2,'H':4,'I':1,'J':8,'K':5,'L':1,'M':3,'N':1,'O':1,'P':3,'Q':10,'R':1,'S':1,'T':1,'U':1,'V':4,'W':4,'X':8,'Y':4,'Z':10}
def letter_point(c):
    out = 0
    for k in c:
        out += int(p[k])
    return out

words = input().split()
x = []
for e in words:
    x.append([-letter_point(e),e])
x.sort()
for e in x:
    print(e[1],-e[0])

6530163221
# 1661502, 2022-10-29 09:26:13, PPP-- (60%)

Sca = [str(e) for e in input().split() ]
value = 0
ans = []
W = ['A','E','I','L','N','O','R','S','T','U','D','G','B','C','M','P','F','H','V','W','Y','K','J','X','Q','Z']
V = [ 1 , 1 ,1 ,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10]

for i in Sca:
    for k in i:
        value += V[W.index(k)]
    ans = ans + [[value,i]]
    value = 0

ans.sort(reverse=True)

for z in ans:
    print(z[1] + " " + str(z[0]))

# 1661630, 2022-10-29 09:30:05, PPPPP (100%)

Sca = [str(e) for e in input().split() ]
value = 0
ans = []
W = ['A','E','I','L','N','O','R','S','T','U','D','G','B','C','M','P','F','H','V','W','Y','K','J','X','Q','Z']
V = [ 1 , 1 ,1 ,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10]

for i in Sca:
    for k in i:
        value += V[W.index(k)]
    ans = ans + [[-value,i]]
    value = 0

ans.sort()

for z in ans:
    print(z[1] + " " + str(-(z[0])))


6530165521
# 1661262, 2022-10-29 09:17:20, P---- (20%)

data = input().split()
score = {'A':1, 'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
ans = []
for e in data:
    p = 0
    for i in range(len(e)):
        p += score[e[i]]
    ans.append([e,p])
for e in ans:
    print(*e)
# 1661332, 2022-10-29 09:20:46, PPPPP (100%)

data = input().split()
score = {'A':1, 'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
ans = []
for e in data:
    p = 0
    for i in range(len(e)):
        p += score[e[i]]
    ans.append([e,p])
ans = [[-v,k] for k,v in ans]
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i][1],abs(ans[i][0]))

6530177021
# 1661673, 2022-10-29 09:31:22, ----- (0%)

alp = list('AEILNORSTUDGBCMPFHVWYKJXQZ')
#alp 1คะแนน=10ตัว   2=2 3=4 4=5 5=1 8=2 10=2
score = [1]*10 +[2]*2 + [3]*4 + [4]*5 + [5]*1+ [8]*2 + [10]*2


w = input().split()
result = [0]*len(w)
for e in w:
    for i in e:
        if i in alp:
            k = alp.index(i)
            result[w.index(e)]+=score[k]
final = []

for j in range(len(w)):
    final.append([-1*result[j],w[j]])
final.sort()
print(final)
for l in range(len(final)) :
    print(final[l][1],-1*final[l][0])


# 1661676, 2022-10-29 09:31:34, PPPPP (100%)

alp = list('AEILNORSTUDGBCMPFHVWYKJXQZ')
#alp 1คะแนน=10ตัว   2=2 3=4 4=5 5=1 8=2 10=2
score = [1]*10 +[2]*2 + [3]*4 + [4]*5 + [5]*1+ [8]*2 + [10]*2


w = input().split()
result = [0]*len(w)
for e in w:
    for i in e:
        if i in alp:
            k = alp.index(i)
            result[w.index(e)]+=score[k]
final = []

for j in range(len(w)):
    final.append([-1*result[j],w[j]])
final.sort()
for l in range(len(final)) :
    print(final[l][1],-1*final[l][0])

6530182121
# 1661377, 2022-10-29 09:22:13, PPP-- (60%)

#password = SECOND_quiz
point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2 , "G":2 ,
         "B":3,"C":3,"M":3,"P":3,
         "F":4,"H":4,"V":4,"W":4,"Y":4,
         "K":5,
         "J":8,"X":8,
         "Q":10,"Z":10}

word = input().split() #ลิสต์ตำ
d = []
for i in range (len(word)) :
    c = []
    for k in range (len(word[i])):
        c.append(word[i][k])
    d.append(c)
#หาคะแนน
for i in range (len(d)) :
    sum_ = 0
    for k in range (len(d[i])) :
        sum_ += point[d[i][k]]
    d[i].insert(0,sum_)
d = sorted(d)[::-1]
#ประกาศ
for i in range (len(d)) :
    print("".join(d[i][1:]), str(d[i][0]))
        


# 1663733, 2022-10-29 10:30:32, PPPPP (100%)

#password = SECOND_quiz
point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2 , "G":2 ,
         "B":3,"C":3,"M":3,"P":3,
         "F":4,"H":4,"V":4,"W":4,"Y":4,
         "K":5,
         "J":8,"X":8,
         "Q":10,"Z":10}

word = input().split() #ลิสต์ตำ
d = []
for i in range (len(word)) :
    c = []
    for k in range (len(word[i])):
        c.append(word[i][k])
    d.append(c)
#หาคะแนน
for i in range (len(d)) :
    sum_ = 0
    for k in range (len(d[i])) :
        sum_ += point[d[i][k]]
    d[i].insert(0,-1*sum_)
d = sorted(d) ; out = []
    
#ประกาศ
for i in range (len(d)) :
    print("".join(d[i][1:]), str(-1*d[i][0]))


6530197621
# 1661250, 2022-10-29 09:16:15, P---- (20%)

def letter_point(c):
    ans = 0
    if c in ['A','E','I','L','N',
             'O','R','S','T','U']:
        ans = 1
    elif c in ['D','G']:
        ans = 2
    elif c in ['B','C','M','P']:
        ans = 3
    elif c in ['F','H','V','W','Y']:
        ans = 4
    elif c in ['K']:
        ans = 5
    elif c in ['J','X']:
        ans = 8
    elif c in ['Q','Z']:
        ans = 10
    return ans

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score
  
words = input().split()
for e in words:
    print(e,word_point(e))
# 1663415, 2022-10-29 10:24:15, PPPPP (100%)

def letter_point(c):
    ans = 0
    if c in ['A','E','I','L','N',
             'O','R','S','T','U']:
        ans = 1
    elif c in ['D','G']:
        ans = 2
    elif c in ['B','C','M','P']:
        ans = 3
    elif c in ['F','H','V','W','Y']:
        ans = 4
    elif c in ['K']:
        ans = 5
    elif c in ['J','X']:
        ans = 8
    elif c in ['Q','Z']:
        ans = 10
    return ans

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score
  
words = input().split()
d = {}
scoreans = []
for e in words:
    sc = word_point(e)
    if sc not in d:
        d[sc] = [e]
    else:
        d[sc] += [e]
    if sc not in scoreans:
        scoreans.append(sc)
scoreans.sort(reverse=True)
for e in scoreans:
    name = d[e]
    name.sort()
    for n in name:
        print(n,e)
    

6530201421
# 1661444, 2022-10-29 09:24:42, P---- (20%)

def letter_point(c):
    score=[["A","E","I","L","N","O","R","S","T","U"],["D","G"],["B","C","M","P"],["F","H","V","W","Y"],["K"],["J","X"],["Q","Z"]]
    count_s=[1,2,3,4,5,8,10]
    for j in range(len(score)):
        if c in score[j]:
            return count_s[j]
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    score=0
    for i in w:
        score+=letter_point(i)
    return score
        
words = input().split()
results=[]
for i in range(len(words)):
    results.append([words[i],word_point(words[i])])

#แสดงผล
for i in range(len(results)):
    print(results[i][0],results[i][1])
# 1661514, 2022-10-29 09:26:37, PPPPP (100%)

def letter_point(c):
    score=[["A","E","I","L","N","O","R","S","T","U"],["D","G"],["B","C","M","P"],["F","H","V","W","Y"],["K"],["J","X"],["Q","Z"]]
    count_s=[1,2,3,4,5,8,10]
    for j in range(len(score)):
        if c in score[j]:
            return count_s[j]
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    score=0
    for i in w:
        score+=letter_point(i)
    return score
        
words = input().split()
results=[]
for i in range(len(words)):
    results.append([-word_point(words[i]),words[i]])
results.sort()
#แสดงผล
for i in range(len(results)):
    print(results[i][1],-1*results[i][0])




6530210021
# 1661544, 2022-10-29 09:27:41, PPP-- (60%)

word = input().upper().split()
point = {'A':1, 'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1,
         'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3,
         'M':3, 'P':3,'F':4, 'H':4, 'V':4, 'W':4, 'Y':4,
         'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
add_point = []
score = 0
for c in word:
    for e in c:
        score += point[e]
    add_point.append([score,c])
    score = 0
x = sorted(add_point,reverse=True)
for i in range(len(x)):
    print(x[i][1],x[i][0])
# 1663519, 2022-10-29 10:26:21, PPPPP (100%)

word = input().upper().split()
point = {'A':1, 'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1,
         'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3,
         'M':3, 'P':3,'F':4, 'H':4, 'V':4, 'W':4, 'Y':4,
         'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}

x = []
ls = []
score = 0
for e in word:
    for char in e:
        score += point[char]
    x.append([-score,e])
    score = 0
x = sorted(x)
for i in range(len(x)):
    print(x[i][1],-x[i][0])

6531306921
# 1661422, 2022-10-29 09:23:55, PPP-- (60%)

pointlist=['0','AEILNORSTU','DG','BCMP','FHVWY','K','0','0','JX','0','QZ']


def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 for i in range(11):
  if c in pointlist[i]:
    return i
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
  point=0
  for i in w:
    point+=letter_point(i)
  return [point,w]
words = input().split()
wordlist=[]
for i in words:
  wordlist.append(word_point(i))
wordlist.sort(reverse=True)
for i in wordlist:
  print(i[1],i[0])
# 1661739, 2022-10-29 09:34:37, PPPPP (100%)

pointlist=['0','AEILNORSTU','DG','BCMP','FHVWY','K','0','0','JX','0','QZ']
wordlist=[]
worddic={}
plist=[]
def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 for i in range(11):
  if c in pointlist[i]:
    return i
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
  point=0
  for i in w:
    point+=letter_point(i)
  if point not in plist:
    plist.append(point)
    plist.sort(reverse=True)
  return [point,w]
words = input().split()

for i in words:
  wordlist.append(word_point(i))
wordlist.sort()
worddic={}
for i in wordlist:
  if i[0] in worddic:
    worddic[i[0]].append(i[1])
    worddic[i[0]].sort()
  else:
    worddic[i[0]]=[i[1]]

for i in plist:
  for j in worddic[i]:
    print(j,i)


6531317821
# 1661509, 2022-10-29 09:26:30, P---- (20%)

def letter_point(c):
    s = 0
    d = [[["A","E","I","L","N","O","R","S","T","U"],1],[["D","G"],2],[["B","C","M","P"],3],[["F","H","V","W","Y"],4],[["K"],5],[["J","X"],8],[["Q","Z"],10]]
    for letter in c:
        for alpha,score in d:
            for i in alpha:
                if letter == i:
                    s += score
    return s
words = input().split()
total = []
for e in words:
    total.append([-letter_point(e),e])
for e in total:
    print(e[1],abs(e[0]))
# 1661563, 2022-10-29 09:28:10, PPPPP (100%)

def letter_point(c):
    s = 0
    d = [[["A","E","I","L","N","O","R","S","T","U"],1],[["D","G"],2],[["B","C","M","P"],3],[["F","H","V","W","Y"],4],[["K"],5],[["J","X"],8],[["Q","Z"],10]]
    for letter in c:
        for alpha,score in d:
            for i in alpha:
                if letter == i:
                    s += score
    return s
words = input().split()
total = []
for e in words:
    total.append([-letter_point(e),e])
total.sort()
for e in total:
    print(e[1],abs(e[0]))

6531320621
# 1661446, 2022-10-29 09:24:45, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c == 'K':
        return 5
    elif c in ['J','X']:
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    point_return = []
    for i in range(len(w)):
        point = 0
        for j in range(len(w[i])):
            point += letter_point(w[i][j])
        point_return.append(point)
    return point_return
words = input().split()

for i in range(len(words)):
    print(words[i],word_point(words)[i])
# 1663374, 2022-10-29 10:23:31, PPPPP (100%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c == 'K':
        return 5
    elif c in ['J','X']:
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    point_return = []
    for i in range(len(w)):
        point = 0
        for j in range(len(w[i])):
            point += letter_point(w[i][j])
        point_return.append(point)
    return point_return
words = input().split()
max_point = max(word_point(words))
result = list(zip(word_point(words),words))
result.sort(reverse=True)
start = str(max_point)
word_sort = []
for point,word in result:
    if point == start:
        word_sort.append(word)
        word_sort.sort()
    else:
        for i in word_sort:
            print(i,start)
        word_sort = [word]
        start = point
for i in word_sort:
    print(i,start)


# for i in range(len(words)):
#     print(words[i],word_point(words)[i])

6531324121
# 1661343, 2022-10-29 09:21:08, PPP-- (60%)

scores = {
1: ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"],
2: ["D", "G"],
3: ["B", "C", "M", "P"],
4: ["F", "H", "V", "W", "Y"],
5: ["K"],
8: ["J", "X"],
10:[ "Q", "Z"]
}

def letter_point(c):
    for score in scores.keys():
        if c in scores[score]:
            return score

def word_point(w):
    total = 0

    for char in w:
        total += letter_point(char)

    return total

words = input().split()
res = []

for word in words:
    x = [word, word_point(word)]
    res.append(x)

res.sort(key = lambda x:x[1], reverse = True)

for word,score in res:
    print(word,score)
# 1661400, 2022-10-29 09:23:03, PPPPP (100%)

scores = {
1: ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"],
2: ["D", "G"],
3: ["B", "C", "M", "P"],
4: ["F", "H", "V", "W", "Y"],
5: ["K"],
8: ["J", "X"],
10:[ "Q", "Z"]
}

def letter_point(c):
    for score in scores.keys():
        if c in scores[score]:
            return score

def word_point(w):
    total = 0

    for char in w:
        total += letter_point(char)

    return total

words = input().split()
res = []

for word in words:
    x = [word, word_point(word)]
    res.append(x)

res.sort(key = lambda x:x[0])
res.sort(key = lambda x:x[1], reverse = True)

for word,score in res:
    print(word,score)

6531329321
# 1661381, 2022-10-29 09:22:32, PPP-- (60%)

def point(t):
  bozo = []
  a = 'AEILNORSTU'
  b = 'DG'
  c = 'BCMP'
  d = 'FHVWY'
  e = 'k'
  f = 'JX'
  g = 'QZ'
  for i in t:
    s = 0
    for ee in i:
      if ee in a:
        s += 1
      elif ee in b:
        s += 2
      elif ee in c:
        s += 3
      elif ee in d:
        s += 4
      elif ee in e:
        s += 5
      elif ee in f:
        s += 8
      elif ee in g:
        s += 10
    bozo.append([-s,i])
  return [[n,-p] for p,n in sorted(bozo)] 
t = input().split()
[print(n,p) for n,p in point(t)]
# 1661443, 2022-10-29 09:24:39, PPPPP (100%)

def point(t):
  bozo = []
  a = 'AEILNORSTU'
  b = 'DG'
  c = 'BCMP'
  d = 'FHVWY'
  e = 'K'
  f = 'JX'
  g = 'QZ'
  for i in t:
    s = 0
    for ee in i:
      if ee in a:
        s += 1
      elif ee in b:
        s += 2
      elif ee in c:
        s += 3
      elif ee in d:
        s += 4
      elif ee in e:
        s += 5
      elif ee in f:
        s += 8
      elif ee in g:
        s += 10
    bozo.append([-s,i])
  return [[n,-p] for p,n in sorted(bozo)] 
t = input().split()
[print(n,p) for n,p in point(t)]

6531332121
# 1661779, 2022-10-29 09:36:11, xxxxx (0%)

# 855060
from matplotlib import rc_params_from_file


points = {'A': 1, 'E': 1, 'I': 1, 'L': 1, 'N': 1, 'O': 1, 'R': 1, 'S': 1, 'T': 1, 'U': 1,
          'D': 2, 'G': 2,
          'B': 3, 'C': 3, 'M': 3, 'P': 3,
          'F': 4, 'H': 4, 'V': 4, 'W': 4, 'Y': 4,
          'K': 5,
          'J': 8, 'X': 8,
          'Q': 10, 'Z': 10, }


def letter_point(c):
    return points[c]


def word_point(w):
    sum = 0
    for c in w:
        sum += letter_point(c)
    return sum


words = input().split()
scores = dict()
for word in words:
    scores[word] = word_point(word)
    # print(word, scores[word])
sorted_score = sorted(list(set(sorted(scores.values(), reverse=True))), reverse=True)
# print(sorted_score)
sorted_dict = sorted(scores)
# print(sorted_dict)

for score in sorted_score:
    for word in sorted_dict:
        if score == scores[word]:
            print(word, score)

# 1661784, 2022-10-29 09:36:32, PPPPP (100%)

points = {'A': 1, 'E': 1, 'I': 1, 'L': 1, 'N': 1, 'O': 1, 'R': 1, 'S': 1, 'T': 1, 'U': 1,
          'D': 2, 'G': 2,
          'B': 3, 'C': 3, 'M': 3, 'P': 3,
          'F': 4, 'H': 4, 'V': 4, 'W': 4, 'Y': 4,
          'K': 5,
          'J': 8, 'X': 8,
          'Q': 10, 'Z': 10, }


def letter_point(c):
    return points[c]


def word_point(w):
    sum = 0
    for c in w:
        sum += letter_point(c)
    return sum


words = input().split()
scores = dict()
for word in words:
    scores[word] = word_point(word)
    # print(word, scores[word])
sorted_score = sorted(list(set(sorted(scores.values(), reverse=True))), reverse=True)
# print(sorted_score)
sorted_dict = sorted(scores)
# print(sorted_dict)

for score in sorted_score:
    for word in sorted_dict:
        if score == scores[word]:
            print(word, score)


6531333821
# 1661299, 2022-10-29 09:19:15, PPPPP (100%)

def letter_point(c):
    if c in "A, E, I, L, N, O, R, S, T, U".split(", "):
        return 1
    elif c in "D, G".split(", "):
        return 2
    elif c in "B, C, M, P".split(", "):
        return 3
    elif c in "F, H, V, W, Y".split(", "):
        return 4
    elif c == 'K':
        return 5
    elif c in "J, X".split(", "):
        return 8
    elif c in "Q, Z".split(", "):
        return 10
    else:
        return 0


def word_point(w):
    point = 0
    for char in w:
        point += letter_point(char)
    return point


words = input().split()

pointList = []
for word in words:
    pointList.append([-word_point(word), word])
pointList.sort()
for np, word in pointList:
    print(word, -np)

# 1663673, 2022-10-29 10:29:21, PPPPP (100%)

def GetLetterPoint(char):
    if char in "AEILNORSTU":
        return 1
    elif char in "DG":
        return 2
    elif char in "BCMP":
        return 3
    elif char in "FHVWY":
        return 4
    elif char == 'K':
        return 5
    elif char in "JX":
        return 8
    elif char in "QZ":
        return 10
    else:
        return 0


def GetWordPoint(word):
    totalPoint = 0
    for char in word:
        totalPoint += GetLetterPoint(char)
    return totalPoint


words = input().split()

tempScores = []
for word in words:
    tempScores.append([-GetWordPoint(word), word])
tempScores.sort()
for negativePoint, word in tempScores:
    print(word, -negativePoint)

6531345321
# 1661296, 2022-10-29 09:19:01, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p1 = ['A','E','I','L','N','O','R','S','T','U']
    if c in p1 :
        return 1
    p2 = ['D','G']
    if c in p2 :
        return 2 
    p3 = ['B','C','M','P']
    if c in p3 :
        return 3 
    p4 = ['F','H','V','W','Y']
    if c in p4 :
        return 4 
    p5 = ['K']
    if c in p5 :
        return 5 
    p8 = ['J','X']
    if c in p8 :
        return 8 
    p10 = ['Q','Z']
    if c in p10 :return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 temp  = 0 
 for e in w :
    temp += letter_point(e)
 return temp

words = input().split()
ans =[]
for e in words:
    ans.append([word_point(e),e])
ans.sort(reverse=True)
for e in ans :
    print(e[1],e[0])
# 1661494, 2022-10-29 09:26:01, PPPPP (100%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p1 = ['A','E','I','L','N','O','R','S','T','U']
    if c in p1 :
        return 1
    p2 = ['D','G']
    if c in p2 :
        return 2 
    p3 = ['B','C','M','P']
    if c in p3 :
        return 3 
    p4 = ['F','H','V','W','Y']
    if c in p4 :
        return 4 
    p5 = ['K']
    if c in p5 :
        return 5 
    p8 = ['J','X']
    if c in p8 :
        return 8 
    p10 = ['Q','Z']
    if c in p10 :return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 temp  = 0 
 for e in w :
    temp += letter_point(e)
 return temp

words = input().split()
ans =[]
po = []
an= []
dt =dict()
for e in words:
    ans.append([word_point(e),e])
    po.append(word_point(e))
    if word_point(e) in dt :
        dt[word_point(e)].append(e)
    else :
        dt[word_point(e)] = [e]
x = sorted(dt.keys())[::-1]
for e in x :
    for a in sorted(dt[e]) :
        an.append([a,e])
ans.sort(reverse=True)
for e in an :
    print(e[0],e[1])

6531347621
# 1661297, 2022-10-29 09:19:13, PPPPP (100%)

pros = []
scoredict = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
    'D':2, 'G':2,
    'B':3, 'C':3,'M':3, 'P':3,
    'F':4, 'H':4, 'V':4, 'W':4, 'Y':4,
    'K':5,
    'J':8, 'X':8,
    'Q':10, 'Z':10
}
phrase = input().strip().split()
for i in range(len(phrase)):
    total = 0
    for e in phrase[i]:
        total += scoredict[e]
    pros.append([-total,phrase[i]])

for negscore,word in sorted(pros):
    print(word,-negscore)
    




# 1663030, 2022-10-29 10:15:29, PPPPP (100%)

pros = []
scoredict = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
    'D':2, 'G':2,
    'B':3, 'C':3,'M':3, 'P':3,
    'F':4, 'H':4, 'V':4, 'W':4, 'Y':4,
    'K':5,
    'J':8, 'X':8,
    'Q':10, 'Z':10
}
phrase = input().strip().split()
for i in range(len(phrase)):
    total = 0
    for e in phrase[i]:
        total += scoredict[e]
    pros.append([-total,phrase[i]])

for negscore,word in sorted(pros):
    print(word,-negscore)

6532035021
# 1661657, 2022-10-29 09:30:50, PPP-- (60%)

C = ['AEILNORSTU', 'DG', 'BCMP', 'FHVWY', 'K', 'JX', 'QZ']
P = [1, 2, 3, 4, 5, 8, 10]

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    return [P[i] for i,v in enumerate(C) if c in v][0]

def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum(letter_point(x) for x in w)

words = input().split()
for p, w in sorted([(word_point(w), w) for w in words])[::-1]:print(w, p)
# 1661686, 2022-10-29 09:32:14, PPPPP (100%)

C = ['AEILNORSTU', 'DG', 'BCMP', 'FHVWY', 'K', 'JX', 'QZ']
P = [1, 2, 3, 4, 5, 8, 10]

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    return [P[i] for i,v in enumerate(C) if c in v][0]

def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum(letter_point(x) for x in w)

words = input().split()
for p, w in sorted([(-word_point(w), w) for w in words]):print(w, -p)

6532068721
# 1661235, 2022-10-29 09:14:11, P---- (20%)

points_pre = {
    1: 'AEILNORSTU',
    2: 'DG',
    3: 'BCMP',
    4: 'FHVWY',
    5: 'K',
    8: 'JX',
    10: 'QZ'
}

points = {}

for point, chars in points_pre.items():
    for c in chars:
        points[c] = point


def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum(points[c] for c in w)


words = input().split()

for word in words:
    print(word, word_point(word))

# 1661256, 2022-10-29 09:16:59, PPPPP (100%)

from functools import cmp_to_key


points_pre = {
    1: 'AEILNORSTU',
    2: 'DG',
    3: 'BCMP',
    4: 'FHVWY',
    5: 'K',
    8: 'JX',
    10: 'QZ'
}

points = {}

for point, chars in points_pre.items():
    for c in chars:
        points[c] = point


def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum(points[c] for c in w)


words = input().split()

entries = []

for word in words:
    entries.append([word, word_point(word)])


def cmp(x, y):
    if x[1] > y[1]:
        return -1
    if x[1] < y[1]:
        return 1

    if x[0] > y[0]:
        return 1
    if x[0] < y[0]:
        return -1
    return 0


entries.sort(key=cmp_to_key(cmp))

for entry in entries:
    print(entry[0], entry[1])


6532100021
# 1661263, 2022-10-29 09:17:23, PPP-- (60%)

result = []
n = input().split()
for i in n:
    s = 0
    w = list(i)
    for j in w:
        if j in "AEILNORSTU":
            s += 1
        elif j in "DG":
            s += 2
        elif j in "BCMP":
            s += 3
        elif j in "FHVWY":
            s += 4
        elif j in "K":
            s += 5
        elif j in "JX":
            s += 8
        elif j in "QZ":
            s += 10
    result.append([s, i])
for i in sorted(result)[::-1]:
    print(i[1], i[0])

# 1661345, 2022-10-29 09:21:14, PPPPP (100%)

result = []
n = input().split()
for i in n:
    s = 0
    w = list(i)
    for j in w:
        if j in "AEILNORSTU":
            s += 1
        elif j in "DG":
            s += 2
        elif j in "BCMP":
            s += 3
        elif j in "FHVWY":
            s += 4
        elif j in "K":
            s += 5
        elif j in "JX":
            s += 8
        elif j in "QZ":
            s += 10
    result.append([-s, i])
for i in sorted(result):
    print(i[1], abs(i[0]))

6532123521
# 1661350, 2022-10-29 09:21:22, PPP-- (60%)

SCORE = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]


def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    return SCORE[ord(c) - 65]


def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    s = 0
    for c in w:
        s += letter_point(c)
    return s


words = input().split()
res = []
for word in words:
    res.append([word, word_point(word)])
for x, y in sorted(res, key=lambda x: -x[1]):
    print(x, y)

# 1662237, 2022-10-29 09:51:28, PPPPP (100%)

SCORE = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]


def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    return SCORE[ord(c) - 65]


def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    s = 0
    for c in w:
        s += letter_point(c)
    return s


words = input().split()
res = []
for word in words:
    res.append([word, word_point(word)])
for x, y in sorted(res, key=lambda x: (-x[1], x[0])):
    print(x, y)


6532136721
# 1661322, 2022-10-29 09:20:25, P---- (20%)

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    if c in "DG":
        return 2
    if c in "BCMP":
        return 3
    if c in "FHVWY":
        return 4
    if c in "K":
        return 5
    if c in "JX":
        return 8
    if c in "QZ":
        return 10

def word_point(w):
    s = 0
    for i in w:
        s += letter_point(i)
    return s

for i in input().split():
    print(i, word_point(i))

# 1661367, 2022-10-29 09:21:56, PPPPP (100%)

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    if c in "DG":
        return 2
    if c in "BCMP":
        return 3
    if c in "FHVWY":
        return 4
    if c in "K":
        return 5
    if c in "JX":
        return 8
    if c in "QZ":
        return 10

def word_point(w):
    s = 0
    for i in w:
        s += letter_point(i)
    return s

ans = []
for i in input().split():
    ans.append([-word_point(i), i])

ans.sort()

for b,a in ans:
    print(a, -b)


6532180221
# 1661265, 2022-10-29 09:17:31, P---- (20%)

W=[('AEILNORSTU',1), ('DG',2), ('BCMP',3), ('FHVWY',4), ('K',5), ('JX',8), ('QZ',10)]
a=input().split()
for i in a:
    s=0
    for j in i:
        for k in W:
            if(j in k[0]):s+=k[1]
    print(i,s)
# 1661293, 2022-10-29 09:18:48, PPPPP (100%)

W=[('AEILNORSTU',1), ('DG',2), ('BCMP',3), ('FHVWY',4), ('K',5), ('JX',8), ('QZ',10)]
a=input().split();b=[]
for i in a:
    s=0
    for j in i:
        for k in W:
            if(j in k[0]):s+=k[1]
    b+=[[-s,i]]
b.sort()
for i in b:
    print(i[1],-i[0])

6532187721
# 1661253, 2022-10-29 09:16:49, P---- (20%)

words = input().split()
l1 = ['A','E','I','L','N','O','R','S','T','U']
l2 = ['D','G']
l3 = ['B','C','M','P']
l4 = ['F','H','V','W','Y']
l5 = ['K']
l6 = ['J','X']
l7 = ['Q','Z']
for w in words:
    sum = 0
    for x in w:
        if x in l1: sum+=1
        elif x in l2: sum+=2
        elif x in l3: sum+=3
        elif x in l4: sum+=4
        elif x in l5: sum+=5
        elif x in l6: sum+=8
        elif x in l7: sum+=10
    print(w, sum)
# 1661275, 2022-10-29 09:18:03, PPPPP (100%)

words = input().split()
l1 = ['A','E','I','L','N','O','R','S','T','U']
l2 = ['D','G']
l3 = ['B','C','M','P']
l4 = ['F','H','V','W','Y']
l5 = ['K']
l6 = ['J','X']
l7 = ['Q','Z']
L = []
for w in words:
    sum = 0
    for x in w:
        if x in l1: sum+=1
        elif x in l2: sum+=2
        elif x in l3: sum+=3
        elif x in l4: sum+=4
        elif x in l5: sum+=5
        elif x in l6: sum+=8
        elif x in l7: sum+=10
    L.append([-sum,w])
L.sort()
for x,y in L:
    print(y,-x)

6532193421
# 1661526, 2022-10-29 09:27:07, ----- (0%)


d={
    ('A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'):1,
    ('D', 'G'):2,
    ('B', 'C', 'M', 'P'):3,
    ('F', 'H', 'V', 'W', 'Y'):4,
    ('K', ):5,
    ('J', 'X'):8,
    ('Q', 'Z'):10
}
s=input().split()
ans={}
for w in s:
    score=0
    for c in w:
        for k in d.keys():
            if c in k:
                score+=d[k]
                break
    if score not in ans:
        ans[score]=[]
    ans[score].append(w)
for score in sorted(ans.keys(), reverse=True):
    for w in sorted(ans[score]):
        print(score, w)
# 1661554, 2022-10-29 09:27:59, PPPPP (100%)


d={
    ('A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'):1,
    ('D', 'G'):2,
    ('B', 'C', 'M', 'P'):3,
    ('F', 'H', 'V', 'W', 'Y'):4,
    ('K', ):5,
    ('J', 'X'):8,
    ('Q', 'Z'):10
}
s=input().split()
ans={}
for w in s:
    score=0
    for c in w:
        for k in d.keys():
            if c in k:
                score+=d[k]
                break
    if score not in ans:
        ans[score]=[]
    ans[score].append(w)
for score in sorted(ans.keys(), reverse=True):
    for w in sorted(ans[score]):
        print(w, score)

6531805721
# 1661324, 2022-10-29 09:20:26, P---- (20%)

score = {'A':1,'E':1,'I':1,'O':1,'U':1,'L':1,'N':1,'R':1,'S':1,'T':1,
         'D':2,'G':2,
         'B':3,'C':3,'M':3,'P':3,
         'F':4,'H':4,'V':4,'W':4,'Y':4,
         'K':5,
         'J':8,'X':8,
         'Q':10,'Z':10}


n = input().split() ; p = 0
point = []
for i in n:
    for k in i:
        p += score[k]
    point.append([i,p])
    p = 0
    
for i in range(len(point)):
    print(point[i][0],point[i][1])
# 1661469, 2022-10-29 09:25:26, PPPPP (100%)

score = {'A':1,'E':1,'I':1,'O':1,'U':1,'L':1,'N':1,'R':1,'S':1,'T':1,
         'D':2,'G':2,
         'B':3,'C':3,'M':3,'P':3,
         'F':4,'H':4,'V':4,'W':4,'Y':4,
         'K':5,
         'J':8,'X':8,
         'Q':10,'Z':10}


n = input().split() 
point = [] ; p = 0
for i in n:
    for k in i:
        p += score[k]
    point.append([-p,i])
    p = 0
  
point.sort()
for i in range(len(point)):
    print(point[i][1],-point[i][0])

6532186021
# 1661353, 2022-10-29 09:21:27, PPP-- (60%)

def score(t):
    lst = [['A','E','I','L','N','O','R','S','T','U'],
           ['D','G'],['B','C','M','P'],['F','H','V','W','Y'],
           ['K'],['J','X'],['Q','Z']]
    score = [1,2,3,4,5,8,10]
    s = 0
    for e in t:
        for i in range(len(lst)):
            if e in lst[i]:
                s += score[i]
                break
    return s

def main():
    x = input().split()
    lst = [[score(e),e]for e in x]
    lst.sort()
    lst = lst[::-1]
    for x,y in lst:
        print(y,x)

main()
# 1663053, 2022-10-29 10:15:48, PPPPP (100%)

def score(t):
    lst = [['A','E','I','L','N','O','R','S','T','U'],
           ['D','G'],['B','C','M','P'],['F','H','V','W','Y'],
           ['K'],['J','X'],['Q','Z']]
    score = [1,2,3,4,5,8,10]
    s = 0
    for e in t:
        for i in range(len(lst)):
            if e in lst[i]:
                s += score[i]
                break
    return s

def main():
    x = input().split()
    lst = [[score(e),e]for e in x]
    lst.sort()
    lst = lst[::-1]
    score0 = lst[0][0]
    r = []
    result = []
    for x,y in lst:
        if x == score0:
            r.append([y,x])
        else:
            r.sort()
            result += r
            r = []
            r.append([y,x])
            score0 = x
    r.sort()
    result += r
    for x,y in result:
        print(x,y)

main()


6330175621
# 1661372, 2022-10-29 09:22:04, P---- (20%)

def letter(c):
    if c in 'AEILNORSTU':
        c = 1
    elif c in 'DG':
        c = 2
    elif c in 'BCMP':
        c = 3
    elif c in 'FHVWY':
        c = 4
    elif c in 'K':
        c = 5
    elif c in 'JX':
        c = 8
    elif c in 'QZ':
        c = 10
        
    return c
    
           
def word(w):
    sc = 0
    for e in w:
        sc += letter(e)
    return sc
        
    
a = input().split()

for n in a:
    print(n,word(n))
# 1661570, 2022-10-29 09:28:22, PPPPP (100%)

def letter(c):
    if c in 'AEILNORSTU':
        c = 1
    elif c in 'DG':
        c = 2
    elif c in 'BCMP':
        c = 3
    elif c in 'FHVWY':
        c = 4
    elif c in 'K':
        c = 5
    elif c in 'JX':
        c = 8
    elif c in 'QZ':
        c = 10
        
    return c
    
           
def word(w):
    sc = 0
    for e in w:
        sc += letter(e)
    return sc
        
    
a = input().split()
l = []
y = []

for n in a:
    l.append([n,word(n)])
for c,d in l:
    y.append([-d,c])
y.sort()
    
for i in range(len(y)):
    y[i] = [y[i][1],-y[i][0]]
    
for e,t in y:
    print(e,t)

6230089221
# 1661427, 2022-10-29 09:24:10, PPPPP (100%)

def letter_point(c):
    if c in ["A", "E", "I", "L", "N", "O","R", "S", "T", "U"]:
        p=1
        return p
    elif c in ["D","G"]:
        p=2
        return p
    elif c in ["B","C","M","P"]:
        p=3
        return p
    elif c in ["F","H","V","W","Y"]:
        p=4
        return p
    elif c in ["K"]:
        p=5
        return p
    elif c in ["J","X"]:
        p=8
        return p
    elif c in ["Q","Z"]:
        p=10
        return p
def word_point(w):
    sum=0
    for e in w:
        p=letter_point(e)
        sum+=p
    return sum
words = input().split()
r=[]
for e in words:
    sum=word_point(e)
    r.append([-sum,e])
r.sort()
for e in r:
    print(e[1],abs(e[0]))

6231117321
# 1661834, 2022-10-29 09:38:42, PPPPP (100%)

'''
Grader 2
#1
password: SECOND_quiz
'''

def letter_points(c):
    points = 0
    if c in "AEILNORSTU":
        points = 1
        return points
    elif  c in "DG":
        points = 2
        return points
    elif c in "BCMP":
        points = 3
        return points
    elif c in "FHVWY":
        points = 4
        return points
    elif c in 'K':
        points = 5
        return points
    elif c in 'JX':
        points = 8
        return points
    else:
        if c in 'QZ':
            points = 10
            return points

def word_point(w):
    sc_eachwords = []
    w = w.upper()
    for e in w:
        sc_eachwords.append(letter_points(e))
    return sum(sc_eachwords)

words = input().split()
output = []
for ele in words:
    sc = word_point(ele)
    output.append([-sc,ele])
output.sort()
output2 = []
for sc,word in output:
    output2+=[word,str(-sc)] 
#print(output2)
for i in range(0,len(output2)-1,2):
    print(output2[i],output2[i+1])
    #print('\n')
#print('\n'.join(output2))



        
        
    




6231122421
# 1661615, 2022-10-29 09:29:26, PPPPP (100%)

def letter_point(c):
    one = ['A','E','I','L','N','O','R','S','T','U']
    two = ['D', 'G']
    three = ['B','C','M','P']
    four = ['F','H','V','W','Y']
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    point = {1:one, 2:two, 3:three, 4:four, 5:five, 8:eight, 10:ten}
    for e in point:
        if c in point[e]:
            return e


def word_point(w):
    c = 0
    for i in range(len(w)):
        c += letter_point(w[i])
    return c

words = input().split()
wp = []
for e in words:
    wp.append([e, word_point(e)])

wp.sort()
wp.sort(key=lambda wp:wp[1], reverse=True)
for e in wp:
    print(e[0],e[1])


6231404421
# 1662158, 2022-10-29 09:49:19, PPPPP (100%)

def letter_point(c):
    point = 0
    for i in c :
        if i == 'A' or i == 'E' or i == 'I' or i == 'L' or i == 'N' or i == 'O' or i == 'R' or i == 'S' or i == 'T' or i == 'U':
            point += 1
        elif i == 'D' or i == 'G':
            point += 2
        elif i == 'B' or i == 'C' or i == 'M' or i == 'P':
            point += 3
        elif i == 'F' or i == 'H' or i == 'V' or i == 'W' or i == 'Y':
            point += 4
        elif i == 'K' :
            point += 5
        elif i == 'J' or i == 'X' :
            point += 8
        elif i == 'Q' or i == 'Z' :
            point += 10
    return point
def sort_1(x):
    y = []
    for a,b in x :
        y.append([-b,a])
    y.sort()
    for i in range(len(y)):
        y[i] = [y[i][1],-y[i][0]]
    return y
    
words = input().split()
x = []
for i in range(len(words)):
    x.append([words[i],letter_point(words[i])])
y = sort_1(x)
for i in range(len(y)):
    print(y[i][0],y[i][1])

6231425621
# 1661597, 2022-10-29 09:28:56, PPPPP (100%)

def letter_point(w):
    total = 0
    d = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1\
          ,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4\
          ,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    
    for e in w:
        total+=d[e]
     
    return [-total,w]
         


words = input().split()
out = []
for c in words:
    out.append(letter_point(c))
out.sort()

for s,n in out:
    print(n,-s)

6330148721
# 1663255, 2022-10-29 10:20:56, PPPPP (100%)

def sum_point(s):
    st = {"A": 1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1, "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4, "W":4, "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10}
    rs = 0
    for e in s:
        rs += st[e]
    return rs

x = input().strip().split(" ")
m = []
for e in x:
    y = sum_point(e)
    m += [[-1*y, e]]
m.sort()
for e in m:
    print(e[1] + " " + str(e[0] *-1))

6431501821
# 1662287, 2022-10-29 09:53:05, PPPPP (100%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
        
def word_point(w):
# คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    pw = 0
    if w.isupper():
        for e in w:
            pw += letter_point(e)
    return pw
            

words = input().split()
point = 0
if len(words) == 1:
    for e in words:
        print(e,word_point(e))
    
else:
    out = []
    for i in range(len(words)):
        out.append([-word_point(words[i]),words[i]])
    out.sort()
    for m in range(len(out)):
        print(out[m][1],-out[m][0])
    
    
    
    



6431007121
# 1661750, 2022-10-29 09:35:17, PPPPP (100%)

def letter_point(c):
    num=0
    one='AEILNORSTU'
    two='DG'
    three='BCMP'
    four='FHVWY'
    five='K'
    eight='JX'
    ten='QZ'
    for e in c:
        if e in one:
            num+=1
        elif e in two:
            num+=2
        elif e in three:
            num+=3
        elif e in four:
            num+=4
        elif e in five:
            num+=5
        elif e in eight:
            num+=8
        elif e in ten:
            num+=10
    return num
score=[]
x=input().split()
for e in x:
    score.append([-letter_point(e),e])
score.sort()
for i in range (len(score)):
    print(score[i][1],-score[i][0])

6530006421
# 1661396, 2022-10-29 09:22:54, PPPPP (100%)

# Quiz 2_1
# This Code was written by Folkiesss Desu!!

def main():
    word = [x for x in input().split()]
    ls = []
    for x in word:
        ls.append([-word_point(x), x])

    ls = sorted(ls)

    for x in ls:
        print(x[1], -x[0])

def letter_point(s):
    s1 = [[1, "AEILNORSTU"],
          [2, "DG"],
          [3, "BCMP"],
          [4, "FHVWY"],
          [5, "K"],
          [8, "JX"],
          [10, "QZ"],
    ]
          
    for p in s1:
        if s in p[1]:
            return p[0]
    

def word_point(w):
    score = 0
    for c in w:
        score += letter_point(c)

    return score

main()


6530007021
# 1661375, 2022-10-29 09:22:07, PPPPP (100%)

com = input().split()
s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
re = []
for i in range(len(com)):
    sc = 0
    for k in com[i]:
        if k in s1: sc += 1
        elif k in s2: sc += 2
        elif k in s3: sc += 3
        elif k in s4: sc += 4
        elif k in s5: sc += 5
        elif k in s8: sc += 8
        elif k in s10: sc += 10
    re.append([-sc,com[i]])
re.sort()
for i in re:
    print(i[1],-i[0])

6530008721
# 1661419, 2022-10-29 09:23:47, PPPPP (100%)

def letter_point(alpha):
    result = 0
    for c in alpha:
        if c in 'AEILNORSTU':
            result += 1
        elif c in 'DG':
            result += 2
        elif c in 'BCMP':
            result += 3
        elif c in 'FHVWY':
            result += 4
        elif c in 'K':
            result += 5
        elif c in 'JX':
            result += 8
        elif c in 'QZ':
            result += 10
    return result

def kindasort(e):
    return -int(e[1]), e[0]

scrabble = [e for e in input().split()]
sumofscore = []
for e in scrabble:
    score = letter_point(e)
    sumofscore.append([e, score])

sumofscore.sort(key=kindasort)

for e in sumofscore:
    print(e[0], e[1])




6530010921
# 1661809, 2022-10-29 09:37:47, PPPPP (100%)

#SECOND_quiz
a = input().split()
point = []
for i in range(len(a)):
    c = 0
    for j in range(len(a[i])):
        if a[i][j] in ['A','E','I','L','N','O','R','S','T','U']:
            c += 1
        elif a[i][j] in ['D','G']:
            c += 2
        elif a[i][j] in ['B','C','M','P']:
            c += 3
        elif a[i][j] in ['F','H','V','W','Y']:
            c += 4
        elif a[i][j] in ['K']:
            c += 5
        elif a[i][j] in ['J','X']:
            c += 8
        elif a[i][j] in ['Q','Z']:
            c += 10
    point += [[-c,a[i]]]
point.sort()
for i in range(len(point)):
    print(point[i][1],int(-point[i][0]))

6530014421
# 1661414, 2022-10-29 09:23:43, PPPPP (100%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w):
    p=0
    for i in w:
        p+=letter_point(i)
    return p
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
x=[]
for k in words:
    x.append([-word_point(k),k])
x.sort()
for k in x:
    print(k[1],-k[0])


6530015021
# 1661313, 2022-10-29 09:19:48, PPPPP (100%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10
def word_point(w):
    # คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    s = 0
    for char in w:
        s += letter_point(char)
    return s

words = input().strip().split()
out = []
for word in words:
    out.append([-word_point(word),word])
out.sort()
for o in out:
    print(o[1],-o[0])


6530023021
# 1661871, 2022-10-29 09:39:36, PPPPP (100%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "AEILNORSTU":
     return 1
 if c in "DG":
     return 2
 if c in "BCMP":
     return 3
 if c in "FHVWY":
     return 4
 if c in "K":
     return 5
 if c in "JX":
     return 8
 if c in "QZ":
     return 10
 
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 count = 0
 for e in w:
     count += letter_point(e)
 return count

words = input().split()
ans = []
ans1 = []
for i in range(len(words)):
    ans.append([-word_point(words[i]),words[i]])
    ans1.append(words[i])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1],-ans[i][0])

6530027621
# 1661423, 2022-10-29 09:24:03, PPPPP (100%)

x = input()
x = x.split()
lisans = []
p = 0
for i in range(len(x)):
    for e in x[i]:
        if e in'AEILNORSTU':
            p += 1
        if e in 'DG':
            p += 2
        if e in 'BCMP':
            p += 3
        if e in 'FHVWY':
            p += 4
        if e in 'K':
            p += 5
        if e in 'JX':
            p += 8
        if e in 'QZ':
            p += 10
    lisans.append([-p,str(x[i])])
    p = 0
lisans.sort()
for k in range(len(lisans)):
    print(lisans[k][1],-(int(lisans[k][0])))

6530028221
# 1661534, 2022-10-29 09:27:30, PPPPP (100%)

a=str(input()).strip().split()
d={}
d['A']=1
d['B']=3
d['C']=3
d['D']=2
d['E']=1
d['F']=4
d['G']=2
d['H']=4
d['I']=1
d['J']=8
d['K']=5
d['L']=1
d['M']=3
d['N']=1
d['O']=1
d['P']=3
d['Q']=10
d['R']=1
d['S']=1
d['T']=1
d['U']=1
d['V']=4
d['W']=4
d['X']=8
d['Y']=4
d['Z']=10
result=[]
for i in range(len(a)) :
    r=0
    for k in a[i] :
        r+=d[k]
    result.append([r*(-1),a[i]])
result.sort()
for i in range(len(result)) :
    print(result[i][1],int(result[i][0])*(-1))
    









6530033321
# 1661474, 2022-10-29 09:25:37, PPPPP (100%)

def letter_point(c):
    p = 0
    if c in "AEILNORSTU":
        p += 1
    if c in "DG":
        p += 2
    if c in "BCMP":
        p += 3
    if c in "FHVWY":
        p += 4
    if c in "K":
        p += 5
    if c in "JX":
        p += 8
    if c in "QZ":
        p += 10
    return p
    
def word_point(w):
    tp = 0
    for i in w:
        tp += letter_point(i)
    return tp
    

w = input().split()
l = []
for e in range(len(w)):
    l.append([(-1)*word_point(w[e]), w[e]])
l.sort()
for x,y in l:
    print(y, x*(-1))


6530041321
# 1662505, 2022-10-29 09:59:57, PPPPP (100%)

def letter_point(c):
    point = 0
    for e in c:
        if e in ['A', 'E', 'I', 'L', 'N',\
                 'O', 'R', 'S', 'T', 'U']:
            point += 1
        elif e in ['D', 'G']:
            point += 2
        elif e in ['B', 'C', 'M', 'P']:
            point += 3
        elif e in ['F', 'H', 'V', 'W', 'Y']:
            point += 4
        elif e in ['K']:
            point += 5
        elif e in ['J', 'X']:
            point += 8
        else:
            point += 10
    return point

def word_point(w):
    d = []
    for e in w:
        p_e = letter_point(e)
        d.append([p_e,e])
    return d

        
words = input().split()
dd = word_point(words)

if len(dd) > 1:
    dd.sort()
data = []
for e in dd:
    data.insert(0,e)

eq = [[data[0][1], data[0][0]]]
for i in range(1,len(data)):
    if data[i][0] != data[i-1][0]:
        if len(eq) > 1:
            eq.sort()
        for e in eq:
            print(e[0],e[1])
        eq = [[data[i][1], data[i][0]]]
    else:
        eq.append([data[i][1], data[i][0]])
        
if len(eq) > 1:
    eq.sort()
for e in eq:
    print(e[0],e[1])

6530059721
# 1661300, 2022-10-29 09:19:19, PPPPP (100%)

#SECOND_quiz

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c=="K":
        return 5
    elif c in "JX":
        return 8
    return 10
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    sum = 0
    for ch in w:
        sum += letter_point(ch)
    return sum
    
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w


words = input().split()
ans = []
for w in words:
    ans.append([-word_point(w),w])
ans.sort()
for w in ans:
    print(w[1],-w[0])


6530072821
# 1661316, 2022-10-29 09:20:02, PPPPP (100%)

def word_point(w):
    score = {'A': 1, 'E': 1, 'I': 1, 'L': 1, 'N': 1, 'O': 1, 'R': 1, 'S': 1, 'T': 1, 'U': 1,\
             'D': 2, 'G': 2, 'B': 3, 'C': 3, 'M': 3, 'P': 3,\
             'F': 4, 'H': 4, 'V': 4, 'W': 4, 'Y': 4,\
             'K': 5, 'J': 8, 'X': 8, 'Q': 10, 'Z': 10
             }
    return sum([score[ch] for ch in w])
words = input().split()
rank = []
for word in words:
    rank.append([-word_point(word),word])
rank.sort()
for word in rank:
    print(word[1],abs(word[0]))


6530077021
# 1661455, 2022-10-29 09:25:03, PPPPP (100%)

x = input().strip().split()
score = ['','AEILNORSTU','DG','BCMP','FHVWY','K','','','JX','','QZ']

out = []
for n  in x:
    ans = 0
    for m in n:
        for j in range(len(score)):
            if  m in score[j]:
                ans += j
                break
    out.append([-ans,n])
out.sort()
for a,b in out:
    print(b,-a)

6530078621
# 1661769, 2022-10-29 09:35:57, PPPPP (100%)

def s_word(w):
    score={'A':1,'E':1,'I':1,'L':1,'N':1,\
           'O':1,'R':1,'S':1,'T':1,'U':1,\
           'D':2,'G':2,'B':3,'C':3,'M':3,\
           'P':3,'F':4,'H':4,'V':4,'W':4,\
           'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    s=0
    for i in w:
        s+=score[i]
    return s

def show(sh):
    for i in range(len(sh)):
        print(sh[i][1], str(sh[i][0]))

n=input().split()
s,sh=[],[]
for i in range(len(n)):
    s.append([s_word(n[i]),n[i]])
s.sort()
s=s[::-1]
for i in range(len(n)-1):
    sh.append(s[i])
    if s[i][0]!=s[i+1][0]:
        sh.sort()
        show(sh)
        sh=[]
sh.append(s[-1])
sh.sort()
show(sh)


6530083721
# 1661546, 2022-10-29 09:27:43, PPPPP (100%)

x = input().split()
one = 'A, E, I, L, N, O, R, S, T, U'
two = 'D, G'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
out = []
for i in x:
    ans = []
    score = 0
    for k in i:
        if k in one:
            score += 1
        elif k in two:
            score += 2
        elif k in three:
            score += 3
        elif k in four:
            score += 4
        elif k in five:
            score += 5
        elif k in eight:
            score += 8
        elif k in ten:
            score += 10
    ans.append(score*-1)
    ans.append(i)
    out.append(ans)
out.sort()
for i in range(len(x)):
    print(out[i][1] ,out[i][0]*-1)


6530085021
# 1661848, 2022-10-29 09:39:05, PPPPP (100%)

one = "AEILNORSTU"
two = "DG"
three = "BCMP"
four = "FHVYW"
five = "K"
eight = "JX"
ten = "QZ"
x = input().split()
for i in range(len(x)):
    sum = 0
    for u in x[i]:
        if u in one:
            sum += 1
        elif u in two:
            sum += 2
        elif u in three:
            sum += 3
        elif u in four:
            sum += 4
        elif u in five:
            sum += 5
        elif u in eight:
            sum += 8
        elif u in ten:
            sum += 10
    x[i] = [x[i],sum]
def func(x):
    return x[0]
l = x
p = sorted(l,key = lambda x:(1000000-x[1],x[0]))
for i in p:
    print("{0} {1}".format(i[0],i[1]))

6530090021
# 1661503, 2022-10-29 09:26:17, PPPPP (100%)

a = input().split()
Final=[]
def cat(i):
    A =[] ; AA = 0
    for k in i:
        if k in 'AEILNORSTU':
            AA+=1
        elif k in 'DG':
            AA+=2
        elif k in 'BCMP':
            AA+=3
        elif k in 'FHVWY':
            AA+=4
        elif k in 'K':
            AA+=5
        elif k in 'JX':
            AA+=8
        elif k in 'QZ':
            AA+=10
    A.append([-AA,i])
    return A
def dog(a):
    for i in a:
        Final.append(cat(i))
    Final.sort()
    for i in Final:
        print(i[0][1] ,-int(i[0][0]))
dog(a)           
    


6530099821
# 1661841, 2022-10-29 09:38:54, PPPPP (100%)

x = ['AEILNORSTU','DG','BCMP','FHVWY','K','JX','QZ']
y = [1,2,3,4,5,8,10]

def letter_point(c):
    for i in x:
        if c in i:
            a = y[x.index(i)]
    return a
    
def word_point(w):
    sum = 0
    for i in w:
        sum += letter_point(i)
    return sum

l1 = []
l2 = []
l3 = []
l4 = []
a = input().split()
for i in a:
    l1.append(i)
    l2.append(word_point(i))

while len(l1) != 0:
    n1 = l2.count(max(l2))
    for j in range(n1):
        p = l2.index(max(l2))
        l3.append(l1[p])
        l1.pop(p)
        l2.pop(p)
    l3.sort()
    l4 += l3
    l3.clear()

for k in l4:
    print(k + ' ' + str(word_point(k)))

6530101321
# 1661566, 2022-10-29 09:28:16, PPPPP (100%)

point1 = ["A","E","I","L","N","O","R","S","T","U",1]
point2 = ["D","G",2]
point3 = ["B","C","M","P",3]
point4 = ["F","H","V","W","Y",4]
point5 = ["K",5]
point8 = ["J","X",8]
point10 = ["Q","Z",10]

words = input().strip().split()
score = []
result = ""

for x in words :
    n = 0
    for y in x :
        if y in point1 : n += 1
        elif y in point2 : n += 2
        elif y in point3 : n += 3
        elif y in point4 : n += 4
        elif y in point5 : n += 5
        elif y in point8 : n += 8
        elif y in point10 : n += 10
    score.append([-n,x])
    n = 0
score.sort()

for x,y in score :
    result += y + " " + str(-x) + "\n"

print(result)

6530103621
# 1661340, 2022-10-29 09:20:58, PPPPP (100%)

word = input().split()
p_w = []
s = 0
for e in word:
    for i in range(len(e)):
        if e[i] in "AEILNORSTU":
            s += 1
        elif e[i] in "DG":
            s += 2
        elif e[i] in "BCMP":
            s += 3
        elif e[i] in "FHVWY":
            s += 4
        elif e[i] in "K":
            s += 5
        elif e[i] in "JX":
            s += 8
        elif e[i] in "QZ":
            s += 10
    p_w.append([-s,e])
    s=0
p_w.sort()
for e in p_w:
    print(e[1],-e[0])


6530117421
# 1661283, 2022-10-29 09:18:28, PPPPP (100%)

def letter_point(c):
 dic = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
 return dic[c]
def word_point(w):
 sum = 0
 for i in w: sum += letter_point(i)
 return sum
words = [str(i) for i in input().split()]
sc = []
for i in words:
    sc.append([-1*word_point(i),i])
sc.sort()
for i in sc:
    print(i[1] + " " + str(abs(i[0])))


6530128321
# 1661588, 2022-10-29 09:28:44, PPPPP (100%)

def word_val(x):
    result = 0
    
    
    for i in x:
        if i in ['A','E','I','L','N','O','R','S','T','U']:
            result += 1
            continue
        if i in ['D','G']:
            result += 2
            continue
        if i in ['B','C','M','P']:
            result += 3
            continue
        if i in ['F','H','V','W','Y']:
            result += 4
            continue
        if i in ['K']:
            result += 5
            continue
        if i in ['J','X']:
            result += 8
            continue
        if i in ['Q','Z']:
            result += 10
            continue
        
    return result
        
a = input().strip().split()
r = []
uniqueScore = []
for i in a:
    r.append([word_val(i),i])
    
r.sort()
for i in r:
    if i[0] not in uniqueScore:
        uniqueScore.append(i[0])
uniqueScore = uniqueScore[::-1]

for i in uniqueScore:
    t = []
    for u in r:
        if u[0] == i:
            t.append(u[1])
    t.sort()
    for j in t:
        print(j,i)
    
    
    
    
    
    
    
    
    


6530149521
# 1664324, 2022-10-29 10:39:08, PPPPP (100%)

al1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
al2 = ['D','G']
al3 = ['B', 'C', 'M', 'P'
]
al4 = ['F', 'H', 'V', 'W', 'Y']
al5 = ['K']
al8 = ['J','X']
al10 = ['Q','Z']
n = input().split()
ans = []
for x in n :
    c = 0
    for y in x :
        if y in al1 :
            c += 1
        elif y in al2 :
            c += 2
        elif y in al3 :
            c += 3
        elif y in al4 :
            c += 4
        elif y in al5 :
            c += 5
        elif y in al8 :
            c += 8
        elif y in al10 :
            c += 10
    ans.append([c,x])
ans.sort(reverse = True)

st = ans[0][0]
y = [[]]
c = 0
sc = []
for i in range (len(ans)) :
    if ans[i][0] == st :
        y[c].append(ans[i][1])
    else :
        sc.append(st)
        st = ans[i][0]
        y += [[ans[i][1]]]
        c += 1
sc.append(ans[i][0])

for x in y :
    x.sort()
for i in range (len(y)):
    for j in range (len(y[i])) :
        print(y[i][j],sc[i])

6530151721
# 1661398, 2022-10-29 09:22:59, PPPPP (100%)

n={'Q':10,'Z':10,'J':8,'X':8,'K':5,'F':4,'H':4,'V':4,'W':4,'Y':4,'B':3,'C':3,'M':3,'P':3,'D':2,'G':2,'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1}
a=input().split()
c=[]
ans={}
for i in range(len(a)):
    ans[a[i]]=0
    for k in range(len(a[i])):
        ans[a[i]]+=n[a[i][k]]
for i in ans:
    c.append([-ans[i],i])
c.sort()
for i in range(len(c)):
    print(c[i][1],-c[i][0])

6530160321
# 1661605, 2022-10-29 09:29:12, PPPPP (100%)


a = input().split()

x1 = ["A","E","I","L","N","O","R","S","T","U"]
x2 = ["D","G"]
x3 = ["B","C","M","P"]
x4 = ["F","H","V","W","Y"]
x5 = ["K"]
x8 = ["J","X"]
x10 = ["Q","Z"]

hotdog = []
for i in range(len(a)) :
    j = []
    for e in range(len(a[i])) :
        if a[i][e] in x1 :
            k = 1
            j.append(k)
        elif a[i][e] in x2 :
            k = 2
            j.append(k)
        elif a[i][e] in x3 :
            k = 3
            j.append(k)
        elif a[i][e] in x4 :
            k = 4
            j.append(k)
        elif a[i][e] in x5 :
            k = 5
            j.append(k)
        elif a[i][e] in x8 :
            k = 8
            j.append(k)
        elif a[i][e] in x10 :
            k = 10
            j.append(k)
    hotdog.append(j)
z = []
for i in range(len(hotdog)) :
    j = sum(hotdog[i])
    z.append([-j,a[i]])
z.sort()

for i in range(len(z)) :
    print(z[i][1],-z[i][0])


6530162621
# 1661288, 2022-10-29 09:18:37, PPPPP (100%)

# 2565_1_Quiz_2_1

points = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,
          'D':2,'G':2,
          'B':3,'C':3,'M':3,'P':3,
          'F':4,'H':4,'V':4,'W':4,'Y':4,
          'K':5,
          'J':8,'X':8,
          'Q':10,'Z':10}


def word_point(c):
    ans = 0
    for e in c:
        ans+=points[e]
    return ans

words = input().split()
results = []
for e in words:
    results.append([-word_point(e),e])
results.sort()

for e in results:
    print(e[1],-e[0])



6530164921
# 1661326, 2022-10-29 09:20:28, PPPPP (100%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    result = 0
    for i in c:
        if i in "AEILNORSTU":
            result += 1
        elif i in "DG":
            result += 2
        elif i in "BCMP":
            result += 3
        elif i in "FHVWY":
            result += 4
        elif i in "K":
            result += 5
        elif i in "JX":
            result += 8
        elif i in "QZ":
            result += 10
    return result
            
#def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    
score = []
c = []
words = input().split()
for i in words:
    c.append(-letter_point(i))
    c.append(i)
    score.append(c)
    c = []
    
score.sort()

for i in score:
    print(i[1], -i[0])
    

6530166121
# 1661388, 2022-10-29 09:22:40, PPPPP (100%)

words = input().strip().split()
point = {'A':1 ,'B':3 , 'C':3, 'D':2, 'E':1, 'F':4, 'G':2,'H':4,
         'I':1, 'J':8, 'K':5, 'L':1, 'M':3, 'N':1, 'O':1, 'P':3,
         'Q':10, 'R':1, 'S':1, 'T':1, 'U':1, 'V':4, 'W':4, 'X':8, 'Y':4, 'Z':10}

sc = 0; lscore = []
for word in words:
    for c in word.upper():
        sc += point[c]
    lscore.append([-sc,word])
    sc = 0        
        
lscore.sort()
for e in lscore:
    print(e[1], -e[0])


6530168421
# 1663582, 2022-10-29 10:27:30, PPPPP (100%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J', 'X']:
        return 8
    elif c in ['Q', 'Z']:
        return 10
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    out = 0
    for e in w:
        out += letter_point(e)
    return out
words = input().split()
out = []
for e in words:
    out.append([-(word_point(e)), e])
out.sort()
for e in out:
    print(e[1], -(e[0]))

6530170621
# 1661284, 2022-10-29 09:18:29, PPPPP (100%)

score={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
x=input().split()
output=[]
for e in x:
    point=0
    for k in e:
        point+=score[k]
    output.append([-point,e])
output.sort()
for e in output:
    print(e[1],-e[0])

6530172921
# 1661404, 2022-10-29 09:23:21, PPPPP (100%)

all_word = input().split()
non_sort = []
for word in all_word:
    value = 0
    for e in word:
        if e in "AEILNORSTU":
            value +=1
        elif e in "DG":
            value +=2
        elif e in "BCMP":
            value +=3
        elif e in "FHVWY":
            value +=4
        elif e == "K":
            value +=5
        elif e in "JX":
            value +=8
        elif e in "QZ":
            value +=10
    non_sort.append([-value,word])
non_sort.sort()
for out in non_sort:
    print(out[1],str(-out[0]))
 


6530176421
# 1662340, 2022-10-29 09:54:50, PPPPP (100%)

score={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
words = input().split()
total=0
word_score=[]
for e in words:
    for i in range(len(e)):
        for p in score:
            if e[i]==p:
                total+=score[p]
    word_score.append([-1*total,e])
    total=0
word_score.sort()
for e in word_score:
    print(e[1],-1*e[0])

6530178721
# 1661432, 2022-10-29 09:24:21, PPPPP (100%)

x = input().split()
score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
neg = []
for i in x:
    sum = 0
    for e in i:
        sum += score[e]
    neg += [[-1*sum,i]]
neg.sort()
for i in range(len(neg)):
    print(neg[i][1],-1*neg[i][0])



6530181521
# 1661407, 2022-10-29 09:23:27, PPPPP (100%)

def score(t) :
    sc = 0
    for i in t :
        if i in 'AEILNORSTU' :
            sc += 1
        elif i in 'DG' :
            sc += 2
        elif i in 'BCMP' :
            sc += 3
        elif i in 'FHVWY' :
            sc += 4
        elif i in 'K' :
            sc += 5
        elif i in 'JX' :
            sc += 8
        elif i in 'ZQ' :
            sc += 10
    return sc
            
x = [[-score(e),e] for e in input().split()]
x.sort()
for i,j in x :
    print(j,-i)

6530183821
# 1661516, 2022-10-29 09:26:46, PPPPP (100%)

d={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
w=input().split()
l=[]
for i in range(len(w)):
    s=0
    for e in w[i]:
        if e in d:
            s+=d[e]
    l.append([s*-1,w[i]])
l.sort()
for i in range(len(l)):
    l[i][0]*=-1
    l[i][0]=str(l[i][0])
    l[i][0],l[i][1]=l[i][1],l[i][0]
for i in range(len(l)):
    print(' '.join(l[i]))

6530188021
# 1661576, 2022-10-29 09:28:27, PPPPP (100%)

def letter_point(c):
    d = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    return d[c]
def word_point(w):
    sol = 0
    for i in w:
        sol += letter_point(i)
    return sol
words = input().split()
sol = []
if type(words) == list:
    for i in words:
        sol += [[word_point(i)*-1,i]]
    sol.sort()
    for i in range(len(sol)):
        print(sol[i][1]+' '+str(sol[i][0]*-1))
else:
    sol = word_point(words)
    print(words+' '+str(sol))


6530192421
# 1661569, 2022-10-29 09:28:21, PPPPP (100%)

g = {1:['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'], 2:['D', 'G'], 3:['B', 'C', 'M', 'P'], 4:['F', 'H', 'V', 'W', 'Y'], 5:['K'],
     8:['J', 'X'],10:['Q','Z']}
a = input().split()
d = []
for i in a:
    s = 0
    for p in i:
        for o in g:
            if p in g[o]:
                s += o
    d.append([-s,i])
d.sort()
for i in d:
    print(i[1],abs(i[0]))

6530195321
# 1661508, 2022-10-29 09:26:28, PPPPP (100%)

words = input().split() #OMPUTE ZEBRA QUEEN QUIET QUITE
list_ = []
for e in words:
    c = 0
    for i in range(len(e)):
        if e[i] in "AEILNORSTU":
            c+=1
        elif e[i] in 'DG':
            c+=2
        elif e[i] in 'BCMP':
            c+=3
        elif e[i] in 'FHVWY':
            c+=4
        elif e[i] in 'K':
            c+=5
        elif e[i] in 'JX':
            c+=8
        elif e[i] in 'QZ':
            c+=10
    list_.append(c)

list_2 = []
for i in range(len(list_)):
    list_2.append([-list_[i], words[i]])

list_2.sort()

for e in list_2:
    print(e[1], -e[0])


6530199921
# 1661706, 2022-10-29 09:32:54, PPPPP (100%)

letter = {'A':1, 'B':3, 'C':3, 'D':2, 'E':1, 'F':4, 'G':2, 'H':4, 'I':1, 'J':8, 'K':5,
          'L':1, 'M':3, 'N':1, 'O':1, 'P':3, 'Q':10, 'R':1, 'S':1, 'T':1, 'U':1, 'V':4,
          'W':4, 'X':8, 'Y':4, 'Z':10}
ans = []
x = input().strip().split()
for e in x :
    summ = 0
    for i in range(len(e)) :
        summ -= int(letter[e[i]])
    ans.append([summ, e])
ans.sort()
for i in range(len(ans)):
    print(ans[i][1], str(ans[i][0])[1:])

6530203721
# 1661607, 2022-10-29 09:29:17, PPPPP (100%)

x = input().upper().split()
score = 0
d = []
for e in x:
    for k in e:
        if 'A' <= k <= 'Z':
            if k in 'AEILNORSTU':
                score += 1
            elif k in 'DG':
                score += 2
            elif k in 'BCMP':
                score += 3
            elif k in 'FHVWY':
                score += 4
            elif k in 'K':
                score += 5
            elif k in 'JX':
                score += 8
            elif k in 'QZ':
                score += 10
    end1word = True
    if end1word:
        d.append([-score,e])
    score = 0
d.sort()
for i in range(len(d)):
    print(d[i][1],-d[i][0])
    
        
    




6530205021
# 1661498, 2022-10-29 09:26:11, PPPPP (100%)

score = {'AEILNORSTU':1 ,'DG': 2 ,'BCMP': 3 , 'FHVWY':4 , 'K':5, 'JX' : 8 , 'QZ' : 10}
word = input().split()
ans = []
for i in word :
    point = 0
    for x in i :
        for a in score :
            if x in a :
                point += score[a]
    ans.append([-1*point , i])

for i in sorted(ans) :
    print(i[1] , abs(i[0]))

6530207221
# 1661476, 2022-10-29 09:25:39, PPPPP (100%)

s1 = "AEILNORSTU"
s2 = "DG"
s3 = "BCMP"
s4 = "FHVWY"
s5 = "K"
s6 = "JX"
s7 = "QZ"

def letter_point(c):
    if c.upper() in "AEILNORSTU":
        return 1
    elif c.upper() in "DG" :
        return 2
    elif c.upper() in "BCMP" :
        return 3
    elif c.upper() in "FHVWY" :
        return 4
    elif c.upper() in "K" :
        return 5
    elif c.upper() in "JX" :
        return 8
    elif c.upper() in "QZ" :
        return 10
              
def word_point(w):
    s = 0
    for ch in w :
        s += letter_point(ch)
    return s

words = input().split()
l = []
for i in range(len(words)):
    l.append([-word_point(words[i]),words[i]])
l.sort()
for i in range(len(l)):
    print(l[i][1],-int(l[i][0]))

6530212321
# 1661325, 2022-10-29 09:20:27, PPPPP (100%)

def letter_point(c):
    pt = {'AEILNORSTU':1,'DG':2,'BCMP':3,'FHVWY':4,'K':5,'JX':8,'QZ':10}
    for e in pt.keys() :
        if c in e :
            return pt[e]
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w): #QUITE 
    s = 0
    for e in w.upper() :
        s += letter_point(e)
    return s
# คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split() ; point = []
for e in words :
    point.append([-word_point(e),e])
point.sort()
for i in range(len(point)) :
    print(point[i][1],abs(point[i][0]))

6531301721
# 1661733, 2022-10-29 09:34:16, PPPPP (100%)

data = [[1,'A','E','I','L','N','O','R','S','T','U'], [2,'D','G'], [3,'B','C','M','P'], [4,'F','H','V','W','Y'], [5,'K'], [8,'J','X'], [10,'Q','Z']]
words = input().split()
out = []
for i in range(len(words)):
    score = 0
    for j in range(len(words[i])):
        for k in range(len(data)):
            if words[i][j] in data[k]:
                score += data[k][0]
    out.append([words[i], score])
for i in range(len(out)):
    for j in range(len(out)-i-1):
        if out[i][1] < out[i+j+1][1]:
            out[i], out[i+j+1] = out[i+j+1], out[i]
        if out[i][1] == out[i+j+1][1]:
            if out[i][0] > out[i+j+1][0]:
                out[i], out[i+j+1] = out[i+j+1], out[i]
for l in out:
    print(l[0], l[1])


6531303021
# 1661424, 2022-10-29 09:24:04, PPPPP (100%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    point = [[1,'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'],[2,'D', 'G'],[3,'B', 'C', 'M', 'P'],[4,'F', 'H', 'V', 'W', 'Y'],[5,'K'],[8,'J', 'X'],[10,'Q', 'Z']]
    count = 0
    for i in c:
        for p in point:
            if i in p:count += p[0]
    return count
# def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
su = []
words = input().split()
for i in words:
    su.append([-letter_point(i),i])
su.sort()
for k in su:
    print(k[1],-k[0])

6531304621
# 1661710, 2022-10-29 09:33:04, PPPPP (100%)

inp = input()

point = {'A':1, 'E':1,'I':1, 'L':1,'N':1, 'O':1,'R':1, 'S':1,'T':1, \
    'U':1,'D':2, 'G':2,'B':3, 'C':3,'M':3, 'P':3,'F':4, 'H':4,'V':4, 'W':4,'Y':4,\
    'K':5,'J':8, 'X':8,'Q':10, 'Z':10}

word = inp.split()
l = []
for e in word:
    p = 0
    for ch in e:
        p += point[ch]
    l.append([-p,e])

for e in sorted(l):
    print(e[1] , -e[0])

6531305221
# 1661614, 2022-10-29 09:29:24, PPPPP (100%)

word = input().split()
y = []
x = []
lis = []
for i in word:
    amt = 0
    for j in i:
        if j in 'AEILNORSTU':
            amt += 1
        elif j in 'DG':
            amt += 2
        elif j in 'BCMP':
            amt += 3
        elif j in 'FHVWY':
            amt += 4
        elif j == 'K':
            amt += 5
        elif j in 'JX':
            amt += 8
        elif j in 'QZ':
            amt += 10
    y.append([amt, (str(i)+' '+str(amt))])

y.sort()
y.reverse()
for k in range(len(y)):
    if k == len(y)-1:
        if y[k][0] == y[k-1][0]:
            lis.append(y[k][1])
        else:
            x.append(y[k][1])
    elif y[k][0] == y[k+1][0]:
        lis.append(y[k][1])
    else:
        lis.append(y[k][1])
        for i in sorted(lis):
            x.append(i)
        lis = []
for i in sorted(lis):
    x.append(i)

for i in x:
    print(i)


6531308121
# 1661294, 2022-10-29 09:18:55, PPPPP (100%)

data = input().split()
s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
k = []
for word in data :
    score = 0
    for i in word :
        if i in s1 :
            score += 1
        elif i in s2 :
            score += 2
        elif i in s3 :
            score += 3
        elif i in s4 :
            score += 4
        elif i in s5 :
            score += 5
        elif i in s8 :
            score += 8
        elif i in s10 :
            score += 10
    k.append([-score,word])
for i in sorted(k) :
    print(i[1],str(-i[0]))

6531309821
# 1661303, 2022-10-29 09:19:28, PPPPP (100%)

#------------------------
def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
#--------------------------
def word_point(w):
    asum = 0
    for i in w:
        asum += letter_point(i)
    return asum
#------------------------------
words = input().split()
out = []

for i in words:
    score = word_point(i)
    out.append([-score,i])
out.sort()

for point,word in out:
    print(word, -point)

6531312621
# 1661402, 2022-10-29 09:23:16, PPPPP (100%)

point_1 = 'AEILNORSTU'
point_2 = 'DG'
point_3 = 'BCMP'
point_4 = 'FHVWY'
point_5 = 'K'
point_8 = 'JX'
point_10 = 'QZ'
s = input().split()
ans = []
for word in s:
    score = 0
    for e in word:
        if e in point_1:
            score += 1
        elif e in point_2:
            score += 2
        elif e in point_3:
             score += 3
        elif e in point_4:
            score += 4
        elif e in point_5:
            score += 5
        elif e in point_8:
            score += 8
        elif e in point_10:
            score += 10
    ans.append([-score,word])
for score,word in sorted(ans):
    print(word, -score)

6531314921
# 1663743, 2022-10-29 10:30:39, PPPPP (100%)

aa = input().split()
out_dict = []
for a in aa:
    b = []
    c = []
    for i in a:
        if i.lower() in "aeilnorstu":
            b.append([1, i])
        elif i.lower() in "dg":
            b.append([2, i])
        elif i.lower() in "bcmp":
            b.append([3, i])
        elif i.lower() in "fhvwy":
            b.append([4, i])
        elif i.lower() in "k":
            b.append([5, i])
        elif i.lower() in "jx":
            b.append([8, i])
        elif i.lower() in "qz":
            b.append([10, i])
    for i in b:
        c.append(i[0])
    out_dict.append({'WORD': a, 'SCORE': sum(c)})
for i in sorted(out_dict, key=lambda x: (-x['SCORE'], x['WORD'])):
    print(i['WORD'], i['SCORE'])

6531315521
# 1661899, 2022-10-29 09:40:22, PPPPP (100%)

# n1 = input()
# n2 = input()
# stri = input()

# f = open(n1,"r")

# for i in range(len(f)):
#   x = f.readline()
#   x.lower()
#   q = 0
#   c = 0
#   k = len(n2)
#   f = open(n1,"w")
#   while q != -1:
#     for i in range(k):
#       if n2[i] != '?':
#         q = x.find(n2[i].lower(),q)
#         if x[q+len(n2)-i+1] == '/':
#           x[q-c:q+len(n2)-i] = stri
#           #k = stri - n2
#       else:
#         c += 1
p1 = 'A, E, I, L, N, O, R, S, T, U'
p2 = 'D, G'
p3 = 'B, C, M, P'
p4 = 'F, H, V, W, Y'
p5 = 'K'
p8 = 'J, X'
p10 = 'Q, Z'
def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
  if c in p1:
    return 1
  elif c in p2:
    return 2
  elif c in p3:
    return 3
  elif c in p4:
    return 4
  elif c in p5:
    return 5
  elif c in p8:
    return 8
  elif c in p10:
    return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
  point = 0
  for e in w:
    if 'A' <= e <= 'Z':
      point += letter_point(e)
  return point


words = input().split()
d = {}
p = []
for x in words:
  if word_point(x) in d:
    d[word_point(x)].append(x)
  else:
    d[word_point(x)] = [x]
  if word_point(x) not in p:
    p.append(word_point(x))
p.sort()
p = p[-1::-1]

for k in d:
  if len(d[k]) > 1:
    d[k].sort()

for poi in p:
  if len(d[poi]) > 1:
    for w in d[poi]:
      print(w,poi)
  else:
    print(d[poi][0],poi)



6531316121
# 1661317, 2022-10-29 09:20:04, PPPPP (100%)

name_list = input().split()
l = []

for n in name_list:
    score = 0
    for a in n:
        if a in "AEILNORSTU":
            score += 1
        elif a in "DG":
            score += 2
        elif a in "BCMP":
            score += 3
        elif a in "FHVWY":
            score += 4
        elif a in "K":
            score += 5
        elif a in "JX":
            score += 8
        elif a in "QZ":
            score += 10
    l.append([-score,n])

l.sort()
for score,n in l:
    print(n,-score)

6531335021
# 1661967, 2022-10-29 09:42:56, PPPPP (100%)

def letter_point(c):
    c = c.upper()
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
    if c in "AEILNORSTU" :
        return 1
    elif c in "DG" :
        return 2
    elif c in "BCMP" :
        return 3 
    elif c in "FHVWY" :
        return 4
    elif c in "K" :
        return 5 
    elif c in "JX" :
        return 8
    elif c in "QZ" :
        return 10
def word_point(w) :
    point = 0
    for c in w :
        point += letter_point(c)
    return point
# คืนคะแนนของคําที่เก็บในตัวแปรwที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรในw ???
words = input().split()
outp = {}
for w in words :
    if -word_point(w) not in outp :
        outp[-word_point(w)] = {w.upper()}
    else :
        outp[-word_point(w)].add(w.upper())
for key,value in sorted(outp.items()) :
    value = sorted(value)
    for t in value :
        print(t+" "+str(-key))
        



6531337321
# 1661354, 2022-10-29 09:21:31, PPPPP (100%)

scores = [
    [1, 'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'],
    [2, 'D', 'G'],
    [3, 'B', 'C', 'M', 'P'],
    [4, 'F', 'H', 'V', 'W', 'Y'],
    [5, 'K'],
    [8, 'J', 'X'],
    [10, 'Q', 'Z']
]

def get_score(word):
    score = 0
    for c in word.upper():
        for p in scores:
            if c in p:
                score += p[0]
                break
    return word, score

words = input().split()
ans = []
for word in words:
    ans.append(get_score(word))
ans.sort()
ans.sort(key=lambda e:e[1], reverse=True)

for word in ans:
    print(word[0], word[1])

6531340121
# 1661348, 2022-10-29 09:21:21, PPPPP (100%)

def letter_point(s):
    p1 = 'AEILNORSTU'
    p2 = 'DG'
    p3 = 'BCMP'
    p4 = 'FHVWY'
    p5 = 'K'
    p8 = 'JX'
    p10 = "QZ"
    total = 0
    for e in s:
        if e in p1:
            total += 1
        elif e in p2:
            total += 2
        elif e in p3:
            total += 3
        elif e in p4:
            total += 4
        elif e in p5:
            total += 5
        elif e in p8:
            total += 8
        elif e in p10:
            total += 10
    return total
l0 = [e for e in input().split()]
l1 = [-letter_point(e) for e in l0]
l2 = []
for i in range(len(l0)):
    l2.append([l1[i],l0[i]])
l2.sort()
for i in range(len(l2)):
    print(l2[i][1],-l2[i][0])

6531341821
# 1661951, 2022-10-29 09:42:18, PPPPP (100%)

def letter_point(c):
    k=0
    for i in c:
        if i in['A','E','I','L','N','O','R','S','T','U']:
            k+=1
        elif i in ['D','G']:
            k+=2
        elif i in ['B','C','M','P']:
            k+=3
        elif i in ['F','H','V','W','Y']:
            k+=4
        elif i in ['K']:
            k+=5
        elif i in ['J','X']:
            k+=8
        elif i in ['Q','Z']:
            k+=10
        else:
            k+=0
    return k

new=[]
sortt=[]
newww=[]
words = input().split()
words.sort()
for i in words:
    new.append([letter_point(i),i])
neww=sorted(new)[::-1]
for i in range(len(neww)-1):
    if neww[i][0]==neww[i+1][0]:
        sortt.append(neww[i])
    else:
        sortt.append(neww[i])
        sortt.sort()
        for j in sortt:
            newww.append(j)
        sortt=[]
if neww[len(neww)-1][0]==neww[len(neww)-2][0]:
    sortt.append(neww[len(neww)-1])
    sortt.sort()
    for j in sortt:
            newww.append(j)
else:
    for j in sortt:
            newww.append(j)
    newww.append(neww[len(neww)-1])
for i in newww:
    print(i[1],i[0])
        
    


6531346021
# 1661307, 2022-10-29 09:19:38, PPPPP (100%)

l=input().split()
d={}
for i in l:
    s=0
    for j in i:
        if j in 'AEILNORSTU':
            s+=1
        elif j in 'DG':
            s+=2
        elif j in 'BCMP':
            s+=3
        elif j in 'FHVWY':
            s+=4
        elif j in 'K':
            s+=5
        elif j in 'JX':
            s+=8
        elif j in 'QZ':
            s+=10
    d[i]=s
l.sort()
def gs(x):
    return d[x]
for i in sorted(l,key=gs,reverse=True):
    print(i,d[i])


6532011921
# 1661277, 2022-10-29 09:18:15, PPPPP (100%)

chars = ['AEILNORSTU', 'DG', 'BCMP', 'FHVWY', 'K', 'JX', 'QZ']
score = [1,2,3,4,5,8,10]
char_score = {}
for i in range(len(chars)):
    for j in range(len(chars[i])):
        char_score[chars[i][j]] = score[i]
        
words = input().split()
res = []
for w in words:
    s = 0
    for i in range(len(w)):
        s += char_score[w[i]]
    res.append([-s, w])
res.sort()
for l in res:
    print(l[1], -l[0])

6532026321
# 1661266, 2022-10-29 09:17:36, PPPPP (100%)

p1 = "AEILNORSTU"
p2 = "DG"
p3 = "BCMP"
p4 = "FHVWY"
p5 = "K"
p8 = "JX"
p10 = "QZ"
def letter_point(c):
  if c in p1: return 1
  if c in p2: return 2
  if c in p3: return 3
  if c in p4: return 4
  if c in p5: return 5
  if c in p8: return 8
  if c in p10: return 10
def word_point(w):
  ans = 0
  for i in w:
    ans += letter_point(i)
  return ans

ans = []
words = input().split()
for i in words:
  ans.append([word_point(i), i])
for i in sorted(ans, key=lambda j: (-j[0], j[1])):
  print(i[1], i[0])

6532043021
# 1661793, 2022-10-29 09:37:06, PPPPP (100%)

score = [[],['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'],
['D','G'],['B','C','M','P'],['F','H','V','W','Y'],['K'],[],[],['J','X'],[],['Q','Z']]

a = input().split()
ans = []
word = []
cou=[]
for e in a:
    sum=0
    for k in e:
        for i in range(len(score)):
            if k in score[i]:
                sum+=i
    
    ans.append([sum,e])
    word.append([e,sum])
ans.sort()
word.sort()
ans = ans[-1::-1]

for e in ans:
    cou.append(e[0])
    counum=0
    for num in cou:
        if num==e[0]:
            counum+=1
    cnt=0

    for k in word:
        if(k[1]==e[0]):
            cnt+=1
        
        if(cnt==counum):
            print(k[0],e[0])
            break


6532084721
# 1662455, 2022-10-29 09:58:27, PPPPP (100%)

def p(c):
    if c in 'AEILNORSTU': return 1
    if c in 'DG':         return 2
    if c in 'BCMP':       return 3
    if c in 'FHVWY':      return 4
    if c in 'K':          return 5
    if c in 'JX':         return 8
    if c in 'QZ':         return 10

ans = list()
s = input().split()
for word in s:
    cnt = 0
    for j in range(len(word)):
        cnt += p(word[j])
    ans.append([cnt,word])

ans.sort(reverse = True)
ans.append([-1,0])
tmp = list()
for i in range(len(ans)-1):#ans[a][0]=cnt, ans[a][1] = word
    tmp.append([ans[i][1],ans[i][0]])
    if ans[i][0] != ans[i+1][0]:
        #print(ans[i][1])
        tmp.sort()
        for a,b in tmp:
            print(a,b,end='\n')
        tmp = []




6532092721
# 1661406, 2022-10-29 09:23:24, PPPPP (100%)

def createdic(dic) :
    for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" :
        if (c in "AEILNORSTU") :
            dic[c] = 1
        elif (c in "DG") :
            dic[c] = 2
        elif (c in "BCMP") :
            dic[c] = 3
        elif (c in "FHVWY") :
            dic[c] = 4
        elif (c in "K") :
            dic[c] = 5
        elif (c in "JX") :
            dic[c] = 8
        elif (c in "QZ") :
            dic[c] = 10

def cal_score(word,dic) :
    score = 0
    for c in word :
        score += dic[c]
    return score
words = input().split()
dic = {}
createdic(dic)
list_word = []
for word in words :
    cur_score = cal_score(word,dic)
    list_word.append([word,cur_score])
    
list_word.sort(key=lambda x : x[0])    
list_word.sort(key=lambda x : x[1] , reverse=True)

for ans in list_word :
    print("{} {}".format(ans[0] , ans[1]))


6532114921
# 1661598, 2022-10-29 09:28:56, PPPPP (100%)

d = dict()
d['AEILNORSTU'] = 1
d['DG'] = 2
d['BCMP'] = 3
d['FHVWY'] = 4
d['K'] = 5
d['JX'] = 8
d['QZ'] = 10
l = ['AEILNORSTU' ,'DG' ,'BCMP' ,'FHVWY','K' ,'JX' ,'QZ']
l1 = list()

x = input().split()
for e in x:
    ans = 0
    for e1 in e:
        for e2 in l:
            if e1 in e2:
                ans += d[e2]
    l1.append([-ans ,e])

l1.sort()
for e in l1:
    print(e[1] ,-e[0])

6532120621
# 1661369, 2022-10-29 09:22:03, PPPPP (100%)

s = """
1 A, E, I, L, N, O, R, S, T, U
2 D, G
3 B, C, M, P
4 F, H, V, W, Y
5 K
8 J, X
10 Q, Z
"""

m = {}

for line in s.split("\n"):
    line = line.replace(",", "")
    k, *v = line.split(" ")
    for x in v:
        m[x] = k

def one(word):
    s = 0
    for x in word:
        s += int(m[x])
    return s, word

words = input().split()

v = [one(word) for word in words]
v.sort(key=lambda x: (-x[0], x[1]))

for a, b in v:
    print(b, a)



6532124121
# 1661287, 2022-10-29 09:18:35, PPPPP (100%)

x = input().split()
l = []
for i in x:
    s = 0
    for c in i:
        if(c in "A, E, I, L, N, O, R, S, T, U"):
            s+=1
        elif(c in "D, G"):
            s+=2
        elif(c in "B, C, M, P"):
            s+=3
        elif(c in "F, H, V, W, Y"):
            s+=4
        elif(c in "K"):
            s+=5
        elif(c in "J, X"):
            s+=8
        elif(c in "Q, Z"):
            s+=10
    l.append([-s,i])
l.sort()
l = l[::]
for i in l:
    print(i[1],-i[0])

6532143021
# 1661370, 2022-10-29 09:22:03, PPPPP (100%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10

def word_point(w):
    s = 0
    for i in w:
        s += letter_point(i)
    return s

words = input().split() 
l = []
for i in words[::-1]:
    l.append([-word_point(i),i])

l.sort()
for i in l:
    print(i[1], -i[0])

# print('fsafsf')


6532152721
# 1661383, 2022-10-29 09:22:35, PPPPP (100%)

words = input().split()

score = [("AEILNORSTU", 1), ("DG", 2), ("BCMP", 3), ("FHVWY", 4), ("K", 5), ("JX", 8), ("QZ", 10)]

ans = []

for word in words:
    total = 0
    for c in word:
        for e in score:
            if c in e[0]:
                total += e[1]
    ans.append([-total, word])

ans = sorted(ans)

for total, word in ans:
    print(word, -total)


6532155621
# 1661387, 2022-10-29 09:22:39, PPPPP (100%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    assert len(c) == 1
    if c in "AEILNORSTU": return 1
    if c in "DG": return 2
    if c in "BCMP": return 3
    if c in "FHVWY": return 4
    if c in "K": return 5
    if c in "JX": return 8
    if c in "QZ": return 10

    raise RuntimeError


def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    return sum([letter_point(c) for c in w])

words = input().split()
ans = []
for word in words:
    ans.append([-1 * word_point(word), word])

ans.sort()
for score, word in ans:
    print(word, score*-1)


6532201821
# 1661349, 2022-10-29 09:21:22, PPPPP (100%)

s=['AEILNORSTU','DG','BCMP','FHVWY','K','JX','QZ']

str=input().strip().split()
anw=[]
for c in str:
    sum=0
    for i in c:
        for ind in range(len(s)):
            if i in s[ind] :
                if ind<5 : sum+=ind+1
                elif ind==5 : sum+=8
                elif ind==6 : sum+=10
    #print(sum)
    anw.append([-sum,c])
anw.sort()
for a,b in anw:
    print(b,-a)


6531101521
# 1661954, 2022-10-29 09:42:27, PPPPP (100%)

def letter_point(c):
        scores1 = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1}
        scores2 = {'D':2,'G':2}
        scores3 = {'B':3,'C':3,'M':3,'P':3}
        scores4 = {'F':4,'H':4,'V':4,'W':4,'Y':4}
        scores5 = {'K':5}
        scores8 = {'J':8,'X':8}
        scores10 = {'Q':10,'Z':10}
        if c in scores1: return scores1[c]
        elif c in scores2: return scores2[c]
        elif c in scores3: return scores3[c]
        elif c in scores4: return scores4[c]
        elif c in scores5: return scores5[c]
        elif c in scores8: return scores8[c]
        elif c in scores10: return scores10[c]            

def word_point(w):
    res = 0
    for lt in w:
        res += letter_point(lt)
    return res
    
words = input().split()
word = []
score = []
output = []
for i in words:
    word.append(i)
for i in words:
    score.append(word_point(i))
for e in range(len(word)):
    output.append([-score[e],word[e]])
final = sorted(output)
for x in final:
    print(x[1], -x[0])


6531103821
# 1661552, 2022-10-29 09:27:55, PPPPP (100%)

x = input().split()
s1 = "AEILNORSTU"
s2 = "DG"
s3 = "BCMP"
s4 = "FHVWY"
s5 = "K"
s8 = "JX"
s10 = "QZ"
s = 0
out = []
for k in x :
    for e in k :
        if e in s1 :
            s += 1
        elif e in s2 :
            s += 2
        elif e in s3 :
            s += 3
        elif e in s4 :
            s += 4
        elif e in s5 :
            s += 5
        elif e in s8 :
            s += 8
        elif e in s10 :
            s += 10
    out.append([-s,k])
    s = 0
out.sort()
for e in out:
    print(e[1],-e[0])

    





6531801121
# 1661551, 2022-10-29 09:27:50, PPPPP (100%)

words = input().split()

l_1 = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
p_1 = [1] * len(l_1)
l_2 = ["D", "G"]
p_2 = [2] * len(l_2)
l_3 = ["B", "C", "M", "P"]
p_3 = [3] * len(l_3)
l_4 = ["F", "H", "V", "W", "Y"]
p_4 = [4] * len(l_4)
l_5 = ["K"]
p_5 = [5] * len(l_5)
l_8 = ["J", "X"]
p_8 = [8] * len(l_8)
l_10 = ["Q", "Z"]
p_10 = [10] * len(l_10)

letters = l_1 + l_2 + l_3 + l_4 + l_5 + l_8 + l_10
points = p_1 + p_2 + p_3 + p_4 + p_5 + p_8 + p_10
total = 0
output_lst = list()
for word in words:
    for l in word:
        n = letters.index(l)
        total += points[n]
    output_lst.append([-total, word])
    total = 0
output = sorted(output_lst)
for e in output:
    print(e[1], -e[0])

Max Score = 80


6530087221
# 1661409, 2022-10-29 09:23:36, P---- (20%)

x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
for i in range(len(x)):
    print(x[i],score[i])
# 1663090, 2022-10-29 10:16:30, ----- (0%)

#case = QUEEN QUIET ZEBRA
x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
final = []
for i in range(len(x)):
    final += [[x[i],score[i]]]
high = [max(score)]
low = [min(score)]
total = []
for i in final :
    if i[1] >= max(score):
        total = i + total
    elif i[1] < max(score) and i[1] >= min(score):
        total = total + i
print(total)
    

    

            

    
# 1663182, 2022-10-29 10:19:08, PP-P- (60%)

#case = QUEEN QUIET ZEBRA
x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
final = []
for i in range(len(x)):
    final += [[x[i],score[i]]]
high = [max(score)]
low = [min(score)]
total = []
for i in final :
    if i[1] >= max(score):
        total = i + total
    elif i[1] < max(score) and i[1] >= min(score):
        total = total + i
for i in range(len(total)):
    if i%2 == 0 :
        print(total[i],total[i+1])
    

    

            

    
# 1663282, 2022-10-29 10:21:34, PPPP- (80%)

#case = QUEEN QUIET ZEBRA
x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
final = []
for i in range(len(x)):
    final += [[x[i],score[i]]]
low = []
total = []
for i in final :
    if i[1] >= max(score):
        total = i + total
    elif i[1] < max(score) and i[1] > min(score):
        total = total + i
    elif i[1] == min(score) :
        low += i
total += low
for i in range(len(total)):
    if i%2 == 0 :
        print(total[i],total[i+1])
    

    

            

    
# 1663323, 2022-10-29 10:22:32, PP--- (40%)

#case = QUEEN QUIET ZEBRA
x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
x.sort()
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
final = []
for i in range(len(x)):
    final += [[x[i],score[i]]]
low = []
total = []
for i in final :
    if i[1] >= max(score):
        total = i + total
    elif i[1] < max(score) and i[1] > min(score):
        total = total + i
    elif i[1] == min(score) :
        low += i
total += low
for i in range(len(total)):
    if i%2 == 0 :
        print(total[i],total[i+1])
    

    

            

    
# 1663371, 2022-10-29 10:23:29, PPPP- (80%)

#case = QUEEN QUIET ZEBRA
x = input().split()
s1 = ['A','E','I','L','N','O','R','S','T','U']
s2 = ['D','G']
s3 = ['B','C','M','P']
s4 = ['F','H','V','W','Y']
s5 = ['K']
s8 = ['J','X']
s10 = ['Q','Z']
score = []
for i in x :
    temp = 0
    for j in i:
        if j in s1 :
            temp += 1
        elif j in s2 :
            temp += 2
        elif j in s3 :
            temp += 3
        elif j in s4 :
            temp += 4
        elif j in s5 :
            temp += 5
        elif j in s8 :
            temp += 8
        elif j in s10 :
            temp += 10
    score += [temp]
final = []
for i in range(len(x)):
    final += [[x[i],score[i]]]
low = []
total = []
for i in final :
    if i[1] >= max(score):
        total = i + total
    elif i[1] < max(score) and i[1] > min(score):
        total = total + i
    elif i[1] == min(score) :
        low += i
total += low
for i in range(len(total)):
    if i%2 == 0 :
        print(total[i],total[i+1])

6530075721
# 1661281, 2022-10-29 09:18:22, PPPP- (80%)

all = []
for i in input().strip().split() :
    sc = 0
    for j in i :
        if j in 'AEILNORSTU' :
            sc += 1
        elif j in 'DG' :
            sc += 2
        elif j in 'BCMP' :
            sc += 3
        elif j in 'FHVWY' :
            sc += 4
        elif i == 'K' :
            sc += 5
        elif j in 'JX' :
            sc += 8
        elif j in 'QZ' :
            sc += 10
    all.append([-1*sc,i])
all.sort()
for i in all :
    print(i[1],-1*i[0])
# 1661310, 2022-10-29 09:19:43, PPPP- (80%)

all = []
for i in input().strip().split() :
    sc = 0
    for j in i :
        if j in 'AEILNORSTU' :
            sc += 1
        elif j in 'DG' :
            sc += 2
        elif j in 'BCMP' :
            sc += 3
        elif j in 'FHVWY' :
            sc += 4
        elif i == 'K' :
            sc += 5
        elif j in 'JX' :
            sc += 8
        elif j in 'QZ' :
            sc += 10
    all.append([-1*sc,i])
for i in sorted(all) :
    print(i[1],-1*i[0])
# 1663702, 2022-10-29 10:29:56, PPPP- (80%)

all = []
for i in input().split() :
    sc = 0
    for j in i :
        if j in 'A,E,I,L,N,O,R,S,T,U' :
            sc += 1
        elif j in 'D,G' :
            sc += 2
        elif j in 'B,C,M,P' :
            sc += 3
        elif j in 'F,H,V,W,Y' :
            sc += 4
        elif i == 'K' :
            sc += 5
        elif j in 'J,X' :
            sc += 8
        elif j in 'Q,Z' :
            sc += 10
    all.append([-1*sc,i])
for i in sorted(all) :
    print(i[1],-1*i[0])

# 1663741, 2022-10-29 10:30:38, -P-P- (40%)

all = []
for i in input().strip().split() :
    sc = 0
    for j in i :
        if j in 'AEILNORSTU' :
            sc += 0
        elif j in 'DG' :
            sc += 2
        elif j in 'BCMP' :
            sc += 3
        elif j in 'FHVWY' :
            sc += 4
        elif i == 'K' :
            sc += 5
        elif j in 'JX' :
            sc += 8
        elif j in 'QZ' :
            sc += 10
    all.append([-1*sc,i])
for i in sorted(all) :
    print(i[1],-1*i[0])
# 1663816, 2022-10-29 10:32:08, PPPP- (80%)

all = []
for i in input().split() :
    sc = 0
    for j in i :
        if not 'A'<=j<='Z' :
            pass
        elif j in 'A,E,I,L,N,O,R,S,T,U' :
            sc += 1
        elif j in 'D,G' :
            sc += 2
        elif j in 'B,C,M,P' :
            sc += 3
        elif j in 'F,H,V,W,Y' :
            sc += 4
        elif i == 'K' :
            sc += 5
        elif j in 'J,X' :
            sc += 8
        elif j in 'Q,Z' :
            sc += 10
    all.append([-1*sc,i])
for i in sorted(all) :
    print(i[1],-1*i[0])

6530187321
# 1661282, 2022-10-29 09:18:24, P---- (20%)

def letterpoint(x):
    if x in 'AEILNORSTU':
        c = 1
    elif x in 'DG': c = 2
    elif x in 'BCMP': c = 3
    elif x in 'FHVWY': c = 4
    elif x in'K': c = 5
    elif x in 'JX': c = 8
    else: c = 10
    return c
def wordpoint(x):
    c = 0
    for e in x:
        c += letterpoint(e)
    return c

words = input().split()
for e in words:
    print(e, wordpoint(e))
    
        
    

# 1663517, 2022-10-29 10:26:21, xPPP- (60%)

def letterpoint(x):
    if x in 'AEILNORSTU':
        c = 1
    elif x in 'DG': c = 2
    elif x in 'BCMP': c = 3
    elif x in 'FHVWY': c = 4
    elif x in'K': c = 5
    elif x in 'JX': c = 8
    else: c = 10
    return c
def wordpoint(x):
    c = 0
    for e in x:
        c += letterpoint(e)
    return c

words = input().split()
d = []
for e in words:
    d.append([wordpoint(e),e])
d = sorted(d)[::-1]
x = []
for i in range(len(d)-1):
    if d[i][0] == d[i+1][0]:
        x.append([d[i][1],d[i][0]])
    else:
        x.append([d[i][1],d[i][0]])
        x.sort()
        for e in x:
            print(e[0],e[1])
        x = []
if d[-1][0] == d[-2][0]:
    x.append([d[-1][1],d[-1][0]])
    for e in x:
        print(e[0],e[1])
else: print(d[-1][1],d[-1][0])
# 1663623, 2022-10-29 10:28:11, PPPP- (80%)

def letterpoint(x):
    if x in 'AEILNORSTU':
        c = 1
    elif x in 'DG': c = 2
    elif x in 'BCMP': c = 3
    elif x in 'FHVWY': c = 4
    elif x in'K': c = 5
    elif x in 'JX': c = 8
    else: c = 10
    return c
def wordpoint(x):
    c = 0
    for e in x:
        c += letterpoint(e)
    return c

words = input().split()
d = []
for e in words:
    d.append([wordpoint(e),e])
d = sorted(d)[::-1]
x = []
for i in range(len(d)-1):
    if d[i][0] == d[i+1][0]:
        x.append([d[i][1],d[i][0]])
    else:
        x.append([d[i][1],d[i][0]])
        x.sort()
        for e in x:
            print(e[0],e[1])
        x = []
if len(d) > 1:
    if d[-1][0] == d[-2][0]:
        x.append([d[-1][1],d[-1][0]])
        for e in x:
            print(e[0],e[1])
    else: print(d[-1][1],d[-1][0])
else:
    print(d[0][1],d[0][0])
        
            
    
        
    


6530040721
# 1661537, 2022-10-29 09:27:36, ----- (0%)

def letter_point(c):
    z1 = ('A E I L N O R S T U').split()
    z2 = ('D G').split()
    z3 = ('B C M P').split()
    z4 = ('F H V W Y').split()
    z5 = ('K').split()
    z6 = ('J X').split()
    z7 = ('Q Z').split()
    if c in z1:
        return 1
    elif c in z2:
        return 2
    elif c in z3:
        return 3
    elif c in z4:
        return 4
    elif c in z5:
        return 5
    elif c in z6:
        return 8
    elif c in z7:
        return 10
    return 0
    
def word_point(w):
    s = 0
    for i in w:
        s += letter_point(i)
    return s

words = input().split()
ss =[]
for e in words:
    n = 0
    n += word_point(e)
    ss += [(e,n)]
def check0(p):
    return p[1]

ss.sort(key = check0)

for d in range(len(ss)-1,0,-1):
    print(ss[d][0],ss[d][1])
# 1661589, 2022-10-29 09:28:46, PPPP- (80%)

def letter_point(c):
    z1 = ('A E I L N O R S T U').split()
    z2 = ('D G').split()
    z3 = ('B C M P').split()
    z4 = ('F H V W Y').split()
    z5 = ('K').split()
    z6 = ('J X').split()
    z7 = ('Q Z').split()
    if c in z1:
        return 1
    elif c in z2:
        return 2
    elif c in z3:
        return 3
    elif c in z4:
        return 4
    elif c in z5:
        return 5
    elif c in z6:
        return 8
    elif c in z7:
        return 10
    return 0
    
def word_point(w):
    s = 0
    for i in w:
        s += letter_point(i)
    return s

words = input().split()
ss =[]
for e in words:
    n = 0
    n += word_point(e)
    ss += [(e,n)]
def check0(p):
    return p[1]

ss.sort(key = check0)

for d in range(len(ss)-1,-1,-1):
    print(ss[d][0],ss[d][1])

6530012121
# 1661908, 2022-10-29 09:40:44, PPPP- (80%)

a = input().strip().split()
score = 0
ans =[]
for i in range(len(a)):
    for chr in a[i]:
        if chr in ['A','E','I','L','N','O','R','S','T','U']:
            score += 1
        elif chr in ['D','G']:
            score += 2
        elif chr in ['B','C','M','P']:
            score += 3
        elif chr in ['F','H','V','W','Y']:
            score += 4
        elif chr in ['K']:
            score += 5
        elif chr in ['J','X']:
            score += 8
        elif chr in ['Q','Z']:
            score += 10
    ans+=[[score,a[i].upper()]]
    score = 0
ans.sort()
ans.reverse()
answer =['']
points = ans[0][0]
k = 0
for i in range(len(ans)):
    if ans[i][0] == points:
        answer.insert(k,[ans[i][1], ans[i][0]])
    else:
        answer.insert(-1,[ans[i][1], ans[i][0]])
        points = ans[i][0]
        k+=1
del answer[-1]
for i in range(len(answer)):
    print(answer[i][0], answer[i][1])

Max Score = 60


6531343021
# 1662127, 2022-10-29 09:48:17, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1662880, 2022-10-29 10:11:23, PPP-- (60%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663102, 2022-10-29 10:16:53, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1]))
x = list()
for i in eachword:
    x.insert(0,[i, eachword[i]])
for i in x:
    print(i[0], i[1])
# 1663130, 2022-10-29 10:17:50, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1]))
x = list()
for i in eachword:
    x.insert(0,[i, eachword[i]])
for i in x:
    print(i[0], i[1])
# 1663149, 2022-10-29 10:18:19, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663161, 2022-10-29 10:18:39, P-P-- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663165, 2022-10-29 10:18:47, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663169, 2022-10-29 10:18:50, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663173, 2022-10-29 10:18:54, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663176, 2022-10-29 10:18:57, PPP-- (60%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663329, 2022-10-29 10:22:40, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663333, 2022-10-29 10:22:43, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663338, 2022-10-29 10:22:47, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663340, 2022-10-29 10:22:50, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663345, 2022-10-29 10:22:53, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663348, 2022-10-29 10:22:57, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663351, 2022-10-29 10:23:00, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663353, 2022-10-29 10:23:04, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663356, 2022-10-29 10:23:07, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663358, 2022-10-29 10:23:11, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663363, 2022-10-29 10:23:14, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663365, 2022-10-29 10:23:17, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663368, 2022-10-29 10:23:23, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    else:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663403, 2022-10-29 10:24:04, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663424, 2022-10-29 10:24:31, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663427, 2022-10-29 10:24:35, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663429, 2022-10-29 10:24:38, PP--- (40%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663438, 2022-10-29 10:24:41, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663441, 2022-10-29 10:24:49, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663444, 2022-10-29 10:24:53, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c == 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663465, 2022-10-29 10:25:21, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663468, 2022-10-29 10:25:24, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663492, 2022-10-29 10:25:45, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663496, 2022-10-29 10:25:50, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663498, 2022-10-29 10:25:53, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663501, 2022-10-29 10:25:57, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663503, 2022-10-29 10:26:00, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663509, 2022-10-29 10:26:07, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663513, 2022-10-29 10:26:11, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663514, 2022-10-29 10:26:14, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663515, 2022-10-29 10:26:17, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663516, 2022-10-29 10:26:20, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663522, 2022-10-29 10:26:24, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663524, 2022-10-29 10:26:27, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663527, 2022-10-29 10:26:30, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663531, 2022-10-29 10:26:35, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663532, 2022-10-29 10:26:38, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663537, 2022-10-29 10:26:41, P---- (20%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663544, 2022-10-29 10:26:44, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663547, 2022-10-29 10:26:48, PP--- (40%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])
# 1663551, 2022-10-29 10:26:52, PPP-- (60%)

def letter_point(c):
    point1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    point2 = ['D', 'G']
    point3 = ['B', 'C', 'M', 'P']
    point4 = ['F', 'H', 'V', 'W', 'Y']
    point5 = ['K']
    point8 = ['J', 'X']
    point10 = ['Q', 'Z']
    if c in point1:
        return 1
    elif c in point2:
        return 2
    elif c in point3:
        return 3
    elif c in point4:
        return 4
    elif c in point5:
        return 5
    elif c in point8:
        return 8
    elif c in point10:
        return 10
def word_point(w):
    point = 0
    for c in w:
        point += letter_point(c)
    return point
words = sorted(input().split())
eachword = dict()
for w in words:
    eachword[w] = word_point(w)
eachword = dict(sorted(eachword.items(), key = lambda x:x[1], reverse = True))
for i in eachword:
    print(i, eachword[i])

6431013921
# 1661257, 2022-10-29 09:17:07, P---- (20%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append(total)

for inx in range(len(words)):
    print(words[inx], result[inx])

# 1662177, 2022-10-29 09:49:51, P---- (20%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort()

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])
# 1662245, 2022-10-29 09:51:41, P---- (20%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort()

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])
# 1662512, 2022-10-29 10:00:12, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort(reverse = True)

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])

# 1662578, 2022-10-29 10:02:24, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort(reverse = True)
for inx in range(len(result)-1):
    if result[inx][0] == result[inx+1][0]:
        result[inx][1], result[inx+1][1] = result[inx+1][1], result[inx][1]

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])

# 1663235, 2022-10-29 10:20:13, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
result.sort(reverse = True)
for inx in range(len(result)-1):
    sorter = []
    if result[inx][0] == result[inx+1][0]:
        sorter = [result[inx][1], result[inx+1][1]]
        sorter.sort()
        result[inx][1] = sorter[0]
        result[inx+1][1] = sorter[1]

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])
# 1663687, 2022-10-29 10:29:38, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE"]

resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    resultrev.append([word, total])

resultrev.sort()
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1663701, 2022-10-29 10:29:54, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1663707, 2022-10-29 10:30:03, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort(reverse = True)
for inx in range(len(result)-1):
    if result[inx][0] == result[inx+1][0]:
        result[inx][1], result[inx+1][1] = result[inx+1][1], result[inx][1]

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])
# 1663857, 2022-10-29 10:32:57, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1663870, 2022-10-29 10:33:10, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort(reverse = True)
for inx in range(len(result)-1):
    if result[inx][0] == result[inx+1][0]:
        result[inx][1], result[inx+1][1] = result[inx+1][1], result[inx][1]

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])
# 1663991, 2022-10-29 10:35:02, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
c = 0
while c != len(resultrev):
    for inx in range(len(resultrev)-1):
        if resultrev[inx][0] < resultrev[inx+1][0]:
            resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
    c += 1

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1664009, 2022-10-29 10:35:16, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
c = 0
while c != len(resultrev):
    for inx in range(len(resultrev)-1):
        if resultrev[inx][0] < resultrev[inx+1][0]:
            resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
    c += 1

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1664050, 2022-10-29 10:35:52, TTTTT (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
c = 0
while c != len(resultrev):
    for inx in range(len(resultrev)-1):
      if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
      c += 1

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])
# 1664100, 2022-10-29 10:36:38, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
c = 0
while c != len(resultrev):
    for inx in range(len(resultrev)-1):
        if resultrev[inx][0] < resultrev[inx+1][0]:
            resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]
    c += 1

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])

# 1664140, 2022-10-29 10:37:08, ----- (0%)

words = ["QUITE", "QUEEN", "QUEER", "COMMUTE", "ZEBRA"]

result = []
resultrev = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
    resultrev.append([word, total])

resultrev.sort()
result.sort(reverse = True)
for inx in range(len(resultrev)):
    resultrev[inx][0], resultrev[inx][1] = resultrev[inx][1], resultrev[inx][0]
for inx in range(len(resultrev)-1):
    if resultrev[inx][0] < resultrev[inx+1][0]:
        resultrev[inx], resultrev[inx+1] = resultrev[inx+1], resultrev[inx]

for inx in range(len(resultrev)):
    print(resultrev[inx][1], resultrev[inx][0])
# 1664156, 2022-10-29 10:37:22, PPP-- (60%)

words = input().split()

result = []
for word in words:
    total = 0
    for char in word:
        if char in "AEILNORSTU":
            total += 1
        elif char in "DG":
            total += 2
        elif char in "BCMP":
            total += 3
        elif char in "FHVWY":
            total += 4
        elif char in "K":
            total += 5
        elif char in "JX":
            total += 8
        elif char in "QZ":
            total += 10
    result.append([total, word])
     
result.sort(reverse = True)
for inx in range(len(result)-1):
    if result[inx][0] == result[inx+1][0]:
        result[inx][1], result[inx+1][1] = result[inx+1][1], result[inx][1]

for inx in range(len(result)):
    print(result[inx][1], result[inx][0])

6530146621
# 1661454, 2022-10-29 09:25:03, xxxxx (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return k

#def word_point(w):

words = input().split()
for i in word:
    print(words, letter_point(i))
# 1661506, 2022-10-29 09:26:23, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return k

#def word_point(w):

words = input().split()
for i in words:
    print(words, letter_point(i))
# 1662320, 2022-10-29 09:54:14, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return k

words = input().split()
words.sort()
for i in words:
    
    print(words, letter_point(i))

# 1662504, 2022-10-29 09:59:53, P---- (20%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
for i in words:
    for e in range(len(words)):
        print(words[e], letter_point(i))

# 1663045, 2022-10-29 10:15:41, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
ans = []
for i in words:
    ans.append(letter_point(i))
for e in range(len(words)):
    ans.insert(0,words[e])
print(ans)

# 1663056, 2022-10-29 10:15:49, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
ans = []
for i in words:
    ans.append(letter_point(i))
for e in range(len(words)):
    ans.insert(0,words[e])
print(ans)

# 1663068, 2022-10-29 10:16:00, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return k

words = input().split()
words.sort()
for i in words:
    
    print(words, letter_point(i))
# 1663457, 2022-10-29 10:25:09, PP-P- (60%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
ans = []
for i in words:
    ans.append(letter_point(i))
for e in range(len(words)):
    ans.insert(0,words[e])
for i in words:
    print(i,letter_point(i))

# 1664074, 2022-10-29 10:36:07, xxxxx (0%)

oone = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
w = []
p = []
for i in words:
    w.append(i)
    w.sort()
    p.append(letter_point(i))
    p.sort()
for i in w:
    z = w.index(i)
    print(w[z],p[z])

# 1664193, 2022-10-29 10:37:53, PP--- (40%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
w = []
p = []
for i in words:
    w.append(i)
    w.sort()
    p.append(letter_point(i))
    p.sort()
for i in w:
    z = w.index(i)
    print(w[z],p[z])

# 1664217, 2022-10-29 10:38:05, PP--- (40%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
w = []
p = []
for i in words:
    w.append(i)
    w.sort()
    p.append(letter_point(i))
    p.sort()
for i in w:
    z = w.index(i)
    print(w[-z],p[-z])

# 1664251, 2022-10-29 10:38:28, ----- (0%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
w = []
p = []
for i in words:
    w.append(i)
    w.sort()
    p.append(letter_point(i))
    p.sort()
for i in w:
    z = w.index(i)
    print(w[-z:],p[-z:])
# 1664282, 2022-10-29 10:38:45, PP--- (40%)

one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
def letter_point(c):
    k = 0
    for e in c:
        if e in one: k+=1
        elif e in two: k+=2
        elif e in three: k+=3
        elif e in four: k+=4
        elif e in five: k+=5
        elif e in eight: k+=8
        else: k+=10
    return str(k)

words = input().split()
words.sort()
w = []
p = []
for i in words:
    w.append(i)
    w.sort()
    p.append(letter_point(i))
    p.sort()
for i in w:
    z = w.index(i)
    print(w[-z],p[-z])

6231715621
# 1661622, 2022-10-29 09:29:46, ----- (0%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse =True)



# 1661661, 2022-10-29 09:31:01, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse =True)

for i in out:
    print(i[0],i[1])

# 1661851, 2022-10-29 09:39:09, PPP-- (60%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([c,i])
out.sort(reverse =True)
for i in range(len(out)-1):
    if out[i][0] == out[i+1][0]:
        out[i][1],out[i+1][1] = out[i+1][1],out[i][1]


for i in out:
    print(i[1],i[0])

# 1663038, 2022-10-29 10:15:36, PP-P- (60%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i] > out[i+1] :
            out[i],out[i+1] = out[i+1],out[i]

# result = []
# for i in range(len(out):
    
    
        
    
for i in out:
    print(i[0],i[1])

# 1663213, 2022-10-29 10:19:44, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

# for k in range(len(out)-1) :
#     for i in range(len(out)-1) :
#         if out[i] > out[i+1] :
#             out[i],out[i+1] = out[i+1],out[i]

# result = []
# for i in range(len(out):

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i][0] < out[i+1][0] \
        or (out[i][0]==out[i+1][0] \
        and out[i][1]>out[i+1][1]) :
            out[i],d1[i+1] = out[i+1],out[i]
    
        
    
for i in out:
    print(i[0],i[1])

# 1663237, 2022-10-29 10:20:14, PP-P- (60%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i] > out[i+1] :
            out[i],out[i+1] = out[i+1],out[i]

# result = []
# for i in range(len(out):


    
        
    
for i in out:
    print(i[0],i[1])
# 1663366, 2022-10-29 10:23:18, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i] > out[i+1] :
            out[i],out[i+1] = out[i+1],out[i]

out[0],out[-1] = out[-1],out[0]

    
        
    
for i in out:
    print(i[0],i[1])

# 1663386, 2022-10-29 10:23:45, PP-P- (60%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i] > out[i+1] :
            out[i],out[i+1] = out[i+1],out[i]


    
        
    
for i in out:
    print(i[0],i[1])

# 1664595, 2022-10-29 10:41:25, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for i in range(len(out)-1):
    for i in range(len(out)-1):
        if out[i][1] > out[i+1][1] or (out[i][0]==out[i+1][0] and (out[i][0] < out[i+1][0])):
            out[i],out[i+1] = out[i+1],out[i]
        

    
for i in out:
    print(i[0],i[1])

# 1664614, 2022-10-29 10:41:35, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)


        

    
for i in out:
    print(i[0],i[1])
# 1664635, 2022-10-29 10:41:53, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for i in range(len(out)-1):
    for i in range(len(out)-1):
        if out[i][1] > out[i+1][1] or (out[i][0]==out[i+1][0] and (out[i][0] < out[i+1][0])):
            out[i],out[i+1] = out[i+1],out[i]
        

    
for i in out:
    print(i[0],i[1])

# 1664647, 2022-10-29 10:42:02, P---- (20%)

words = input().split()
out = []
for i in words:
    c = 0
    for e in i:
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c +=2
        elif e in 'BCMP':
            c +=3
        elif e in 'FHVWY':
            c +=4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    out.append([i,c])
out.sort(reverse = True)

for k in range(len(out)-1) :
    for i in range(len(out)-1) :
        if out[i] > out[i+1] :
            out[i],out[i+1] = out[i+1],out[i]

out[0],out[-1] = out[-1],out[0]

    
        
    
for i in out:
    print(i[0],i[1])

6530119721
# 1662131, 2022-10-29 09:48:25, compilation error (0%)

C = 0
    for e in c:
        if e in "AEILNORSTU":
            C += 1
        if e in "DG":
            C += 2
        if e in "BCMP":
            C += 3
        if e in "FHVWY":
            C += 4
        if e in "K":
            C += 5
        if e in "JX":
            C += 8
        if e in "QZ":
            C += 10
    return C
# 1662138, 2022-10-29 09:48:43, ----- (0%)

def letter_point(c):
    C = 0
    for e in c:
        if e in "AEILNORSTU":
            C += 1
        if e in "DG":
            C += 2
        if e in "BCMP":
            C += 3
        if e in "FHVWY":
            C += 4
        if e in "K":
            C += 5
        if e in "JX":
            C += 8
        if e in "QZ":
            C += 10
    return C
# 1662170, 2022-10-29 09:49:45, xxxxx (0%)

def letter_point(c):
    C = 0
    for e in c:
        if e in "AEILNORSTU":
            C += 1
        if e in "DG":
            C += 2
        if e in "BCMP":
            C += 3
        if e in "FHVWY":
            C += 4
        if e in "K":
            C += 5
        if e in "JX":
            C += 8
        if e in "QZ":
            C += 10
    return C
print(c + " " + letter_point(c))
# 1663175, 2022-10-29 10:18:55, P---- (20%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = ["0"]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
for i in range(len(point)):
    print(x[i] + " " + str(point[i]))


# 1663523, 2022-10-29 10:26:25, P---- (20%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
point = point[::-1]
    
for i in range(len(point)):
    print(x[i] + " " + str(point[i]))


# 1663714, 2022-10-29 10:30:14, PP-P- (60%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
point = point[::-1]
x.sort()
for i in range(len(point)):
    print(x[i] + " " + str(point[i]))
# 1663735, 2022-10-29 10:30:34, P---- (20%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
x.sort()

for i in range(len(point)):
    print(x[i] + " " + str(point[i]))
# 1663747, 2022-10-29 10:30:44, PP-P- (60%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
point = point[::-1]
x.sort()
for i in range(len(point)):
    print(x[i] + " " + str(point[i]))
# 1664078, 2022-10-29 10:36:10, ----- (0%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
point = point[::-1]
x.sort()
for i in range(len(point)-1):
    print(x[i] + " " + str(point[i]))
# 1664089, 2022-10-29 10:36:19, PP-P- (60%)

words = input().split()
def word_point(w):
    C = 0
    for e in w:
        if e in "AEILNORSTU":
            C += 1
        elif e in "DG":
            C += 2
        elif e in "BCMP":
            C += 3
        elif e in "FHVWY":
            C += 4
        elif e in "K":
            C += 5
        elif e in "JX":
            C += 8
        elif e in "QZ":
            C += 10
    return C
 
x = words
point = [""]*len(x)  
for i in range(len(words)):
    point[i] = word_point(words[i])
    
point.sort()
point = point[::-1]
x.sort()
for i in range(len(point)):
    print(x[i] + " " + str(point[i]))

6530200821
# 1661649, 2022-10-29 09:30:44, P---- (20%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
else:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
print(word, count)
# 1662036, 2022-10-29 09:45:13, xxxxx (0%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
else:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
for e in sorted(jerry)[ : :-1]:
    print(jerry[e][1], jerry[e][2])
# 1662295, 2022-10-29 09:53:25, ----- (0%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
else:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
jerry.sort()
jerry=jerry[ : :-1]
for i in range(len(jerry)):
    print(jerry[i][1], jerry[i][0])
# 1662411, 2022-10-29 09:57:19, ----- (0%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
# else:
#     for i in word:
#         for ch in i:
#             if ch in one:
#                 count+=1
#             elif ch in two:
#                 count+=2
#             elif ch in three:
#                 count+=3
#             elif ch in four:
#                 count+=4
#             elif ch in five:
#                 count+=5
#             elif ch in eight:
#                 count+=8
#             elif ch in ten:
#                 count+=10
#         jerry.append([count,i])
jerry.sort()
jerry=jerry[ : :-1]
for i in range(len(jerry)):
    print(jerry[i][1], jerry[i][0])
# 1662476, 2022-10-29 09:59:04, -PP-- (40%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
# else:
#     for i in word:
#         for ch in i:
#             if ch in one:
#                 count+=1
#             elif ch in two:
#                 count+=2
#             elif ch in three:
#                 count+=3
#             elif ch in four:
#                 count+=4
#             elif ch in five:
#                 count+=5
#             elif ch in eight:
#                 count+=8
#             elif ch in ten:
#                 count+=10
#         jerry.append([count,i])
jerry.sort()
jerry=jerry[ : :-1]
for i in range(len(jerry)):
    print(jerry[i][1], jerry[i][0])
    
    
    
    

# 1662550, 2022-10-29 10:01:27, compilation error (0%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
    else:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
jerry.sort()
jerry=jerry[ : :-1]
for i in range(len(jerry)):
    print(jerry[i][1], jerry[i][0])
# 1662592, 2022-10-29 10:02:48, ----- (0%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
    else:
        for i in word:
            for ch in i:
                if ch in one:
                    count+=1
                elif ch in two:
                    count+=2
                elif ch in three:
                    count+=3
                elif ch in four:
                    count+=4
                elif ch in five:
                    count+=5
                elif ch in eight:
                    count+=8
                elif ch in ten:
                    count+=10
            jerry.append([count,i])
            count=0
jerry.sort()
jerry=jerry[ : :-1]
for i in range(len(jerry)):
    print(jerry[i][1], jerry[i][0])
# 1662815, 2022-10-29 10:09:22, P---- (20%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
    jerry.sort()
    jerry=jerry[ : :-1]
    for i in range(len(jerry)):
        print(jerry[i][1], jerry[i][0])
if ' ' not in word:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
    print(word, count)    
    


# 1664425, 2022-10-29 10:40:03, PPP-- (60%)

word=input()
count=0
one=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two=['D', 'G']
three=['B', 'C', 'M', 'P']
four=['F', 'H', 'V', 'W', 'Y']
five=['k']
eight=['J', 'X']
ten=['Q', 'Z']
jerry=[]
if ' ' in word:
    word=word.split()
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
        jerry.append([count,i])
        count=0
    jerry.sort()
    jerry=jerry[ : :-1]
    for i in range(len(jerry)):
        print(jerry[i][1], jerry[i][0])
else:
    for i in word:
        for ch in i:
            if ch in one:
                count+=1
            elif ch in two:
                count+=2
            elif ch in three:
                count+=3
            elif ch in four:
                count+=4
            elif ch in five:
                count+=5
            elif ch in eight:
                count+=8
            elif ch in ten:
                count+=10
    print(word, count)    
    

6530020121
# 1661587, 2022-10-29 09:28:40, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split()
for i in words:
    print(i, word_point(i))

# 1661595, 2022-10-29 09:28:51, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y']:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().split()
for i in words:
    print(i, word_point(i))
# 1661624, 2022-10-29 09:29:57, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().upper().split()
for i in words:
    print(i, word_point(i))

# 1661628, 2022-10-29 09:30:05, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y']:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().upper().split()
for i in words:
    print(i, word_point(i))
# 1661692, 2022-10-29 09:32:29, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().upper().split()
words.sort()
words = words[::-1]
for i in words:
    print(i, word_point(i))

# 1661713, 2022-10-29 09:33:08, P---- (20%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().strip().upper().split()
words.sort()
words = words[::-1]
for i in words:
    print(i, word_point(i))
# 1661819, 2022-10-29 09:38:11, PPP-- (60%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().upper().split()
disc = []
words.sort()
words = words[::-1]
for i in words:
    disc.append([word_point(i),i])
    disc.sort()
    disc = disc[::-1]
for i in range(len(disc)):
    print(disc[i][1], disc[i][0])

# 1661957, 2022-10-29 09:42:36, PPP-- (60%)

def letter_point(c):
    point = 0
    if c in 'AEILNORSTU':
        point = 1
    elif c in 'DG':
        point = 2
    elif c in 'BCMP':
        point = 3
    elif c in ['F','H','V','W','Y'
]:
        point = 4
    elif c in ['J','X']:
        point = 8
    elif c in ['Q','Z']:
        point = 10
    return point
    
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    tt_point = 0
    for k in range(len(w)):
        tt_point += letter_point(w[k])
    return tt_point
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w

words = input().upper().split()
disc = []
words.sort()

for i in words:
    disc.append([word_point(i),i])
    disc.sort()
    disc = disc[::-1]
for i in range(len(disc)):
    print(disc[i][1], disc[i][0])

6530089521
# 1661582, 2022-10-29 09:28:32, P---- (20%)

def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='k':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
for j in range (len(words)):
    print(words[j],scrabble(words[j]))

# 1661655, 2022-10-29 09:30:50, PP--- (40%)

def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='k':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
words.reverse()
for j in range (len(words)):
    print(words[j],scrabble(words[j]))

# 1661804, 2022-10-29 09:37:40, PP--- (40%)

def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='k':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
words.reverse()
for j in range (len(words)):
    print(words[j],scrabble(words[j]))
# 1661812, 2022-10-29 09:37:58, PPP-- (60%)

def com(x):
    return x[1]
def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='k':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
a=[]
for j in range (len(words)):
    a.append([words[j],scrabble(words[j])])
a.sort(key=com,reverse=True)
for i in a:
    print(i[0],i[1])
# 1661918, 2022-10-29 09:41:02, PPP-- (60%)

def com(x):
    return x[1]
def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='K':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
a=[]
for j in range (len(words)):
    a.append([words[j],scrabble(words[j])])
a.sort(key=com,reverse=True)
for i in a:
    print(i[0],i[1])
# 1661950, 2022-10-29 09:42:17, PP--- (40%)

def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='K':all+=5
        elif i.upper() in 'JX': all+=8
        elif i.upper() in 'QZ': all+=10
    return all
words = input().split()
words.reverse()
for j in range (len(words)):
    print(words[j],scrabble(words[j]))

# 1661981, 2022-10-29 09:43:20, PPP-- (60%)

def com(x):
    return x[1]
def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='K':all+=5
        elif i.upper() in 'JX': all+=8
        else: all+=10
    return all
words = input().split()
a=[]
for j in range (len(words)):
    a.append([words[j],scrabble(words[j])])
a.sort(key=com,reverse=True)
for i in a:
    print(i[0],i[1])

# 1662012, 2022-10-29 09:44:26, PPP-- (60%)

def com(x):
    return x[1]
def scrabble(x):
    all=0
    for i in x:
        if i.upper() in 'AEILNORSTU':all+=1
        elif i.upper() in 'DG': all+=2
        elif i.upper() in 'BCMP':all+=3
        elif i.upper() in 'FHVWY':all+=4
        elif i.upper() =='K':all+=5
        elif i.upper() in 'JX': all+=8
        elif i.upper() in 'QZ': all+=10
    return all
words = input().split()
a=[]
for j in range (len(words)):
    a.append([words[j],scrabble(words[j])])
a.sort(key=com,reverse=True)
for i in a:
    print(i[0],i[1])


6431416121
# 1662067, 2022-10-29 09:46:10, ----- (0%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort()
for y in range(len(ans)-1,0,-1) :
    print(ans[y][0],ans[y][1])
    


# 1662096, 2022-10-29 09:47:05, ----- (0%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort()
for y in range(len(ans)-1,0,-1) :
    print(ans[y][1], ans[y][0])
    


# 1662104, 2022-10-29 09:47:24, ----- (0%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort()
for y in range(len(ans)-1,0,-1) :
    print(ans[y][1], ans[y][0])
# 1662223, 2022-10-29 09:51:04, PPP-- (60%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort(reverse = True)
for y in range(len(ans)) :
    print(ans[y][1], ans[y][0])
    


# 1663178, 2022-10-29 10:19:00, xP--- (20%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort(reverse = True)
m = max(ans)
mi = min(ans)
print(m[1],m[0])
ans.pop(0)
ans.pop(-1)
ans.sort()
for y in range(len(ans)) :
    print(ans[y][1], ans[y][0])
print(mi[1],mi[0])
    


# 1663193, 2022-10-29 10:19:25, xP--- (20%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort(reverse = True)
m = max(ans)
mi = min(ans)
print(m[1],m[0])
ans.pop(0)
ans.pop(-1)
ans.sort()
for y in range(len(ans)) :
    print(ans[y][1], ans[y][0])
print(mi[1],mi[0])
    


# 1663214, 2022-10-29 10:19:45, PPP-- (60%)

x = input().split()
point = []
for k in range(len(x)) :
    s = 0
    for i in range(len(x[k])) :
        if x[k][i] in 'AEILNORSTU' :
            s += 1
        elif x[k][i] in 'DG' :
            s += 2
        elif x[k][i] in 'BCMP' :
            s += 3
        elif x[k][i] in 'FHVWY' :
            s += 4
        elif x[k][i] in 'K' :
            s += 5
        elif x[k][i] in 'JX' :
            s += 8
        elif x[k][i] in 'QZ' :
            s += 10
        else :
            s += 0
    point.append(s)

ans = []
for u in range(len(x)) :
    add = []
    add.append(point[u])
    add.append(x[u])
    ans.append(add)
ans.sort(reverse = True)
for y in range(len(ans)) :
    print(ans[y][1], ans[y][0])

    




6530052221
# 1661536, 2022-10-29 09:27:35, P---- (20%)

words = input().split()
point = 0
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
    print(e," ",point)
# 1661606, 2022-10-29 09:29:15, P---- (20%)

words = input().split()
point = 0
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
    print(e," ",point)
    point = 0
# 1661629, 2022-10-29 09:30:05, P---- (20%)

words = input().split()
point = 0
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
    print(e," ",point)
    point = 0
# 1661852, 2022-10-29 09:39:10, P---- (20%)

words = input().split()
point = 0
l = []
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
    l.append([point,e])
    point = 0
l.sort()
for i in range(len(l)):
    print(l[i][1]," ",l[i][0])
# 1662584, 2022-10-29 10:02:36, PPP-- (60%)

words = input().split()
point = 0
l = []
d = {}
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
    l.append([point,e])
    point = 0
l.sort()
l = l[len(l)::-1]
for i in range(len(l)):
    print(l[i][1]," ",l[i][0])
# 1662646, 2022-10-29 10:04:37, PPP-- (60%)

words = input().split()
point = 0
l = []
d = {}
for e in words:
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
                                else:
                                    point += 0
    l.append([point,e])
    point = 0
l.sort()
l = l[len(l)::-1]
for i in range(len(l)):
    print(l[i][1]," ",l[i][0])
# 1662693, 2022-10-29 10:05:57, PPP-- (60%)

words = input().split()
point = 0
l = []
d = {}
for e in words:
    point = 0
    for c in e:
        if c == "A" or c == "E" or c == "I" or c == "L" or c == "N" or c == "O" or c == "R" or c == "S" or c == "T" or c == "U":
            point += 1
        else:
            if c == "D" or c == "G":
                point += 2
            else:
                if c == "B" or c == "C" or c == "M" or c == "P":
                    point += 3
                else:
                    if c == "F" or c == "H" or c == "V" or c == "W" or c == "Y":
                        point += 4
                    else:
                        if c == "K" :
                            point += 5
                        else:
                            if c == "J" or c == "X":
                                point += 8
                            else:
                                if c == "Q" or c == "Z":
                                    point += 10
                                else:
                                    point += 0
    l.append([point,e])
l.sort()
l = l[len(l)::-1]
for i in range(len(l)):
    print(l[i][1]," ",l[i][0])

6431804021
# 1661376, 2022-10-29 09:22:08, P---- (20%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
for i in range(len(x)):
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    print(x[i],str(n))
    n = 0

# 1661748, 2022-10-29 09:35:00, P---- (20%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
sc = {}
z = []
for i in range(len(x)) :
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    sc[n] = x[i]
    z.append(n)
    n = 0
z.sort()

for i in range(len(z)):
    print(sc[z[i]], z[i])
# 1663445, 2022-10-29 10:24:54, PPP-- (60%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
sc = {}
z = []
for i in range(len(x)) :
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    sc[n] = x[i]
    z.append(n)
    n = 0
z.sort()
z.reverse()

for i in range(len(z)):
    print(sc[z[i]], z[i])
# 1664030, 2022-10-29 10:35:36, P---- (20%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
sc = {}
z = []
for i in range(len(x)) :
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    sc[n] = x[i]
    z.append(n)
    n = 0
z.sort()
z.reverse()

for i in range(len(z)):
    print(x[i], z[i])
# 1664038, 2022-10-29 10:35:42, P---- (20%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
sc = {}
z = []
for i in range(len(x)) :
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    sc[n] = x[i]
    z.append(n)
    n = 0
z.sort()
z.reverse()

for i in range(len(z)):
    print(x[i], z[i])
# 1664067, 2022-10-29 10:36:01, PPP-- (60%)

l1 = 'AEILNORSTU'
l2 = 'DG'

l3 = 'BCMP'
l4 = 'FHVWY'
l5 = 'K'
l8 = 'JX'
l10 = 'QZ'

x = input().split()
n = 0
sc = {}
z = []
for i in range(len(x)) :
    for e in range(len(x[i])) :
        if x[i][e] in l1 :
            n += 1
        elif x[i][e] in l2 :
            n += 2
        elif x[i][e] in l3 :
            n += 3
        elif x[i][e] in l4 :
            n += 4
        elif x[i][e] in l5 :
            n += 5
        elif x[i][e] in l8 :
            n += 8
        elif x[i][e] in l10 :
            n += 10
    sc[n] = x[i]
    z.append(n)
    n = 0
z.sort()
z.reverse()

for i in range(len(z)):
    print(sc[z[i]], z[i])


6530131121
# 1661344, 2022-10-29 09:21:11, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 score=0
 for c in w:
     score+=letter_point(c)
 return score
words = input().split()

result=""
for e in words:
    result += e+" "
    result += str(word_point(e))
    result += "\n"
    print(result)
# 1661399, 2022-10-29 09:23:01, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 score=0
 for c in w:
     score+=letter_point(c)
 return score
words = input().split()

result=""
checker=[]
for e in words:
    result += e+" "
    result += str(word_point(e))
    checker.append(e)
    if not(len(checker) == len(words)):
        result += "\n"
    print(result)
# 1661425, 2022-10-29 09:24:07, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 score=0
 for c in w:
     score+=letter_point(c)
 return score
words = input().split()

result=""
checker=[]
for e in words:
    result += e+" "
    result += str(word_point(e))
    checker.append(e)
    if not(len(checker) == len(words)):
        result += "\n"
print(result)
# 1662863, 2022-10-29 10:10:45, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 score=0
 for c in w:
     score+=letter_point(c)
 return score

words = input().split()

result=""
checker=[]
Score=[]
Checker=[]
for e in words:
    result += e+" "
    result += str(word_point(e))
    checker.append(e)
    Score.append([word_point(e),e])
    Score.sort(reverse=True)
    checker.sort()
for e in Score:
    if Score.index(e)!= -1:
        print (e[1]+" "+str(e[0]) +"\n")
    else:print (e[1]+" "+str(e[0]))

    

# 1664347, 2022-10-29 10:39:22, xPP-- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 score=0
 for c in w:
     score+= int(letter_point(c))
 return score

words = input().split()

result=""
checker=[]
Score=[]
Checker=[]
for e in words:
    result += e+" "

    Score.append([word_point(e),e])
    Score.sort(reverse=True)

for e in Score:
  if Score[Score.index(e)] == "":pass
  elif Score.index(e) == 0:
      if Score[Score.index(e)+1][0] ==Score[Score.index(e)][0] :  checker.append(e)
  elif Score.index(e) == len(Score)-1:
    if Score[Score.index(e)-1][0] ==Score[Score.index(e)][0] :
     checker.append(e)
      
  elif Score[Score.index(e)-1][0] ==Score[Score.index(e)][0] :
     checker.append(e)
  elif Score[Score.index(e)+1][0] ==Score[Score.index(e)][0] :  checker.append(e) 
checker.sort()  
for e in Score:   
  if e not in checker:
     if Score.index(e)!= len(Score)-1:
         print (e[1]+" "+str(e[0]) +"\n")
     else:pass
for k in checker:
         print (k[1]+" "+str(k[0]) +"\n")
    #else:
        #print (k[1]+" "+str(k[0]))
print(Score[-1][1]+ " " + str(Score[-1][0]))
    

# 1664389, 2022-10-29 10:39:44, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in "A, E, I, L, N, O, R, S, T, U":
     return 1
 elif c in "D, G":return 2
 elif c in "B, C, M, P": return 3
 elif c in "F, H, V, W, Y":return 4
 elif c in "K":return 5
 elif c in "J, X":return 8
 elif c in "Q, Z":return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 score=0
 for c in w:
     score+=letter_point(c)
 return score

words = input().split()

result=""
checker=[]
Score=[]
Checker=[]
for e in words:
    result += e+" "
    result += str(word_point(e))
    checker.append(e)
    Score.append([word_point(e),e])
    Score.sort(reverse=True)
    checker.sort()
for e in Score:
    if Score.index(e)!= -1:
        print (e[1]+" "+str(e[0]) +"\n")
    else:print (e[1]+" "+str(e[0]))

6530135721
# 1661665, 2022-10-29 09:31:09, ----- (0%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10

def word_point(w):
    p = 0
    for i in w:
        #print(i)
        for j in range(len(i)):
            #print(p)
            p+=letter_point(i[j])
    return p

#words = input().split()
words = ['COMPUTE', 'ZEBRA', 'QUEEN' ,'QUIET', 'QUITE' ]
#a = input()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    print(h[i][1],h[i][0])
#print(word_point(['QUITE']))
#print(h)

# 1661716, 2022-10-29 09:33:12, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10

def word_point(w):
    p = 0
    for i in w:
        #print(i)
        for j in range(len(i)):
            #print(p)
            p+=letter_point(i[j])
    return p

words = input().split()
#words = ['COMPUTE', 'ZEBRA', 'QUEEN' ,'QUIET', 'QUITE' ]
#a = input()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    print(h[i][1],h[i][0])
#print(word_point(['QUITE']))
#print(h)
# 1661764, 2022-10-29 09:35:48, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0

def word_point(w):
    p = 0
    for i in w:
        #print(i)
        for j in range(len(i)):
            #print(p)
            p+=letter_point(i[j])
    return p

words = input().split()
#words = ['COMPUTE', 'ZEBRA', 'QUEEN' ,'QUIET', 'QUITE' ]
#a = input()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    #print(i)
    print(h[i][1],h[i][0])
#print(word_point(['QUITE']))
#print(h)

# 1661786, 2022-10-29 09:36:45, xxxxx (0%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0

def word_point(w):
    p = 0
    for i in w:
        #print(i)
        for j in range(len(i)):
            #print(p)
            p+=letter_point(i[j])
    return p

words = input().split().strip()
#words = ['COMPUTE', 'ZEBRA', 'QUEEN' ,'QUIET', 'QUITE' ]
#a = input()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    #print(i)
    print(h[i][1],h[i][0])
#print(word_point(['QUITE']))
#print(h)
# 1661790, 2022-10-29 09:37:03, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0

def word_point(w):
    p = 0
    for i in w:
        #print(i)
        for j in range(len(i)):
            #print(p)
            p+=letter_point(i[j])
    return p

words = input().strip().split()
#words = ['COMPUTE', 'ZEBRA', 'QUEEN' ,'QUIET', 'QUITE' ]
#a = input()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    #print(i)
    print(h[i][1],h[i][0])
#print(word_point(['QUITE']))
#print(h)
# 1663815, 2022-10-29 10:32:08, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    else:
        return 0

def word_point(w):
    p = 0
    for i in w:
        for j in range(len(i)):
            p+=letter_point(i[j])
    return p

words = input().strip().split()
h = []
for i in range(len(words)):
    h.append([word_point(words[i]),words[i]])
h.sort()
for i in range(len(words),0,-1):
    i-=1
    print(h[i][1],h[i][0])

6531307521
# 1661384, 2022-10-29 09:22:37, P---- (20%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
word = input()
for e in word :
    if e in a :
        s += 1
    elif e in b :
        s += 2
    elif e in c :
        s += 3
    elif e in d :
        s += 4
    elif e in m :
        s += 5
    elif e in f :
        s += 8
    elif e in g :
        s += 10
print(word,s)
# 1661638, 2022-10-29 09:30:15, PPP-- (60%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
k = []
word = input().split()
for l in word :
    for e in l :
        if e in a :
            s += 1
        elif e in b :
            s += 2
        elif e in c :
            s += 3
        elif e in d :
            s += 4
        elif e in m :
            s += 5
        elif e in f :
            s += 8
        elif e in g :
            s += 10
    k.append([s,l])
    s = 0
k.sort()
for x,z in k[::-1] :
    print(z,x)
# 1664456, 2022-10-29 10:40:16, ----- (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
k = []
word = input().split()
for l in word :
    for e in l :
        if e in a :
            s += 1
        elif e in b :
            s += 2
        elif e in c :
            s += 3
        elif e in d :
            s += 4
        elif e in m :
            s += 5
        elif e in f :
            s += 8
        elif e in g :
            s += 10
    k.append([s,l])
    s = 0
k.sort()
k = k[::-1]
for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]
for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]
print(k)

# 1664493, 2022-10-29 10:40:37, PPP-- (60%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
k = []
word = input().split()
for l in word :
    for e in l :
        if e in a :
            s += 1
        elif e in b :
            s += 2
        elif e in c :
            s += 3
        elif e in d :
            s += 4
        elif e in m :
            s += 5
        elif e in f :
            s += 8
        elif e in g :
            s += 10
    k.append([s,l])
    s = 0
k.sort()
for x,z in k[::-1] :
    print(z,x)
# 1664626, 2022-10-29 10:41:44, P---- (20%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
k = []
word = input().split()
for l in word :
    for e in l :
        if e in a :
            s += 1
        elif e in b :
            s += 2
        elif e in c :
            s += 3
        elif e in d :
            s += 4
        elif e in m :
            s += 5
        elif e in f :
            s += 8
        elif e in g :
            s += 10
    k.append([s,l])
    s = 0
k.sort()
k = k[::-1]
for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]
for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for i in range(len(k)-1) :
    if k[i][0] == k[i+1][0] :
        if k[i][1] > k[i+1][1] :
            k[i],k[i+1] = k[i+1],k[i]

for x,z in k[::-1] :
    print(z,x)
# 1664656, 2022-10-29 10:42:11, PPP-- (60%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
m = "K"
f = "JX"
g = "QZ"

s = 0
k = []
word = input().split()
for l in word :
    for e in l :
        if e in a :
            s += 1
        elif e in b :
            s += 2
        elif e in c :
            s += 3
        elif e in d :
            s += 4
        elif e in m :
            s += 5
        elif e in f :
            s += 8
        elif e in g :
            s += 10
    k.append([s,l])
    s = 0
k.sort()
for x,z in k[::-1] :
    print(z,x)

6230425421
# 1661651, 2022-10-29 09:30:47, P---- (20%)

p = {}
p1 = {}
A = ['A','E','I','L','N','O','R','S','T','U']
for c in A :
    p1[c] = 1
    
p2 = {}
A = ['D','G']
for c in A :
    p2[c] = 2
    
p3 = {}
A = ['B','C','M','P']
for c in A :
    p3[c] = 3
    
p4 = {}
A = ['F', 'H','V', 'W', 'Y']
for c in A :
    p4[c] = 4
    
p5 = {}
A = ['K']
for c in A :
    p1[c] = 5
    
p8 = {}
A = ['J', 'X']
for c in A :
    p8[c] = 8

p10 = {}
A = ['Q','Z']
for c in A :
    p10[c] = 10
p.update(p1)
p.update(p2)
p.update(p3)
p.update(p4)
p.update(p5)
p.update(p8)
p.update(p10)

total = 0
w = input().split()
for e in w :
    for c in e :
        if c in p :
            total += p[c]
    print(e,total)
# 1662084, 2022-10-29 09:46:50, P---- (20%)

p = {}
p1 = {}
A = ['A','E','I','L','N','O','R','S','T','U']
for c in A :
    p1[c] = 1
    
p2 = {}
A = ['D','G']
for c in A :
    p2[c] = 2
    
p3 = {}
A = ['B','C','M','P']
for c in A :
    p3[c] = 3
    
p4 = {}
A = ['F', 'H','V', 'W', 'Y']
for c in A :
    p4[c] = 4
    
p5 = {}
A = ['K']
for c in A :
    p1[c] = 5
    
p8 = {}
A = ['J', 'X']
for c in A :
    p8[c] = 8

p10 = {}
A = ['Q','Z']
for c in A :
    p10[c] = 10
p.update(p1)
p.update(p2)
p.update(p3)
p.update(p4)
p.update(p5)
p.update(p8)
p.update(p10)




def pt_name(e) :
    total = 0
    for c in e :
        if c in p :
            total += p[c]
    return total

w = input().split()
for e in w :
    print(e,pt_name(e))
# 1662397, 2022-10-29 09:56:59, PPP-- (60%)

p = {}
p1 = {}
A = ['A','E','I','L','N','O','R','S','T','U']
for c in A :
    p1[c] = 1
    
p2 = {}
A = ['D','G']
for c in A :
    p2[c] = 2
    
p3 = {}
A = ['B','C','M','P']
for c in A :
    p3[c] = 3
    
p4 = {}
A = ['F', 'H','V', 'W', 'Y']
for c in A :
    p4[c] = 4
    
p5 = {}
A = ['K']
for c in A :
    p1[c] = 5
    
p8 = {}
A = ['J', 'X']
for c in A :
    p8[c] = 8

p10 = {}
A = ['Q','Z']
for c in A :
    p10[c] = 10
p.update(p1)
p.update(p2)
p.update(p3)
p.update(p4)
p.update(p5)
p.update(p8)
p.update(p10)




def pt_name(e) :
    total = 0
    for c in e :
        if c in p :
            total += p[c]
    return total

w = input().upper().split()
p_n = []
for e in w :
    p_n.append([pt_name(e),e])
p_n.sort()
p_n = p_n[::-1]

for pt,name in p_n :
    print(name,pt)

# 1662444, 2022-10-29 09:58:17, PPP-- (60%)

p = {}
p1 = {}
A = ['A','E','I','L','N','O','R','S','T','U']
for c in A :
    p1[c] = 1
    
p2 = {}
A = ['D','G']
for c in A :
    p2[c] = 2
    
p3 = {}
A = ['B','C','M','P']
for c in A :
    p3[c] = 3
    
p4 = {}
A = ['F', 'H','V', 'W', 'Y']
for c in A :
    p4[c] = 4
    
p5 = {}
A = ['K']
for c in A :
    p1[c] = 5
    
p8 = {}
A = ['J', 'X']
for c in A :
    p8[c] = 8

p10 = {}
A = ['Q','Z']
for c in A :
    p10[c] = 10
p.update(p1)
p.update(p2)
p.update(p3)
p.update(p4)
p.update(p5)
p.update(p8)
p.update(p10)




def pt_name(e) :
    total = 0
    for c in e :
        if c in p :
            total += p[c]
    return total

w = input().upper().split()
p_n = []
for e in w :
    p_n.append([pt_name(e),e])
p_n.sort()
p_n = p_n[::-1]

for pt,name in p_n :
    print(name,pt)
# 1664297, 2022-10-29 10:38:55, PPP-- (60%)

p = {}
p1 = {}
A = ['A','E','I','L','N','O','R','S','T','U']
for c in A :
    p1[c] = 1
    
p2 = {}
A = ['D','G']
for c in A :
    p2[c] = 2
    
p3 = {}
A = ['B','C','M','P']
for c in A :
    p3[c] = 3
    
p4 = {}
A = ['F', 'H','V', 'W', 'Y']
for c in A :
    p4[c] = 4
    
p5 = {}
A = ['K']
for c in A :
    p1[c] = 5
    
p8 = {}
A = ['J', 'X']
for c in A :
    p8[c] = 8

p10 = {}
A = ['Q','Z']
for c in A :
    p10[c] = 10
p.update(p1)
p.update(p2)
p.update(p3)
p.update(p4)
p.update(p5)
p.update(p8)
p.update(p10)




def pt_name(e) :
    total = 0
    for c in e :
        if c in p :
            total += p[c]
    return total

w = input().split()
p_n = []
for e in w :
    p_n.append([pt_name(e),e])
p_n.sort()
p_n = p_n[::-1]

for pt,name in p_n :
    print(name,pt)

6530102021
# 1661452, 2022-10-29 09:25:01, ----- (0%)


def letter_point(c):
    a = c.split()
    a.sort()
    a = a[::-1]
    for i in a:
        score = 0
        for n in i:
            if n in 'AEILNORSTU':
                score += 1
            elif n in 'DG':
                score += 2
            elif n in 'BCMP':
                score += 3
            elif n in 'FHVWY':
                score += 4
            elif n in 'K':
                score += 5
            elif n in 'JX':
                score += 8
            elif n in 'QZ':
                score += 10
        print(c,score)
            
            
       
            
   

# 1661491, 2022-10-29 09:25:59, P---- (20%)

c = input()
a = c.split()
a.sort()
a = a[::-1]
for i in a:
    score = 0
    for n in i:
        if n in 'AEILNORSTU':
            score += 1
        elif n in 'DG':
            score += 2
        elif n in 'BCMP':
            score += 3
        elif n in 'FHVWY':
            score += 4
        elif n in 'K':
            score += 5
        elif n in 'JX':
            score += 8
        elif n in 'QZ':
            score += 10
    print(c,score)
# 1661521, 2022-10-29 09:26:58, P---- (20%)

c = input()
a = c.split()
a.sort()
a = a[::-1]
for i in a:
    score = 0
    for n in i:
        if n in 'AEILNORSTU':
            score += 1
        elif n in 'DG':
            score += 2
        elif n in 'BCMP':
            score += 3
        elif n in 'FHVWY':
            score += 4
        elif n in 'K':
            score += 5
        elif n in 'JX':
            score += 8
        elif n in 'QZ':
            score += 10
    print(i,score)
       
            
   

# 1661745, 2022-10-29 09:34:58, P---- (20%)

c = input()
a = c.split()
a.sort()
a = a[::-1]
wo = []
sc = []
for i in a:
    score = 0
    for n in i:
        if n in 'AEILNORSTU':
            score += 1
        elif n in 'DG':
            score += 2
        elif n in 'BCMP':
            score += 3
        elif n in 'FHVWY':
            score += 4
        elif n in 'K':
            score += 5
        elif n in 'JX':
            score += 8
        elif n in 'QZ':
            score += 10
    wo += [i]
    sc += [score]
asc = []
for i in sc:
    asc += [i]
for i in range(len(sc)):
    if sc[i] == max(asc):
        print(wo[i],sc[i])
        asc.remove(sc[i])
    else:
        pass
   

# 1663031, 2022-10-29 10:15:30, PP-P- (60%)

c = input()
a = c.split()
a.sort()
wo = []
sc = []
for i in a:
    score = 0
    for n in i:
        if n in 'AEILNORSTU':
            score += 1
        elif n in 'DG':
            score += 2
        elif n in 'BCMP':
            score += 3
        elif n in 'FHVWY':
            score += 4
        elif n in 'K':
            score += 5
        elif n in 'JX':
            score += 8
        elif n in 'QZ':
            score += 10
    wo += [i]
    sc += [score]
asc = []
for i in sc:
    asc += [i]
for i in range(len(sc)):
    if sc[i] == max(asc):
        print(wo[i],sc[i])
        asc.remove(sc[i])
    else:
        pass

6530124821
# 1661668, 2022-10-29 09:31:12, P---- (20%)

def letter_point(c):
    S1 = 'AEILNORSTU'
    S2 = 'DG'
    S3 = 'BCMP'
    S4 = 'FHVWY'
    S5 = 'K'
    S8 = 'JX'
    S10 = 'QZ'
    if c in S1:
        point = 1
    elif c in S2:
        point = 2
    elif c in S3:
        point = 3
    elif c in S4:
        point = 4
    elif c in S5:
        point = 5
    elif c in S8:
        point = 8
    elif c in S10:
        point = 10
    return point

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score

words = input().split()
A = []
for i in range(len(words)):
    B=[]
    B.append(word_point(words[i]))
    B.append(words[i])
    A.append(B)

A.sort

for i in range(len(A)):
    A[i][0],A[i][1] = A[i][1],A[i][0]

for i in range(len(A)):
    print(A[-1*i][0], A[-1*i][1])
# 1661826, 2022-10-29 09:38:21, PP--- (40%)

def letter_point(c):
    S1 = 'AEILNORSTU'
    S2 = 'DG'
    S3 = 'BCMP'
    S4 = 'FHVWY'
    S5 = 'K'
    S8 = 'JX'
    S10 = 'QZ'
    if c in S1:
        point = 1
    elif c in S2:
        point = 2
    elif c in S3:
        point = 3
    elif c in S4:
        point = 4
    elif c in S5:
        point = 5
    elif c in S8:
        point = 8
    elif c in S10:
        point = 10
    return point

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score

words = input().split()
A = []
for i in range(len(words)):
    B=[]
    B.append(word_point(words[i]))
    B.append(words[i])
    A.append(B)

A.sort

for i in range(len(A)):
    A[i][0],A[i][1] = A[i][1],A[i][0]


for i in range(len(A)):
    i += 1
    i *= -1
    print(A[i][0], A[i][1])
# 1662567, 2022-10-29 10:02:08, PPP-- (60%)

def letter_point(c):
    S1 = 'AEILNORSTU'
    S2 = 'DG'
    S3 = 'BCMP'
    S4 = 'FHVWY'
    S5 = 'K'
    S8 = 'JX'
    S10 = 'QZ'
    if c in S1:
        point = 1
    elif c in S2:
        point = 2
    elif c in S3:
        point = 3
    elif c in S4:
        point = 4
    elif c in S5:
        point = 5
    elif c in S8:
        point = 8
    elif c in S10:
        point = 10
    return point

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score

words = input().split()
A = []
for i in range(len(words)):
    B=[]
    B.append(word_point(words[i]))
    B.append(words[i])
    A.append(B)

A.sort()

for i in range(len(A)):
    A[i][0],A[i][1] = A[i][1],A[i][0]


for i in range(len(A)):
    i += 1
    i *= -1
    print(A[i][0], A[i][1])
# 1663914, 2022-10-29 10:33:46, ----- (0%)

def letter_point(c):
    S1 = 'AEILNORSTU'
    S2 = 'DG'
    S3 = 'BCMP'
    S4 = 'FHVWY'
    S5 = 'K'
    S8 = 'JX'
    S10 = 'QZ'
    if c in S1:
        point = 1
    elif c in S2:
        point = 2
    elif c in S3:
        point = 3
    elif c in S4:
        point = 4
    elif c in S5:
        point = 5
    elif c in S8:
        point = 8
    elif c in S10:
        point = 10
    return point

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score

words = input().split()
A = []
for i in range(len(words)):
    B=[]
    B.append(word_point(words[i]))
    B.append(words[i])
    A.append(B)
    
A.sort()

for i in range(len(A)):
    A[i][0],A[i][1] = A[i][1],A[i][0]

for i in range(len(A)-1):
    if A[i][1] == A[i+1][1]:
        if A[i][0] < A[i+1][0]:
            A[i],A[i+1] = A[i+1],A[i]
print(A)

for i in range(len(A)):
    i += 1
    i *= -1
# 1663943, 2022-10-29 10:34:09, PPP-- (60%)

def letter_point(c):
    S1 = 'AEILNORSTU'
    S2 = 'DG'
    S3 = 'BCMP'
    S4 = 'FHVWY'
    S5 = 'K'
    S8 = 'JX'
    S10 = 'QZ'
    if c in S1:
        point = 1
    elif c in S2:
        point = 2
    elif c in S3:
        point = 3
    elif c in S4:
        point = 4
    elif c in S5:
        point = 5
    elif c in S8:
        point = 8
    elif c in S10:
        point = 10
    return point

def word_point(w):
    score = 0
    for e in w:
        score += letter_point(e)
    return score

words = input().split()
A = []
for i in range(len(words)):
    B=[]
    B.append(word_point(words[i]))
    B.append(words[i])
    A.append(B)
    
A.sort()

for i in range(len(A)):
    A[i][0],A[i][1] = A[i][1],A[i][0]

for i in range(len(A)-1):
    if A[i][1] == A[i+1][1]:
        if A[i][0] < A[i+1][0]:
            A[i],A[i+1] = A[i+1],A[i]

for i in range(len(A)):
    i += 1
    i *= -1
    print(A[i][0], A[i][1])

6530194721
# 1662407, 2022-10-29 09:57:14, PPP-- (60%)

a = input().upper().split()
X1 = 'AEILNORSTU'
X2 = 'DG'
X3 = 'BCMP'
X4 = 'FHVWY'
X5 = 'K'
X8 = 'JX'
X10 = 'QZ'
k={}
z=[]
for i in a:
    n=0
    for j in i:
        if j in X1:
            n +=1
        elif j in X2:
            n+=2
        elif j in X3:
            n +=3
        elif j in X4:
            n+=4
        elif j in X5:
            n+=5
        elif j in X8:
            n+=8
        elif j in X10:
            n +=10
    k[i] = n 
for i in k:
    z.append([k[i],i])
z.sort()
z=z[::-1]
for i in range(len(z)):
    print(z[i][1],z[i][0])
# 1662717, 2022-10-29 10:06:40, PPP-- (60%)

a = input().upper().split()
X1 = 'AEILNORSTU'
X2 = 'DG'
X3 = 'BCMP'
X4 = 'FHVWY'
X5 = 'K'
X8 = 'JX'
X10 = 'QZ'
k={}
z=[]
for i in a:
    n=0
    for j in i:
        if j in X1:
            n +=1
        elif j in X2:
            n+=2
        elif j in X3:
            n +=3
        elif j in X4:
            n+=4
        elif j in X5:
            n+=5
        elif j in X8:
            n+=8
        elif j in X10:
            n +=10
    k[i] = n 
for i in k:
    z.append([k[i],i])
z.sort()
b = z
z=z[::-1]
for i in range(len(b)-1):
    if z[i][0]==z[i+1][0]:
        print(b[i][1],b[i][0])
    else:
        print(z[i][1],z[i][0])
print(z[-1][1],z[-1][0])
# 1663098, 2022-10-29 10:16:45, ----- (0%)

a = input().upper().split()
X1 = 'AEILNORSTU'
X2 = 'DG'
X3 = 'BCMP'
X4 = 'FHVWY'
X5 = 'K'
X8 = 'JX'
X10 = 'QZ'
k={}
z=[]
for i in a:
    n=0
    for j in i:
        if j in X1:
            n +=1
        elif j in X2:
            n+=2
        elif j in X3:
            n +=3
        elif j in X4:
            n+=4
        elif j in X5:
            n+=5
        elif j in X8:
            n+=8
        elif j in X10:
            n +=10
    k[i] = n 
for i in k:
    z.append([k[i],i])
z.sort()
b = z
print(b)
z=z[::-1]
for i in range(len(b)-1):
    if z[i][0] == z[i+1][0] or z[i][0] == z[i-1][0]:
        print(b[i][1],b[i][0])
    else:
        print(z[i][1],z[i][0])
print(z[-1][1],z[-1][0])
# 1663103, 2022-10-29 10:16:56, PPP-- (60%)

a = input().upper().split()
X1 = 'AEILNORSTU'
X2 = 'DG'
X3 = 'BCMP'
X4 = 'FHVWY'
X5 = 'K'
X8 = 'JX'
X10 = 'QZ'
k={}
z=[]
for i in a:
    n=0
    for j in i:
        if j in X1:
            n +=1
        elif j in X2:
            n+=2
        elif j in X3:
            n +=3
        elif j in X4:
            n+=4
        elif j in X5:
            n+=5
        elif j in X8:
            n+=8
        elif j in X10:
            n +=10
    k[i] = n 
for i in k:
    z.append([k[i],i])
z.sort()
b = z
z=z[::-1]
for i in range(len(b)-1):
    if z[i][0] == z[i+1][0] or z[i][0] == z[i-1][0]:
        print(b[i][1],b[i][0])
    else:
        print(z[i][1],z[i][0])
print(z[-1][1],z[-1][0])
# 1664072, 2022-10-29 10:36:06, PPP-- (60%)

a = input().upper().split()
X1 = 'AEILNORSTU'
X2 = 'DG'
X3 = 'BCMP'
X4 = 'FHVWY'
X5 = 'K'
X8 = 'JX'
X10 = 'QZ'
k={}
z=[]
n=[]
for i in a:
    n=0
    for j in i:
        if j in X1:
            n +=1
        elif j in X2:
            n+=2
        elif j in X3:
            n +=3
        elif j in X4:
            n+=4
        elif j in X5:
            n+=5
        elif j in X8:
            n+=8
        elif j in X10:
            n +=10
    k[i] = n 
for i in k:
    z.append([k[i],i])
z.sort()
for i in range(len(z)-1):
    if z[i][0] == z[i+1][0] or z[i][0] == z[i-1][0]:
        print(z[i][1],z[i][0])
    else:
        print(z[-i-1][1],z[-i-1][0])
print(z[0][1],z[0][0])

6530202021
# 1661371, 2022-10-29 09:22:03, Pxxxx (20%)

a={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,\
   'D':2,'G':2,\
   'B':3,'C':3,'M':3,'P':3,\
   'F':4,'H':4,'V':4,'W':4,'Y':4,\
   'k':5,\
   'J':8,'X':8,\
   'Q':10,'z':10}
x=input()
s=0
for e in x:
    s+=a[e]
print(x,s)
# 1662477, 2022-10-29 09:59:06, ---xx (0%)

a={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,\
   'D':2,'G':2,\
   'B':3,'C':3,'M':3,'P':3,\
   'F':4,'H':4,'V':4,'W':4,'Y':4,\
   'k':5,\
   'J':8,'X':8,\
   'Q':10,'Z':10}
def letter_point(c):
    s=0
    for e in c:
        s+=a[e]
    return s
 
def word_point(w):
    for e in w:
        print(e,letter_point(e))
 
words = input().split()

print(word_point(words))



# 1662586, 2022-10-29 10:02:39, ---xx (0%)

a={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,\
   'D':2,'G':2,\
   'B':3,'C':3,'M':3,'P':3,\
   'F':4,'H':4,'V':4,'W':4,'Y':4,\
   'k':5,\
   'J':8,'X':8,\
   'Q':10,'Z':10}
def letter_point(c):
    s=0
    for e in c:
        s+=a[e]
    return s
 
def word_point(w):
    for e in w:
        print(e,letter_point(e))
 
words = input().split()

print(word_point(words))
# 1662817, 2022-10-29 10:09:23, ---xx (0%)

a={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,\
   'D':2,'G':2,\
   'B':3,'C':3,'M':3,'P':3,\
   'F':4,'H':4,'V':4,'W':4,'Y':4,\
   'k':5,\
   'J':8,'X':8,\
   'Q':10,'Z':10}

def letter_point(c):
    s=0
    for e in c:
        s+=a[e]
    return s
 
def word_point(w):
    k=[]
    for e in w:
        k.append([letter_point(e),e])
    k.sort()
    k=k[::-1]
    for e in k:
        print(e[1],e[0])
 
words = input().split()

print(word_point(words))
# 1662907, 2022-10-29 10:12:19, PPPxx (60%)

a={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,\
   'D':2,'G':2,\
   'B':3,'C':3,'M':3,'P':3,\
   'F':4,'H':4,'V':4,'W':4,'Y':4,\
   'k':5,\
   'J':8,'X':8,\
   'Q':10,'Z':10}

def letter_point(c):
    s=0
    for e in c:
        s+=a[e]
    return s
 
def word_point(w):
    k=[]
    for e in w:
        k.append([letter_point(e),e])
    k.sort()
    k=k[::-1]
    return k

words = input().split()
k=word_point(words)
for e in k:
    print(e[1],e[0])

6531326421
# 1661302, 2022-10-29 09:19:27, Pxxxx (20%)

score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
value = 0
text = input()
for ch in text :
    value += int(score[ch])
print(text,value)
# 1661442, 2022-10-29 09:24:35, PPP-- (60%)

score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
value = []
text = input().split()
def word_point(w):
    p = 0
    score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    for ch in w:
        p += score[ch]
    return p
for e in text :
    value.append([word_point(e),e])
for a,b in sorted(value)[::-1] :
    print(b,a)
# 1661691, 2022-10-29 09:32:27, P---- (20%)

score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
value = []
text = input().split()
def word_point(w):
    p = 0
    score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    for ch in w:
        p += score[ch]
    return p
for e in text :
    value.append([word_point(e),e])
value_2 = {}
result = []
for a,b in sorted(value)[::-1] :
    if a not in value_2 :
        value_2[a] = [b]
    else :
        value_2[a] += [b]
    value_2[a].sort()
for a,b in value_2.items() :
    for i in range(len(b)) :
        print(b[i],a)
# 1661717, 2022-10-29 09:33:16, P---- (20%)

score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
value = []
text = input().split()
def word_point(w):
    p = 0
    score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    for ch in w.upper():
        p += score[ch]
    return p
for e in text :
    value.append([word_point(e),e])
value_2 = {}
result = []
for a,b in sorted(value)[::-1] :
    if a not in value_2 :
        value_2[a] = [b]
    else :
        value_2[a] += [b]
    value_2[a].sort()
for a,b in value_2.items() :
    for i in range(len(b)) :
        print(b[i],a)
# 1663882, 2022-10-29 10:33:17, PPP-- (60%)

score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
value = []
text = input().split()
def word_point(w):
    p = 0
    score = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
    for ch in w.upper():
        p += score[ch]
    return p
for e in text :
    value.append([word_point(e),e])
value_2 = {}
result = []
for a,b in sorted(value)[::-1] :
    print(b,a)

6531348221
# 1661378, 2022-10-29 09:22:25, PPP-- (60%)

words = input().split()
new_list = []
list = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4, "G":2, "H":4, "I":1, "J":8, "K":5, "L":1, "M":3, "N":1, "O":1, "P":3, "Q":10, "R":1, "S":1, "T":1, "U":1, "V":4, "W":4, "X":8, "Y":4, "Z":10}
for i in words:
    score = 0
    for j in i:
        score += list[j]
    new_list.append([score, i])
outcome = sorted(new_list, reverse = True)
for a, b in outcome:
    print(b, a)
# 1662846, 2022-10-29 10:10:28, P---- (20%)

words = input().split()
new_list = []
out = {}
list = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4, "G":2, "H":4, "I":1, "J":8, "K":5, "L":1, "M":3, "N":1, "O":1, "P":3, "Q":10, "R":1, "S":1, "T":1, "U":1, "V":4, "W":4, "X":8, "Y":4, "Z":10}
for i in words:
    score = 0
    for j in i:
        score += list[j]
    new_list.append([score, i])
outcome = sorted(new_list, reverse = True)
for a,b in outcome:
    if a in out:
        out[a] = out[a]+","+b
    else:
        out[a] = b
for i in out:
    out[i] = out[i].split(",")
for a in out:
    if len(out[a]) == 1:
        print(out[a][0],a) 
    else:
        out[a] = sorted(out[a])
        for i in range(len(out[a])):
            print(out[a][i] ,a)
# 1662861, 2022-10-29 10:10:43, PPP-- (60%)

words = input().split()
new_list = []
list = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4, "G":2, "H":4, "I":1, "J":8, "K":5, "L":1, "M":3, "N":1, "O":1, "P":3, "Q":10, "R":1, "S":1, "T":1, "U":1, "V":4, "W":4, "X":8, "Y":4, "Z":10}
for i in words:
    score = 0
    for j in i:
        score += list[j]
    new_list.append([score, i])
outcome = sorted(new_list, reverse = True)
for a, b in outcome:
    print(b, a)
# 1663894, 2022-10-29 10:33:25, P---- (20%)

words = input().split()
new_list = []
out = {}
list = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4, "G":2, "H":4, "I":1, "J":8, "K":5, "L":1, "M":3, "N":1, "O":1, "P":3, "Q":10, "R":1, "S":1, "T":1, "U":1, "V":4, "W":4, "X":8, "Y":4, "Z":10}
for i in words:
    score = 0
    for j in i:
        score += list[j]
    new_list.append([score, i])
outcome = sorted(new_list, reverse = True)
for a,b in outcome:
    if a in out:
        out[a] = out[a]+","+b
    else:
        out[a] = b
for i in out:
    out[i] = out[i].split(",")
for a in out:
    if len(out[a]) == 1:
        print(out[a][0],a) 
    else:
        out[a] = sorted(out[a])
        for i in range(len(out[a])):
            print(out[a][i] ,a)
# 1663903, 2022-10-29 10:33:32, PPP-- (60%)

words = input().split()
new_list = []
list = {"A":1, "B":3, "C":3, "D":2, "E":1, "F":4, "G":2, "H":4, "I":1, "J":8, "K":5, "L":1, "M":3, "N":1, "O":1, "P":3, "Q":10, "R":1, "S":1, "T":1, "U":1, "V":4, "W":4, "X":8, "Y":4, "Z":10}
for i in words:
    score = 0
    for j in i:
        score += list[j]
    new_list.append([score, i])
outcome = sorted(new_list, reverse = True)
for a, b in outcome:
    print(b, a)

6530019621
# 1661451, 2022-10-29 09:24:57, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    Score = []
    for e in c:# 'ZEBRA'
        if e in 'AEILNORSTU':
            Score.append(1)
        elif e in 'DG':
            Score.append(2)
        elif e in 'BCMP':
            Score.append(3)
        elif e in 'FHVWY':
            Score.append(4)
        elif e in 'K':
            Score.append(5)
        elif e in 'JX':
            Score.append(8)
        elif e in 'QZ':
            Score.append(10)
    return Score
#-------------------------------------------
def word_point(w): #[10 ,1 ,1 ,1 ,1]
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for e in w:
        sum += e
    return sum
#-------------------------------------------
words = input().split()
RealScore = []
for e in words: #['ZEBRA', 'QUEEN', 'QUITE']
    Score = letter_point(e)
    RealScore.append(word_point(Score))
for i in range(len(words)):
    print(words[i],RealScore[i])
    
    

# 1661477, 2022-10-29 09:25:41, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    Score = []
    for e in c:# 'ZEBRA'
        if e in 'AEILNORSTU':
            Score.append(1)
        elif e in 'DG':
            Score.append(2)
        elif e in 'BCMP':
            Score.append(3)
        elif e in 'FHVWY':
            Score.append(4)
        elif e in 'K':
            Score.append(5)
        elif e in 'JX':
            Score.append(8)
        elif e in 'QZ':
            Score.append(10)
    return Score
#-------------------------------------------
def word_point(w): #[10 ,1 ,1 ,1 ,1]
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for e in w:
        sum += e
    return sum
#-------------------------------------------
words = input().split()
RealScore = []
for e in words: #['ZEBRA', 'QUEEN', 'QUITE']
    Score = letter_point(e)
    RealScore.append(word_point(Score))
for i in range(len(words)):
    print(words[i],int(RealScore[i]))
    
    

# 1661485, 2022-10-29 09:25:51, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    Score = []
    for e in c:# 'ZEBRA'
        if e in 'AEILNORSTU':
            Score.append(1)
        elif e in 'DG':
            Score.append(2)
        elif e in 'BCMP':
            Score.append(3)
        elif e in 'FHVWY':
            Score.append(4)
        elif e in 'K':
            Score.append(5)
        elif e in 'JX':
            Score.append(8)
        elif e in 'QZ':
            Score.append(10)
    return Score
#-------------------------------------------
def word_point(w): #[10 ,1 ,1 ,1 ,1]
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for e in w:
        sum += e
    return sum
#-------------------------------------------
words = input().split()
RealScore = []
for e in words: #['ZEBRA', 'QUEEN', 'QUITE']
    Score = letter_point(e)
    RealScore.append(word_point(Score))
for i in range(len(words)):
    print(words[i],str(RealScore[i]))
    
    

# 1661658, 2022-10-29 09:30:55, PPP-- (60%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    Score = []
    for e in c:# 'ZEBRA'
        if e in 'AEILNORSTU':
            Score.append(1)
        elif e in 'DG':
            Score.append(2)
        elif e in 'BCMP':
            Score.append(3)
        elif e in 'FHVWY':
            Score.append(4)
        elif e in 'K':
            Score.append(5)
        elif e in 'JX':
            Score.append(8)
        elif e in 'QZ':
            Score.append(10)
    return Score
#-------------------------------------------
def word_point(w): #[10 ,1 ,1 ,1 ,1]
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for e in w:
        sum += e
    return sum
#-------------------------------------------
words = input().split()
RealScore = []
for e in words: #['ZEBRA', 'QUEEN', 'QUITE']
    Score = letter_point(e)
    RealScore.append(word_point(Score))
Answer = []
for i in range(len(words)):
    pos = RealScore.index(max(RealScore))
    print(words[pos],max(RealScore))
    Trash = RealScore.pop(pos)
    Trash = words.pop(pos)


    
    


6531507721
# 1662057, 2022-10-29 09:45:53, PPP-- (60%)

def letter_point(c):
    T_score = []
    for a in c:
        score = 0
        for i in a:
            
            if i in "AEILNORSTU":score += 1           
            elif i in "DG": score += 2
            elif i in "BCMP" : score += 3
            elif i in "FHVWY": score += 4
            elif i in "K": score += 5
            elif i in "JX": score += 8
            elif i in "QZ" : score += 10
        
        T_score.append(score)
    return T_score
    
    
    
    
words = input().split()
score_words = []
x=letter_point(words)
for i in range(len(x)):
    score_words.append([x[i],words[i]])
    
score_words.sort(reverse=True)
for i in range(len(score_words)):
    print(score_words[i][1],score_words[i][0])
# 1664313, 2022-10-29 10:39:01, xxxxx (0%)

def letter_point(c):
    T_score = []
    for a in c:
        score = 0
        for i in a:
            
            if i in "AEILNORSTU":score += 1           
            elif i in "DG": score += 2
            elif i in "BCMP" : score += 3
            elif i in "FHVWY": score += 4
            elif i in "K": score += 5
            elif i in "JX": score += 8
            elif i in "QZ" : score += 10
        
        T_score.append(score)
    return T_score
    
    
    
    
words = input().split()
score_words = []
x=letter_point(words)
for i in range(len(x)):
    score_words.append([x[i],words[i]])
    
score_words.sort(reverse=True)
score_words[1].sort(reverse=True)
for i in range(len(score_words)):
          print(score_words[i][1],score_words[i][0])
# 1664353, 2022-10-29 10:39:25, xxxxx (0%)

def letter_point(c):
    T_score = []
    for a in c:
        score = 0
        for i in a:
            
            if i in "AEILNORSTU":score += 1           
            elif i in "DG": score += 2
            elif i in "BCMP" : score += 3
            elif i in "FHVWY": score += 4
            elif i in "K": score += 5
            elif i in "JX": score += 8
            elif i in "QZ" : score += 10
        
        T_score.append(score)
    return T_score
    
    
    
    
words = input().split()
score_words = []
x=letter_point(words)
for i in range(len(x)):
    score_words.append([x[i],words[i]])
    
score_words.sort(reverse=True)
score_words[1].sort(reverse=True)
for i in range(len(score_words)):
          print(score_words[i][1],score_words[i][0])
# 1664602, 2022-10-29 10:41:30, PPP-- (60%)

def letter_point(c):
    T_score = []
    for a in c:
        score = 0
        for i in a:
            
            if i in "AEILNORSTU":score += 1           
            elif i in "DG": score += 2
            elif i in "BCMP" : score += 3
            elif i in "FHVWY": score += 4
            elif i in "K": score += 5
            elif i in "JX": score += 8
            elif i in "QZ" : score += 10
        
        T_score.append(score)
    return T_score
    
    
    
    
words = input().split()
score_words = []
x=letter_point(words)
for i in range(len(x)):
    score_words.append([x[i],words[i]])
    
score_words.sort(reverse=True)
for i in range(len(score_words)):
          print(score_words[i][1],score_words[i][0])

6531513421
# 1661677, 2022-10-29 09:31:34, ----- (0%)

def word_point(words):
    a1 = list('AEILNORSTU')
    b1 = list('DG')
    c1 = list('BCMP')
    d1 = list('FHVWY')
    e1 = list('K')
    f1 = list('JX')
    g1 = list('QZ')
    point = 0
    l1 = ','.join(words)
    for i in l1 :
        if i in a1 :
            point += 1
        elif i in b1 :
            point += 2
        elif i in c1 :
            point += 3
        elif i in d1 :
            point += 4
        elif i in e1 :
            point += 5
        elif i in f1 :
            point += 8
        else :
            point += 10
    return point
    

words = input().split()
for i in range(len(words)):
    result = word_point(words[i])
    print(words[i],result)

# 1661903, 2022-10-29 09:40:37, P---- (20%)

def word_point(words):
    a1 = list('AEILNORSTU')
    b1 = list('DG')
    c1 = list('BCMP')
    d1 = list('FHVWY')
    e1 = list('K')
    f1 = list('JX')
    g1 = list('QZ')
    point = 0
    l1 = ','.join(words)
    for i in l1 :
        if i in a1 :
            point += 1
        elif i in b1 :
            point += 2
        elif i in c1 :
            point += 3
        elif i in d1 :
            point += 4
        elif i in e1 :
            point += 5
        elif i in f1 :
            point += 8
        elif i in g1:
            point += 10
    return point
    

yay = input().split()
a = len(yay)
for i in range(len(yay)):
    total = word_point(yay[i])
    print(yay[i],total)
# 1662146, 2022-10-29 09:49:02, PPP-- (60%)

def word_point(words):
    a1 = list('AEILNORSTU')
    b1 = list('DG')
    c1 = list('BCMP')
    d1 = list('FHVWY')
    e1 = list('K')
    f1 = list('JX')
    g1 = list('QZ')
    point = 0
    l1 = ','.join(words)
    for i in l1 :
        if i in a1 :
            point += 1
        elif i in b1 :
            point += 2
        elif i in c1 :
            point += 3
        elif i in d1 :
            point += 4
        elif i in e1 :
            point += 5
        elif i in f1 :
            point += 8
        elif i in g1:
            point += 10
    return point
    

yay = input().split()
p = []
for i in range(len(yay)):
    total = word_point(yay[i])
    p.append([total,yay[i]])
z = sorted(p)[::-1]
for i in range(len(z)) :
    print(z[i][1],z[i][0])

# 1663913, 2022-10-29 10:33:46, PPP-- (60%)

def word_point(words):
    a1 = list('AEILNORSTU')
    b1 = list('DG')
    c1 = list('BCMP')
    d1 = list('FHVWY')
    e1 = list('K')
    f1 = list('JX')
    g1 = list('QZ')
    point = 0
    l1 = ','.join(words)
    for i in l1 :
        if i in a1 :
            point += 1
        elif i in b1 :
            point += 2
        elif i in c1 :
            point += 3
        elif i in d1 :
            point += 4
        elif i in e1 :
            point += 5
        elif i in f1 :
            point += 8
        elif i in g1:
            point += 10
    return point
    

yay = input().split()
p = []
for i in range(len(yay)):
    total = word_point(yay[i])
    p.append([total,yay[i]])
z = sorted(p)[::-1]
for i in range(len(z)) :
    print(z[i][1],z[i][0])

6530044221
# 1661269, 2022-10-29 09:17:50, P---- (20%)

a = input().split()
word = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
        "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4, "W":4,
        "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10 }

for i in range(0,len(a)):
    score = 0
    for j in range(len(a[i])):
        score += word[a[i][j]]
    print(a[i],score)
# 1661364, 2022-10-29 09:21:51, ----- (0%)

def two(x):
    return(x[1])
a = input().split()
word = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
        "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4, "W":4,
        "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10 }
ans = []
for i in range(0,len(a)):
    score = 0
    for j in range(len(a[i])):
        score += word[a[i][j]]
    ans+= [[a[i],score]]
print(ans)
for i in sorted(ans,key=two,reverse = True) :
    print(i[0],i[1])
# 1661379, 2022-10-29 09:22:27, PPP-- (60%)

def two(x):
    return(x[1])
a = input().split()
word = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
        "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4, "W":4,
        "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10 }
ans = []
for i in range(0,len(a)):
    score = 0
    for j in range(len(a[i])):
        score += word[a[i][j]]
    ans+= [[a[i],score]]
for i in sorted(ans,key=two,reverse = True) :
    print(i[0],i[1])
# 1664557, 2022-10-29 10:41:01, PPP-- (60%)

def two(x):
    return(x[1])
a = input().split()
word = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1,
        "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4, "W":4,
        "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10 }
ans = []
for i in range(0,len(a)):
    score = 0
    for j in range(len(a[i])):
        score += word[a[i][j]]
    ans+= [[a[i],score]]
for i in sorted(ans,key=two,reverse = True) :
    print(i[0],i[1])

6530047121
# 1661305, 2022-10-29 09:19:34, P---- (20%)

a=input().split()
s1="AEILNORSTU"
s2="DG"
s3="BCMP"
s4="FHVWY"
s5="K"
s8="JX"
s10="QZ"
sum=0
for i in a:
    for j in range(len(i)):
        if i[j] in s1:
            sum+=1
        elif i[j] in s2:
            sum+=2
        elif i[j] in s3:
            sum+=3
        elif i[j] in s4:
            sum+=4
        elif i[j] in s5:
            sum+=5
        elif i[j] in s8:
            sum+=8
        elif i[j] in s10:
            sum+=10
        else:
            sum+=0
    print(i,sum)
          
# 1661346, 2022-10-29 09:21:16, P---- (20%)

a=input().split()
s1="AEILNORSTU"
s2="DG"
s3="BCMP"
s4="FHVWY"
s5="K"
s8="JX"
s10="QZ"
sum=0
for i in a:
    for j in range(len(i)):
        if i[j] in s1:
            sum+=1
        elif i[j] in s2:
            sum+=2
        elif i[j] in s3:
            sum+=3
        elif i[j] in s4:
            sum+=4
        elif i[j] in s5:
            sum+=5
        elif i[j] in s8:
            sum+=8
        elif i[j] in s10:
            sum+=10
        else:
            sum+=0
    print(i,sum)
    sum=0

# 1661359, 2022-10-29 09:21:38, P---- (20%)

a=input().split()
s1="AEILNORSTU"
s2="DG"
s3="BCMP"
s4="FHVWY"
s5="K"
s8="JX"
s10="QZ"
sum=0
for i in a:
    for j in range(len(i)):
        if i[j] in s1:
            sum+=1
        elif i[j] in s2:
            sum+=2
        elif i[j] in s3:
            sum+=3
        elif i[j] in s4:
            sum+=4
        elif i[j] in s5:
            sum+=5
        elif i[j] in s8:
            sum+=8
        elif i[j] in s10:
            sum+=10
        else:
            sum+=0
    print(i,sum)
    sum=0
# 1661585, 2022-10-29 09:28:38, PPP-- (60%)

a=input().split()
b=[]
c=[]
s1="AEILNORSTU"
s2="DG"
s3="BCMP"
s4="FHVWY"
s5="K"
s8="JX"
s10="QZ"
sum=0
for i in a:
    for j in range(len(i)):
        if i[j] in s1:
            sum+=1
        elif i[j] in s2:
            sum+=2
        elif i[j] in s3:
            sum+=3
        elif i[j] in s4:
            sum+=4
        elif i[j] in s5:
            sum+=5
        elif i[j] in s8:
            sum+=8
        elif i[j] in s10:
            sum+=10
        else:
            sum+=0
    b.append([i,sum])
    sum=0
for i in range(len(b)):
    b[i].insert(0,b[i][-1])
b.sort()
c=b[-1::-1]
for i in range(len(c)):
    print(c[i][1],c[i][0])



6530079221
# 1662248, 2022-10-29 09:51:45, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c =='K':
        return 5
    elif c in'JX':
        return 8
    elif c in 'QZ':
        return 10
        
def word_point(w):
    result=0
    for i in w:
        result+=letter_point(i)
    return (result)
        
word=input().split()
result=[]
for i in range(len(word)):
    result.append([word_point(word[i]),word[i]])
result.sort()
result=['0']+result
for i in range(len(result)-1,0,-1):
    print(result[i][1],result[i][0])
# 1662910, 2022-10-29 10:12:25, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c =='K':
        return 5
    elif c in'JX':
        return 8
    elif c in 'QZ':
        return 10
        
def word_point(w):
    result=0
    for i in w:
        result+=letter_point(i)
    return (result)
        
word=input().split()
result=[]
for i in range(len(word)):
    result.append([word_point(word[i]),word[i]])
result.sort()
result=['0']+result
for i in range(len(result)-1,0,-1):
    print(result[i][1],result[i][0])
# 1662916, 2022-10-29 10:12:36, xxxxx (0%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c =='K':
        return 5
    elif c in'JX':
        return 8
    elif c in 'QZ':
        return 10
        
def word_point(w):
    result=0
    for i in w:
        result+=letter_point(i)
    return (result)
        
word=input().split()
result=[]
for i in range(len(word)):
    result.append([word_point(word[i]),word[i]])
result.sort()
result=['0']+result
for i in range(len(result)):
    print(result[i][1],result[i][0])
# 1662981, 2022-10-29 10:14:12, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c =='K':
        return 5
    elif c in'JX':
        return 8
    elif c in 'QZ':
        return 10
        
def word_point(w):
    result=0
    for i in w:
        result+=letter_point(i)
    return (result)
        
word=input().split()
result=[]
for i in range(len(word)):
    result.append([word_point(word[i]),word[i]])
result.sort()
result=['0']+result
for i in range(len(result)-1,0,-1):
    print(result[i][1],result[i][0])

6530137021
# 1661339, 2022-10-29 09:20:56, P---- (20%)

def letter_point(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score = 1
        elif e in 'DG':
            score = 2
        elif e in 'BCMP':
            score = 3
        elif e in 'FHVWY':
            score = 4
        elif e == 'K':
            score = 5
        elif e in 'JX':
            score = 8
        elif e in 'QZ':
            score = 10
    return score
       


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total
words = input().split()
for e in words:
    print(e,word_point(e))

# 1661511, 2022-10-29 09:26:32, PPP-- (60%)

def letter_point(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score = 1
        elif e in 'DG':
            score = 2
        elif e in 'BCMP':
            score = 3
        elif e in 'FHVWY':
            score = 4
        elif e == 'K':
            score = 5
        elif e in 'JX':
            score = 8
        elif e in 'QZ':
            score = 10
    return score
       


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total
words = input().split()
k = []
for e in words:
    k.append([word_point(e),e])
k.sort()
k = k[::-1]
for e in k:
    print(e[1],e[0])
    
    

# 1664091, 2022-10-29 10:36:27, PPP-- (60%)

def letter_point(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score = 1
        elif e in 'DG':
            score = 2
        elif e in 'BCMP':
            score = 3
        elif e in 'FHVWY':
            score = 4
        elif e == 'K':
            score = 5
        elif e in 'JX':
            score = 8
        elif e in 'QZ':
            score = 10
    return score
       


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total
words = input().split()
k = []
for e in words:
    k.append([word_point(e),e])
k.sort()
k = k[::-1]
for e in k:
    print(e[1],e[0])
    
    

# 1664108, 2022-10-29 10:36:46, PPP-- (60%)

def letter_point(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score = 1
        elif e in 'DG':
            score = 2
        elif e in 'BCMP':
            score = 3
        elif e in 'FHVWY':
            score = 4
        elif e == 'K':
            score = 5
        elif e in 'JX':
            score = 8
        elif e in 'QZ':
            score = 10
    return score
       


def word_point(w):
    total = 0
    for e in w:
        total += letter_point(e)
    return total
words = input().split()
k = []
for e in words:
    k.append([word_point(e),e])
k.sort()
k = k[::-1]
for e in k:
    print(e[1],e[0])
    
    


6530198221
# 1661806, 2022-10-29 09:37:42, ----x (0%)

s = { 'A':1 , 'E':1 , 'I':1 , 'L':1 , 'N':1 , 'O':1 , 'R':1 , 'S':1 , 'T':1 , 'U':1 , 'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'z':10}
r = []

w = input().split()
for i in range(len(w)) :
    x = 0
    for e in w[i] :
        x += s[e]
    r.append([x,w[i]])
    
r.sort()
for g in range(len(r)) :
    print(r[g][1])

# 1661837, 2022-10-29 09:38:48, ----x (0%)

s = { 'A':1 , 'E':1 , 'I':1 , 'L':1 , 'N':1 , 'O':1 , 'R':1 , 'S':1 , 'T':1 , 'U':1 , 'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'z':10}
r = []

w = input().split()
for i in range(len(w)) :
    x = 0
    for e in w[i] :
        x += s[e]
    r.append([x,w[i]])
    
r.sort(reverse = True)
for g in range(len(r)) :
    print(r[g][1])

# 1661892, 2022-10-29 09:40:11, ----x (0%)

s = { 'A':1 , 'E':1 , 'I':1 , 'L':1 , 'N':1 , 'O':1 , 'R':1 , 'S':1 , 'T':1 , 'U':1 , 'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'z':10}
r = []

w = input().split()
for i in range(len(w)) :
    x = 0
    for e in w[i] :
        x += s[e]
    r.append([x,w[i]])
    
r.sort(reverse = True)
for g in range(len(r)) :
    print(r[g][1])
# 1662023, 2022-10-29 09:44:57, PPP-- (60%)

s = { 'A':1 , 'E':1 , 'I':1 , 'L':1 , 'N':1 , 'O':1 , 'R':1 , 'S':1 , 'T':1 , 'U':1 , 'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
r = []

w = input().split()
for i in range(len(w)) :
    x = 0
    for e in w[i] :
        x += s[e]
    r.append([x,w[i]])
    
r.sort(reverse = True)
for g in range(len(r)) :
    print(r[g][1] , r[g][0])


6532040021
# 1661270, 2022-10-29 09:17:53, P---- (20%)

sc = {
    "AEILNORSTU": 1,
    "DG": 2,
    "BCMP": 3,
    "FHVWY": 4,
    "K": 5,
    "JX": 8,
    "QZ": 10
}

lst = input().split()

def fn(s):
    tt = 0
    for j in s:
        for k in sc:
            if j in k:
                tt += sc[k]
                break
    return tt

for i in lst:
    print(i, fn(i))
# 1661311, 2022-10-29 09:19:47, PPP-- (60%)

sc = {
    "AEILNORSTU": 1,
    "DG": 2,
    "BCMP": 3,
    "FHVWY": 4,
    "K": 5,
    "JX": 8,
    "QZ": 10
}

lst = input().split()

def fn(s):
    tt = 0
    for j in s:
        for k in sc:
            if j in k:
                tt += sc[k]
                break
    return tt

ans = []

for i in lst:
    ans.append([fn(i), i])

for i in sorted(ans)[::-1]:
    print(i[1], i[0])
# 1664594, 2022-10-29 10:41:24, ----- (0%)

sc = {
    "AEILNORSTU": 1,
    "DG": 2,
    "BCMP": 3,
    "FHVWY": 4,
    "K": 5,
    "JX": 8,
    "QZ": 10
}


def cf(a, b):
    if a[0] == b[0]:
        return a[1] < b[1]
    return a[0] > b[0]

lst = input().split()

def fn(s):
    tt = 0
    for j in s:
        for k in sc:
            if j in k:
                tt += sc[k]
                break
    return tt

ans = []

for i in lst:
    ans.append((fn(i),i))

ans.sort()


for i in ans:
    print(i[0], i[1])
# 1664645, 2022-10-29 10:42:01, ----- (0%)

sc = {
    "AEILNORSTU": 1,
    "DG": 2,
    "BCMP": 3,
    "FHVWY": 4,
    "K": 5,
    "JX": 8,
    "QZ": 10
}



lst = input().split()

def fn(s):
    tt = 0
    for j in s:
        for k in sc:
            if j in k:
                tt += sc[k]
                break
    return tt

ans = []

for i in lst:
    ans.append([fn(i),i])

ans.sort(reverse=True)


for i in ans:
    print(i[0], i[1])

6531106721
# 1661490, 2022-10-29 09:25:58, PPP-- (60%)

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
def word_point(w):
    point=0
    for i in w:
        point+=letter_point(i)
    return point
words = input().split()
new=[]
newone=[]
for word in words:
    new.append([word, word_point(word)])
    newone.append([word_point(word),word])
newone=sorted(newone,reverse=True)
neweek=[]
for s in newone:
    print(s[1], s[0])
# 1661549, 2022-10-29 09:27:45, P---- (20%)

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
def word_point(w):
    point=0
    for i in w:
        point+=letter_point(i)
    return point
words = input().split()
for word in words:
    print(word, word_point(word))
# 1661581, 2022-10-29 09:28:31, PPP-- (60%)

def letter_point(c):
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
def word_point(w):
    point=0
    for i in w:
        point+=letter_point(i)
    return point
words = input().split()
new=[]
newone=[]
for word in words:
    new.append([word, word_point(word)])
    newone.append([word_point(word),word])
newone=sorted(newone,reverse=True)
neweek=[]
for s in newone:
    print(s[1], s[0])
# 1663021, 2022-10-29 10:15:09, PPP-- (60%)

def letter_point(c):
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
def word_point(w):
    point=0
    for i in w:
        point+=letter_point(i)
    return point
words = input().split()
new=[]
newone=[]
for word in words:
    new.append([word, word_point(word)])
    newone.append([word_point(word),word])
newone=sorted(newone,reverse=True)
neweek=[]
for s in newone:
    print(s[1], s[0])
    


6531803421
# 1661261, 2022-10-29 09:17:17, ----- (0%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
k = 0
a = ''
x = input().strip()
for i in x :
    if i in s1 : a += i+'(1)'+'+'
    elif i in s2 : a += i+'(2)'+'+'
    elif i in s3 : a += i+'(3)'+'+'
    elif i in s4 : a += i+'(4)'+'+'
    elif i in s5 : a += i+'(5)'+'+'
    elif i in s8 : a += i+'(8)'+'+'
    elif i in s10 : a += i+'(10)'+'+'
    if i in s1 : k += 1
    elif i in s2 : k += 2
    elif i in s3 : k += 3
    elif i in s4 : k += 4
    elif i in s5 : k += 5
    elif i in s8 : k += 8
    elif i in s10 : k += 10
a = a.strip('+')
print(a,'=',k)
# 1662201, 2022-10-29 09:50:28, PPP-- (60%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
def lp(c) :
    if c in s1 : return 1
    elif c in s2 : return 2
    elif c in s3 : return 3
    elif c in s4 : return 4
    elif c in s5 : return 5
    elif c in s8 : return 8
    elif c in s10 : return 10
def wp(w) :
    a = 0
    for i in w :
        a += lp(i)
    return a
x = input().strip().split()
p = []
for i in x :
    p.append([wp(i),i])
p.sort()
p = p[::-1]
#for i in range(len(p)-1) :
#   if p[i][0] == p[i+1][0] :
#       p = p[i:i+2].sort()
for i in range (len(p)) :
    print(p[i][1],p[i][0])
    

# 1663327, 2022-10-29 10:22:39, PPP-- (60%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
def lp(c) :
    if c in s1 : return 1
    elif c in s2 : return 2
    elif c in s3 : return 3
    elif c in s4 : return 4
    elif c in s5 : return 5
    elif c in s8 : return 8
    elif c in s10 : return 10
def wp(w) :
    a = 0
    for i in w :
        a += lp(i)
    return a
x = input().strip().split()
p = []
pp = []
for i in x :
    p.append([wp(i),i])
p.sort()
p = p[::-1]
for i in range (len(p)-1) :
    if p[i][0] == p[i+1][0] :
        p[i][1],p[i+1][1] = p[i+1][1],p[i][1]
for i in range (len(p)) :
    print(p[i][1],p[i][0])
# 1663616, 2022-10-29 10:28:04, PPP-- (60%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s8 = 'JX'
s10 = 'QZ'
def lp(c) :
    if c in s1 : return 1
    elif c in s2 : return 2
    elif c in s3 : return 3
    elif c in s4 : return 4
    elif c in s5 : return 5
    elif c in s8 : return 8
    elif c in s10 : return 10
def wp(w) :
    a = 0
    for i in w :
        a += lp(i)
    return a
x = input().strip().split()
p = []
pp = []
for i in x :
    p.append([wp(i),i])
p.sort()
p = p[::-1]
for i in range (len(p)-1,1,-1) :
    if p[i][0] == p[i-1][0] :
        if p[i] < p[i-1] :
            p[i-1][1],p[i][1] = p[i][1],p[i-1][1]
for i in range (len(p)) :
    print(p[i][1],p[i][0])
    
    


6231121821
# 1661599, 2022-10-29 09:28:57, P---- (20%)

def word_point(c):
    alp1 = 'AEILNORSTU'
    alp2 = 'DG'
    alp3 = 'BCMP'
    alp4 = 'FHVWY'
    alp5 = 'K'
    alp8 = 'JX'
    alp10 = 'QZ'
    point = 0
    for i in range(len(c)):
        if c[i] in alp1:
            point += 1
        elif c[i] in alp2:
            point += 2
        elif c[i] in alp3:
            point += 3
        elif c[i] in alp4:
            point += 4
        elif c[i] in alp5:
            point += 5
        elif c[i] in alp8:
            point += 8
        elif c[i] in alp10:
            point += 10
    return point

words = input().split()
for e in words:
    w = word_point(e)
    print(e,w)
# 1661935, 2022-10-29 09:41:43, P---- (20%)

def letter_point(c):
    alp1 = 'AEILNORSTU'
    alp2 = 'DG'
    alp3 = 'BCMP'
    alp4 = 'FHVWY'
    alp5 = 'K'
    alp8 = 'JX'
    alp10 = 'QZ'
    for i in range(len(c)):
        if c[i] in alp1:
            return 1
        elif c[i] in alp2:
            return 2
        elif c[i] in alp3:
            return 3
        elif c[i] in alp4:
            return 4
        elif c[i] in alp5:
            return 5
        elif c[i] in alp8:
            return 8
        elif c[i] in alp10:
            return 10
#def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w


words = input().split()
p = []
for e in words:
    point = 0
    for i in range(len(e)):
        w = letter_point(e[i])
        point += w
    p.append([point,e])
p.sort()
for a,b in p:
    print(b,a)

# 1663354, 2022-10-29 10:23:04, PPP-- (60%)

def letter_point(c):
    alp1 = 'AEILNORSTU'
    alp2 = 'DG'
    alp3 = 'BCMP'
    alp4 = 'FHVWY'
    alp5 = 'K'
    alp8 = 'JX'
    alp10 = 'QZ'
    for i in range(len(c)):
        if c[i] in alp1:
            return 1
        elif c[i] in alp2:
            return 2
        elif c[i] in alp3:
            return 3
        elif c[i] in alp4:
            return 4
        elif c[i] in alp5:
            return 5
        elif c[i] in alp8:
            return 8
        elif c[i] in alp10:
            return 10
#def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w


words = input().split()
p = []
for e in words:
    point = 0
    for i in range(len(e)):
        w = letter_point(e[i])
        point += w
    p.append([point,e])
p.sort()
p.reverse()
for a,b in p:
    print(b,a)

6230187021
# 1661963, 2022-10-29 09:42:51, ----- (0%)

words = input().strip().split()
new=[]
for k in words:
    c=0
    for i in k :
        if i in ['A','E','I','L','N','O','R','S','T','U']:
            c+=1
        elif i in ['D','G'
]:
            c+=2
        elif i in ['B','C','M','P']:
            c+=3
        elif i in ['F','H','V','W','Y']:
            c+=4
        elif i in ['K']:
            c+=5
        elif i in ['J','X'
]:
            c+=8
        elif i in ['Q','Z']:
            c+=10
    new+=[[c,k]]

new.sort(reverse=True)

print(new)

# 1661979, 2022-10-29 09:43:17, ----- (0%)

words = input().strip().split()
new=[]
for k in words:
    c=0
    for i in k :
        if i in ['A','E','I','L','N','O','R','S','T','U']:
            c+=1
        elif i in ['D','G']:
            c+=2
        elif i in ['B','C','M','P']:
            c+=3
        elif i in ['F','H','V','W','Y']:
            c+=4
        elif i in ['K']:
            c+=5
        elif i in ['J','X']:
            c+=8
        elif i in ['Q','Z']:
            c+=10
    new+=[[c,k]]

new.sort(reverse=True)

print(new)
# 1662288, 2022-10-29 09:53:05, PPP-- (60%)

words = input().strip().split()
new=[]
for k in words:
    c=0
    for i in k :
        if i in ['A','E','I','L','N','O','R','S','T','U']:
            c+=1
        elif i in ['D','G']:
            c+=2
        elif i in ['B','C','M','P']:
            c+=3
        elif i in ['F','H','V','W','Y']:
            c+=4
        elif i in ['K']:
            c+=5
        elif i in ['J','X']:
            c+=8
        elif i in ['Q','Z']:
            c+=10
    new+=[[c,k]]

new.sort(reverse=True)
for i in new:
  print(i[1],i[0])

6430303721
# 1661249, 2022-10-29 09:16:14, ----- (0%)

x = input().strip()
c = 0
for e in x:
    if x != ' ':
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c += 2
        elif e in 'BCMP':
            c += 3
        elif e in 'FHVWY':
            c += 4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    else:
        c += 0
print(c)

# 1661252, 2022-10-29 09:16:39, ----- (0%)

x = input().strip()
c = 0
for e in x:
    if x != ' ':
        if e in 'AEILNORSTU':
            c += 1
        elif e in 'DG':
            c += 2
        elif e in 'BCMP':
            c += 3
        elif e in 'FHVWY':
            c += 4
        elif e in 'K':
            c += 5
        elif e in 'JX':
            c += 8
        elif e in 'QZ':
            c += 10
    else:
        c += 0
print(c)

# 1664160, 2022-10-29 10:37:27, PPP-- (60%)

def letter_point(c):
    x = 0
    score = []
    for e in str(c):
        if x != ' ':
            if e in 'AEILNORSTU':
                x += 1
            elif e in 'DG':
                x += 2
            elif e in 'BCMP':
                x += 3
            elif e in 'FHVWY':
                x += 4
            elif e in 'K':
                x += 5
            elif e in 'JX':
                x += 8
            elif e in 'QZ':
                x += 10
    return x

def word_point(w):
    return w, letter_point(w)

words = input().split()

words.sort()
x = []
for i in range(len(words)):
    x.append(word_point(words[i]))
for e in range(len(x)):
    x[e] = x[e][::-1]
x.sort()
x = x[::-1]
for e in range(len(x)):
    print(x[e][1], x[e][0])


6530002921
# 1661417, 2022-10-29 09:23:46, P---- (20%)

def letter_point(c):
    sc=0
    if c in "AEILNORSTU":
        sc=1
    elif c in "DG":
        sc=2
    elif c in "BCMP":
        sc=3
    elif c in "FHVWY":
        sc=4
    elif c in "k":
        sc=5
    elif c in "JX":
        sc=8
    elif c in "QZ":
        sc=10
    return sc
        

def word_point(w):
    sc=0
    for i in w:
        sc+=letter_point(i)
    return sc

words = input().split()
for i in words:
    print(i,word_point(i))
# 1661879, 2022-10-29 09:39:46, PPP-- (60%)

def letter_point(c):
    sc=0
    if c in "AEILNORSTU":
        sc=1
    elif c in "DG":
        sc=2
    elif c in "BCMP":
        sc=3
    elif c in "FHVWY":
        sc=4
    elif c in "k":
        sc=5
    elif c in "JX":
        sc=8
    elif c in "QZ":
        sc=10
    return sc
        

def word_point(w):
    sc=0
    for i in w:
        sc+=letter_point(i)
    return [sc,w]

words = input().split()
sc=[]
for i in words:
    sc.append(word_point(i))
    sc.sort()
for a in range(len(sc))[::-1]:
    print(sc[a][1],sc[a][0])
# 1661968, 2022-10-29 09:42:57, PPP-- (60%)

def letter_point(c):
    sc=0
    if c in "AEILNORSTU":
        sc=1
    elif c in "DG":
        sc=2
    elif c in "BCMP":
        sc=3
    elif c in "FHVWY":
        sc=4
    elif c in "k":
        sc=5
    elif c in "JX":
        sc=8
    elif c in "QZ":
        sc=10
    return sc
        

def word_point(w):
    sc=0
    for i in w:
        sc+=letter_point(i)
    return [-sc,w]

words = input().split()
sc=[]
for i in words:
    sc.append(word_point(i))
    sc.sort()
for a in range(len(sc)):
    print(sc[a][1],-sc[a][0])

6530009321
# 1661867, 2022-10-29 09:39:32, PPP-- (60%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 ='QZ'
words = input().split()
s = []
for e in words:
    c = 0
    for ch in e:
        if ch in p1:
            c += 1
        elif ch in p2:
            c += 2
        elif ch in p3:
            c += 3
        elif ch in p4:
            c += 4
        elif ch in p5:
            c += 5
        elif ch in p8:
            c += 8
        else:
            c += 10
    s.append([c,e])
s.sort()
s = s[::-1]
d =[]
for [x,y] in s:
    d.append([y,x])
for [name,point] in d:
    print(name,point)
    
    
    



        
        
 
 
 
 

# 1663069, 2022-10-29 10:16:01, PPP-- (60%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 ='QZ'
words = input().split()
s = []
for e in words:
    c = 0
    for ch in e:
        if ch in p1:
            c += 1
        elif ch in p2:
            c += 2
        elif ch in p3:
            c += 3
        elif ch in p4:
            c += 4
        elif ch in p5:
            c += 5
        elif ch in p8:
            c += 8
        else:
            c += 10
    s.append([c,e])
s.sort()
s = s[::-1]
    
for i in range(len(s)-1):
    if s[i][0] == s[i+1][0]:
        s[i],s[i+1] = s[i+1],s[i]
        
d =[]
for [x,y] in s:
    d.append([y,x])
for [name,point] in d:
    print(name,point)
    
    
    



# 1663768, 2022-10-29 10:31:02, PPP-- (60%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 ='QZ'
words = input().split()
s = []
for e in words:
    c = 0
    for ch in e:
        if ch in p1:
            c += 1
        elif ch in p2:
            c += 2
        elif ch in p3:
            c += 3
        elif ch in p4:
            c += 4
        elif ch in p5:
            c += 5
        elif ch in p8:
            c += 8
        else:
            c += 10
    s.append([c,e])
s.sort()
s = s[::-1]
    
for i in range(len(s)-1):
    if s[i][0] == s[i+1][0]:
        s[i],s[i+1] = s[i+1],s[i]
        
d =[]
for [x,y] in s:
    d.append([y,x])
for [name,point] in d:
    print(name,point)

6530024721
# 1661273, 2022-10-29 09:17:57, P---- (20%)

one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D', 'G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eig = ['J','X']
ten = ['Q','Z']
c = 0
x = input().split()
n = len(x)
for i in range(n) :
    c = 0
    for e in x[i] :
        if e in one :
            c += 1
        elif e in two :
            c += 2
        elif e in three :
            c += 3
        elif e in four :
            c += 4
        elif e in five :
            c += 5
        elif e in eig :
            c += 8
        elif e in ten :
            c += 10    
    print(x[i],c)
# 1661429, 2022-10-29 09:24:13, PPP-- (60%)

one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D', 'G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eig = ['J','X']
ten = ['Q','Z']
l = []
c = 0
x = input().split()
n = len(x)
for i in range(n) :
    c = 0
    for e in x[i] :
        if e in one :
            c += 1
        elif e in two :
            c += 2
        elif e in three :
            c += 3
        elif e in four :
            c += 4
        elif e in five :
            c += 5
        elif e in eig :
            c += 8
        elif e in ten :
            c += 10    
    l.append([c,x[i]])
l.sort()
ll = l[::-1]
for i in range(len(l)) :
    print(ll[i][1],ll[i][0])
# 1662878, 2022-10-29 10:11:16, PPP-- (60%)

one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D', 'G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eig = ['J','X']
ten = ['Q','Z']
l = []
vs = []
c = 0
x = input().split()
n = len(x)
for i in range(n) :
    c = 0
    for e in x[i] :
        if e in one :
            c += 1
        elif e in two :
            c += 2
        elif e in three :
            c += 3
        elif e in four :
            c += 4
        elif e in five :
            c += 5
        elif e in eig :
            c += 8
        elif e in ten :
            c += 10    
    l.append([c,x[i]])
    if not (c in vs) :
        vs.append(c)
vs.sort()
sv = vs[::-1]
for e in sv :
    for i in range(len(l)) :
        if e == l[i][0]  :
            print(l[i][1],l[i][0])

6531406021
# 1661734, 2022-10-29 09:34:18, P---- (20%)

a = input().split()
point = 0
n = 0
if len(a) == 1:
    for k in a:
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
    print(a[0], point)
if len(a) > 1:
    for k in a:
        n += 1
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
        print(a[n-1], point)
        point = 0

# 1662093, 2022-10-29 09:47:00, PPP-- (60%)

a = input().split()
point = 0
n = 0
x = []
out = []
if len(a) == 1:
    for k in a:
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
    print(a[0], point)
if len(a) > 1:
    for k in a:
        n += 1
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
        x.append(point)
        x.append(a[n-1])
        out.append(x)
        x = []
        point = 0
    out.sort(reverse=True)
    for i in range(len(out)):
        print(out[i][1], out[i][0])

# 1662465, 2022-10-29 09:58:45, PPP-- (60%)

a = input().split()
point = 0
n = 0
x = []
out = []
if len(a) == 1:
    for k in a:
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
    print(a[0], point)
if len(a) > 1:
    for k in a:
        n += 1
        for e in k:
            if e in 'AEILNORSTU':
                point += 1
            elif e in 'DG':
                point += 2
            elif e in 'BCMP':
                point += 3
            elif e in 'FHVWY':
                point += 4
            elif e in 'K':
                point += 5
            elif e in 'JX':
                point += 8
            elif e in 'QZ':
                point += 10
        x.append(point)
        x.append(a[n-1])
        out.append(x)
        x = []
        point = 0
    out.sort(reverse=True)
    for m in range(len(out)-1):
        if out[m][0] == out[m+1][0] and out[m][1] > out[m+1][1]:
            out[m][1],out[m+1][1] = out[m+1][1],out[m][1]
    for i in range(len(out)):
        print(out[i][1], out[i][0])


6530042021
# 1662254, 2022-10-29 09:51:52, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    if c in ['D', 'G']:
        return 2
    if c in ['B', 'C', 'M', 'P']:
        return 3
    if c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    if c in ['K']:
        return 5
    if c in ['J', 'X']:
        return 8
    if c in ['Q', 'Z']:
        return 10
 
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return(w+' '+str(sum))

words = input().split()

for i in words:
    print(word_point(i))
# 1662452, 2022-10-29 09:58:26, PPP-- (60%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    if c in ['D', 'G']:
        return 2
    if c in ['B', 'C', 'M', 'P']:
        return 3
    if c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    if c in ['K']:
        return 5
    if c in ['J', 'X']:
        return 8
    if c in ['Q', 'Z']:
        return 10
 
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return([sum,w])

words = input().split()

z = []
for i in words:
    z.append(word_point(i))
z.sort()
z = z[::-1]
for i,q in z:
    print(q,i)
# 1664578, 2022-10-29 10:41:14, PPP-- (60%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    if c in ['D', 'G']:
        return 2
    if c in ['B', 'C', 'M', 'P']:
        return 3
    if c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    if c in ['K']:
        return 5
    if c in ['J', 'X']:
        return 8
    if c in ['Q', 'Z']:
        return 10

def more(a,b):
    return a>b
 
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    sum = 0
    for i in w:
        sum += letter_point(i)
    return([sum,w])

words = input().split()
z = []
for i in words:
    z.append(word_point(i))
out = []
for i in z:
    out.append(i[::-1])
out.sort()

c =[]
for i,q in out:
    c.append([q,i])
c.sort()
c = c[::-1]
for i,q in c:
    print(q,i)

6530048821
# 1661500, 2022-10-29 09:26:12, P---- (20%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10

def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    lst = list(w)
    point = 0
    for i in lst:
        point += letter_point(i)
    return point

words = str(input()).split()
words = sorted(words)
for i in words[::-1]:
    print('{} {}'.format(i,word_point(i)))

# 1661515, 2022-10-29 09:26:41, PP-P- (60%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10

def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    lst = list(w)
    point = 0
    for i in lst:
        point += letter_point(i)
    return point

words = str(input()).split()
words = sorted(words)
for i in words:
    print('{} {}'.format(i,word_point(i)))

# 1661663, 2022-10-29 09:31:02, PPP-- (60%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10

def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    lst = list(w)
    point = 0
    for i in lst:
        point += letter_point(i)
    return point

words = str(input()).split()
lst = []
for i in words:
    lst.append([word_point(i),i])
lst = sorted(lst)
lst = lst[::-1]
for i in lst:
    print('{} {}'.format(i[1],i[0]))

6530050021
# 1661268, 2022-10-29 09:17:49, P---- (20%)

a = input().split()
for e in a:
    c = 0
    for i in e:
        if i in "AEILNORSTU":
            c += 1
        elif i in "DG":
            c += 2
        elif i in "BCMP":
            c += 3
        elif i in "FHVWY":
            c += 4
        elif i in "K":
            c += 5
        elif i in "JX":
            c += 8
        elif i in "QZ":
            c += 10
    print(e,c)
            
# 1662945, 2022-10-29 10:13:13, ----- (0%)

a = input().split()

x = []
for e in a:
    c = 0
    for i in e:
        if i in "AEILNORSTU":
            c += 1
        elif i in "DG":
            c += 2
        elif i in "BCMP":
            c += 3
        elif i in "FHVWY":
            c += 4
        elif i in "K":
            c += 5
        elif i in "JX":
            c += 8
        elif i in "QZ":
            c += 10
    x.append([c,e])
    
x.sort()
x = x[::-1]
y = []
for e in x:
    print(e[::-1])
    
# 1662969, 2022-10-29 10:13:59, PPP-- (60%)

a = input().split()

x = []
for e in a:
    c = 0
    for i in e:
        if i in "AEILNORSTU":
            c += 1
        elif i in "DG":
            c += 2
        elif i in "BCMP":
            c += 3
        elif i in "FHVWY":
            c += 4
        elif i in "K":
            c += 5
        elif i in "JX":
            c += 8
        elif i in "QZ":
            c += 10
    x.append([c,e])
    
x.sort()
x = x[::-1]
y = []
for e in x:
    print(e[1],e[0])
    

6530055121
# 1661693, 2022-10-29 09:32:30, PPP-- (60%)

def letter_point(x):
    one = "AEILNORSTU"
    two = "DG"
    three = "BCMP"
    four = "FHVWY"
    five = "K"
    eight = "JX"
    ten = "QZ"
    c = 0
    for e in x:
        if e in one:
            c += 1
        elif e in two:
            c += 2
        elif e in three:
            c += 3
        elif e in four:
            c +=4
        elif e in five:
            c += 5
        elif e in eight:
            c += 8
        elif e in ten:
            c += 10
    return c
def sort(x):
    d = []
    for i in range(len(x)):
        d.append([letter_point(x[i]),x[i]])
        d.sort()
        d = d[::-1]
    for i in range(len(d)):
        print(d[i][1]+" "+str(d[i][0]))

word = input().split()
sort(word)
# 1664127, 2022-10-29 10:37:03, xxxxx (0%)

def letter_point(x):
    one = "AEILNORSTU"
    two = "DG"
    three = "BCMP"
    four = "FHVWY"
    five = "K"
    eight = "JX"
    ten = "QZ"
    c = 0
    for e in x:
        if e in one:
            c += 1
        elif e in two:
            c += 2
        elif e in three:
            c += 3
        elif e in four:
            c +=4
        elif e in five:
            c += 5
        elif e in eight:
            c += 8
        elif e in ten:
            c += 10
    return c
def sort(x):
    d = []
    for i in range(len(x)):
        d.append([letter_point(x[i]),x[i]])
        d.sort()
        d = d[::-1]
    for i in range(len(d)):
        print(d[i][1]+" "+str(d[i][0]))

word = input().split()
word = word.sort()
sort(word)
# 1664157, 2022-10-29 10:37:22, PPP-- (60%)

def letter_point(x):
    one = "AEILNORSTU"
    two = "DG"
    three = "BCMP"
    four = "FHVWY"
    five = "K"
    eight = "JX"
    ten = "QZ"
    c = 0
    for e in x:
        if e in one:
            c += 1
        elif e in two:
            c += 2
        elif e in three:
            c += 3
        elif e in four:
            c +=4
        elif e in five:
            c += 5
        elif e in eight:
            c += 8
        elif e in ten:
            c += 10
    return c
def sort(x):
    d = []
    for i in range(len(x)):
        d.append([letter_point(x[i]),x[i]])
        d.sort()
        d = d[::-1]
    for i in range(len(d)):
        print(d[i][1]+" "+str(d[i][0]))

word = input().split()
word.sort()
sort(word)

6530056821
# 1662025, 2022-10-29 09:45:00, ----- (0%)

A = ['A', 'E', 'I', 'L','N','O','R','S','T','U']
B = ['D', 'G']
C = ['B','C','M','P']
D = ['F','H','V','W','Y']
E = ['K']
F = ['J','X']
G = ['Q','Z']

def lp(l):
    if l in A:
        return 1
    if l in B:
        return 2
    if l in C:
        return 3
    if l in D:
        return 4
    if l in E:
        return 5
    if l in F:
        return 8
    if l in G:
        return 10
    
def wp(w):
    p = 0
    for l in w:
        p += lp(l)
    return(p)

ws = input().split()
l = []
ws.sort()
for w in ws:
    l.append([wp(w),w])
    print(wp(w))
l = sorted(l)
for x in l:
    print(str(x[1]),x[0])








# 1662051, 2022-10-29 09:45:36, P---- (20%)

A = ['A', 'E', 'I', 'L','N','O','R','S','T','U']
B = ['D', 'G']
C = ['B','C','M','P']
D = ['F','H','V','W','Y']
E = ['K']
F = ['J','X']
G = ['Q','Z']

def lp(l):
    if l in A:
        return 1
    if l in B:
        return 2
    if l in C:
        return 3
    if l in D:
        return 4
    if l in E:
        return 5
    if l in F:
        return 8
    if l in G:
        return 10
    
def wp(w):
    p = 0
    for l in w:
        p += lp(l)
    return(p)

ws = input().split()
l = []
ws.sort()
for w in ws:
    l.append([wp(w),w])
l.sort()
for x in l:
    print(str(x[1]),x[0])
    
    
    

# 1662078, 2022-10-29 09:46:32, PPP-- (60%)

A = ['A', 'E', 'I', 'L','N','O','R','S','T','U']
B = ['D', 'G']
C = ['B','C','M','P']
D = ['F','H','V','W','Y']
E = ['K']
F = ['J','X']
G = ['Q','Z']

def lp(l):
    if l in A:
        return 1
    if l in B:
        return 2
    if l in C:
        return 3
    if l in D:
        return 4
    if l in E:
        return 5
    if l in F:
        return 8
    if l in G:
        return 10
    
def wp(w):
    p = 0
    for l in w:
        p += lp(l)
    return(p)

ws = input().split()
l = []
ws.sort()
for w in ws:
    l.append([wp(w),w])
l.sort(reverse = True)
for x in l:
    print(str(x[1]),x[0])
    
    
    


6530068321
# 1661785, 2022-10-29 09:36:36, ----- (0%)

def letter_point(c):
    point1=['A','E','I','L','N','O','R','S','T','U']
    point2=['D','G'
]
    point3=['B','C','M','P']
    point4=['F','H','V','W','Y'
]
    point5=['K'
]
    point8=['J','X'
]
    point10=['Q','Z'
]
    psum=0
    for i in range(len(c)):
        if c[i] in point1:psum+=1
        if c[i] in point2:psum+=2
        if c[i] in point3:psum+=3
        if c[i] in point4:psum+=4
        if c[i] in point5:psum+=5
        if c[i] in point8:psum+=8
        if c[i] in point10:psum+=10
    return psum
# 1662243, 2022-10-29 09:51:37, compilation error (0%)

def letter_point(c):
    point1=['A','E','I','L','N','O','R','S','T','U']
    point2=['D','G']
    point3=['B','C','M','P']
    point4=['F','H','V','W','Y']
    point5=['K']
    point8=['J','X']
    point10=['Q','Z'
    psum=0
    for i in range(len(c)):
        if c[i] in point1:psum+=1
        elif c[i] in point2:psum+=2
        elif c[i] in point3:psum+=3
        elif c[i] in point4:psum+=4
        elif c[i] in point5:psum+=5
        elif c[i] in point8:psum+=8
        elif c[i] in point10:psum+=10
    return psum
def word_point(words):
    x=[]
    for i in range(len(words)) :
        x.append([letter_point(words[i]),words[i]])
    y=sorted(x)
    for i in range(len(y)):
        print(y[-1::-1][i][1],yy[-1::-1][i][0])
# 1662270, 2022-10-29 09:52:29, PPP-- (60%)

def letter_point(c):
    point1=['A','E','I','L','N','O','R','S','T','U']
    point2=['D','G']
    point3=['B','C','M','P']
    point4=['F','H','V','W','Y']
    point5=['K']
    point8=['J','X']
    point10=['Q','Z']
    psum=0
    for i in range(len(c)):
        if c[i] in point1:psum+=1
        elif c[i] in point2:psum+=2
        elif c[i] in point3:psum+=3
        elif c[i] in point4:psum+=4
        elif c[i] in point5:psum+=5
        elif c[i] in point8:psum+=8
        elif c[i] in point10:psum+=10
    return psum
def word_point(words):
    x=[]
    for i in range(len(words)) :
        x.append([letter_point(words[i]),words[i]])
    y=sorted(x)
    for i in range(len(y)):
        print(y[-1::-1][i][1],y[-1::-1][i][0])
words = input().split()
word_point(words)


6530070521
# 1662317, 2022-10-29 09:54:06, PP-P- (60%)

words = input()

def letter_point(c):
    score = {'A': 1, 'E': 1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
    word_score = 0
    for i in range(len(c)):
        word_score += score[c[i]]
    return word_score


def word_point(w):
    words_list = []
    words = w.split(' ')
    score_list = {}
    for j in range(len(words)):
        words_list.append(words[j])
    for k in range(len(words_list)):
        for i in range(len(words_list[k])):
            score_list[words[k]] = 0
        for i in range(len(words_list[k])):
            score_list[words[k]] += int(letter_point(words_list[k][i]))
    return score_list

score_list = word_point(words)
word_score_list = sorted(score_list)
for i in range(len(word_score_list)):
    print(word_score_list[i], score_list[word_score_list[i]])
    

# 1662442, 2022-10-29 09:58:15, P---- (20%)

words = input()

def letter_point(c):
    score = {'A': 1, 'E': 1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
    word_score = 0
    for i in range(len(c)):
        word_score += score[c[i]]
    return word_score


def word_point(w):
    words_list = []
    words = w.split(' ')
    score_list = {}
    for j in range(len(words)):
        words_list.append(words[j])
    for k in range(len(words_list)):
        for i in range(len(words_list[k])):
            score_list[words[k]] = 0
        for i in range(len(words_list[k])):
            score_list[words[k]] += int(letter_point(words_list[k][i]))
    return score_list

score_list = word_point(words)
word_score_list = sorted(score_list)
word_score_list = word_score_list[::-1]
for i in range(len(word_score_list)):
    print(word_score_list[i], score_list[word_score_list[i]])
  
# 1663821, 2022-10-29 10:32:11, PP-P- (60%)

words = input()

def letter_point(c):
    score = {'A': 1, 'E': 1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10}
    word_score = 0
    for i in range(len(c)):
        word_score += score[c[i]]
    return word_score


def word_point(w):
    words_list = []
    words = w.split(' ')
    score_list = {}
    for j in range(len(words)):
        words_list.append(words[j])
    for k in range(len(words_list)):
        for i in range(len(words_list[k])):
            score_list[words[k]] = 0
        for i in range(len(words_list[k])):
            score_list[words[k]] += int(letter_point(words_list[k][i]))
    return score_list

score_list = word_point(words)
word_score_list = sorted(score_list)
for i in range(len(word_score_list)):
    print(word_score_list[i], score_list[word_score_list[i]])
    


6530116821
# 1661428, 2022-10-29 09:24:10, ----- (0%)

def letter_point(c):
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
score=[]
for i in words:
    score.append([word_point(i),i])
score.sort()
sc=score[-1::-1]
for i,j in sc:
    print(i,j)
# 1661456, 2022-10-29 09:25:06, PPP-- (60%)

def letter_point(c):
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
score=[]
for i in words:
    score.append([word_point(i),i])
score.sort()
sc=score[-1::-1]
for i,j in sc:
    print(j,i)
# 1661495, 2022-10-29 09:26:04, PPP-- (60%)

def letter_point(c):
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B', 'C', 'M', 'P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10
    else:
      return 0
def word_point(w):
    sum=0
    for i in w:
        sum+=letter_point(i)
    return sum
words = input().split()
score=[]
for i in words:
    score.append([word_point(i),i])
score.sort()
sc=score[-1::-1]
for i,j in sc:
    print(j,i)

6530147221
# 1661648, 2022-10-29 09:30:44, PPP-- (60%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    al = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
    return al[c]
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    total = 0
    for j in w:
        total += letter_point(j)
    return total
    
words = input().split()
ans = []
for i in range(len(words)):
    totals = word_point(words[i])
    ans.append([totals, words[i]])
ans.sort()
ans = ans[::-1]
for i in ans:
    print(i[1], i[0])


# 1663447, 2022-10-29 10:24:55, P---- (20%)


def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    al = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
    return al[c]
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    total = 0
    for j in w:
        total += letter_point(j)
    return total
    
words = input().split()
ans = []
ams = []
for i in range(len(words)):
    totals = word_point(words[i])
    ans.append([totals, words[i]])



ans.sort()
ans = ans[::-1]
max = ans[0]
if len(ans) == 3:
    q = ans[1:]
    q.sort()
    print(max[1], max[0])
    for i in q:
        print(i[1], i[0])
elif len(ans) == 5:
    min = ans[4]
    p = ans[1:4]
    print(max[1], max[0])
    p.sort()
    for i in p:
        print(i[1], i[0])
    print(min[1], min[0])
else:
    print(max[1], max[0])
# 1664634, 2022-10-29 10:41:51, PPP-- (60%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    al = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
    return al[c]
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    total = 0
    for j in w:
        total += letter_point(j)
    return total
    
words = input().split()
ans = []
for i in range(len(words)):
    totals = word_point(words[i])
    ans.append([totals, words[i]])
ans.sort()
ans = ans[::-1]
for i in ans:
    print(i[1], i[0])

6530179321
# 1661917, 2022-10-29 09:41:01, PPP-- (60%)

words = input().split()
points = 0
ans = []
onep = 'AEILNORSTU'
twop = 'DG'
threep = 'BCMP'
fourp = 'FHVWY'
fivep = 'K'
eightp = 'JX'
tenp = 'QZ'
for i in range(len(words)):
    for j in words[i]:
        if j in onep:
            points += 1
        elif j in twop:
            points += 2
        elif j in threep:
            points += 3
        elif j in fourp:
            points += 4
        elif j in fivep:
            points += 5
        elif j in eightp:
            points += 8
        elif j in tenp:
            points += 10
    ans.append(points)
    points = 0
f_ans = []
for i in range(len(words)):
    f_ans.append([ans[i], words[i]])
f_ans.sort()
f_ans = f_ans[::-1]
for k in range(len(f_ans)):
    print(f_ans[k][1].upper(), f_ans[k][0])
# 1662338, 2022-10-29 09:54:46, PP-P- (60%)

words = input().split()
points = 0
ans = []
onep = 'AEILNORSTU'
twop = 'DG'
threep = 'BCMP'
fourp = 'FHVWY'
fivep = 'K'
eightp = 'JX'
tenp = 'QZ'
for i in range(len(words)):
    for j in words[i]:
        if j in onep:
            points += 1
        elif j in twop:
            points += 2
        elif j in threep:
            points += 3
        elif j in fourp:
            points += 4
        elif j in fivep:
            points += 5
        elif j in eightp:
            points += 8
        elif j in tenp:
            points += 10
    ans.append(points)
    points = 0
f_ans = []
f_ans2 = []
for i in range(len(words)):
    f_ans.append([ans[i], words[i]])
    f_ans2.append(words[i])
f_ans.sort()
f_ans2.sort()
f_ans = f_ans[::-1]

    
for k in range(len(f_ans)):
    print(f_ans2[k].upper(), f_ans[k][0])
# 1662386, 2022-10-29 09:56:35, PPP-- (60%)

words = input().split()
points = 0
ans = []
onep = 'AEILNORSTU'
twop = 'DG'
threep = 'BCMP'
fourp = 'FHVWY'
fivep = 'K'
eightp = 'JX'
tenp = 'QZ'
for i in range(len(words)):
    for j in words[i]:
        if j in onep:
            points += 1
        elif j in twop:
            points += 2
        elif j in threep:
            points += 3
        elif j in fourp:
            points += 4
        elif j in fivep:
            points += 5
        elif j in eightp:
            points += 8
        elif j in tenp:
            points += 10
    ans.append(points)
    points = 0
f_ans = []
f_ans2 = []
for i in range(len(words)):
    f_ans.append([ans[i], words[i]])
    f_ans2.append([words[i]])
f_ans.sort()
f_ans2.sort()
f_ans = f_ans[::-1]

    
for k in range(len(f_ans)):
    print(f_ans[k][1].upper(), f_ans[k][0])

6230148621
# 1662119, 2022-10-29 09:48:00, P---- (20%)

def letter_point(c):
    point_one = "AEILNORSTU"
    point_two = "DG"
    point_three = "BCMP"
    point_four = "FHVWY"
    point_five = "K"
    point_eight = "JX"
    point_ten = "QZ"
    if c in point_one:
        return 1
    elif c in point_two:
        return 2
    elif c in point_three:
        return 3
    elif c in point_four:
        return 4
    elif c in point_five:
        return 5
    elif c in point_eight:
        return 8
    elif c in point_ten:
        return 10
    return 0
def word_point(w):
    sum = 0
    for c in w:
        sum += letter_point(c)
    return sum
words = input().split()
for w in words:
    print(w, word_point(w))

# 1664432, 2022-10-29 10:40:06, PPP-- (60%)

def letter_point(c):
    point_one = "AEILNORSTU"
    point_two = "DG"
    point_three = "BCMP"
    point_four = "FHVWY"
    point_five = "K"
    point_eight = "JX"
    point_ten = "QZ"
    if c in point_one:
        return 1
    elif c in point_two:
        return 2
    elif c in point_three:
        return 3
    elif c in point_four:
        return 4
    elif c in point_five:
        return 5
    elif c in point_eight:
        return 8
    elif c in point_ten:
        return 10
    return 0
def word_point(w):
    sum = 0
    for c in w:
        sum += letter_point(c)
    return sum
words = input().split()
word_points = []
for w in words:
    word_points.append([w, word_point(w)])
# sort word_points by point in descending order
word_points.sort(key=lambda x: x[1], reverse=True)
for key, val in word_points:
    print(key, val)

6231718521
# 1661747, 2022-10-29 09:34:59, P---- (20%)

def point(word):
    score=0
    for i in range(len(word)):
        if word[i] in 'AEILNORSTU':
            score+=1
        if word[i] in 'DG':
            score+=2
        if word[i] in 'BCMP':
            score+=3
        if word[i] in 'FHVWY':
            score+=4
        if word[i] in 'K':
            score+=5
        if word[i] in 'JX':
            score+=8
        if word[i] in 'QZ':
            score+=10
    return [score,word]
def arrange(words):
    point_word=[]
    for i in range(len(words)):
        point_word.append(point(words[i]))
        point_word_new=sorted(point_word)[::-1]
    for j in range(len(point_word_new)):
        return point_word_new[j][1]+' '+str(point_word_new[j][0])
        
words = input().split()
print(arrange(words))

# 1661802, 2022-10-29 09:37:37, PPP-- (60%)

def point(word):
    score=0
    for i in range(len(word)):
        if word[i] in 'AEILNORSTU':
            score+=1
        if word[i] in 'DG':
            score+=2
        if word[i] in 'BCMP':
            score+=3
        if word[i] in 'FHVWY':
            score+=4
        if word[i] in 'K':
            score+=5
        if word[i] in 'JX':
            score+=8
        if word[i] in 'QZ':
            score+=10
    return [score,word]
def arrange(words):
    point_word=[]
    for i in range(len(words)):
        point_word.append(point(words[i]))
        point_word_new=sorted(point_word)[::-1]
    for j in range(len(point_word_new)):
        print( point_word_new[j][1]+' '+str(point_word_new[j][0]))
        
words = input().split()
arrange(words)

6231417621
# 1661719, 2022-10-29 09:33:21, PPP-- (60%)

p1=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2=['D', 'G'
]
p3=['B', 'C', 'M', 'P']
p4=['F', 'H', 'V', 'W', 'Y']
p5=['K']
p8=['J', 'X']
p10=['Q', 'Z']
a=input()
word=a.split()



def letter_point(word):

    cnt=0
    for i in word:
        s=list(i)
        for i in s:
            if i in p1:
                cnt+=1
            elif i in p2:
                cnt+=2
            elif i in p3:
                cnt+=3
            elif i in p4:
                cnt+=4
            elif i in p5:
                cnt+=5
            elif i in p8:
                cnt+=8
            elif i in p10:
                cnt+=10
    return cnt
u=[]
for i in word:
    u+=[[letter_point(i),i]]
    u.sort(reverse=True)

out=[]
for a,b in u:
    out.append([b,a])

for i in range(len(out)):
    print(out[i][0],out[i][1])


# 1664442, 2022-10-29 10:40:08, xxxP- (20%)

#SECOND_quiz
p1=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2=['D', 'G'
]
p3=['B', 'C', 'M', 'P']
p4=['F', 'H', 'V', 'W', 'Y']
p5=['K']
p8=['J', 'X']
p10=['Q', 'Z']
a=input()
word=a.split()



def letter_point(word):

    cnt=0
    for i in word:
        s=list(i)
        for i in s:
            if i in p1:
                cnt+=1
            elif i in p2:
                cnt+=2
            elif i in p3:
                cnt+=3
            elif i in p4:
                cnt+=4
            elif i in p5:
                cnt+=5
            elif i in p8:
                cnt+=8
            elif i in p10:
                cnt+=10
    return cnt
u=[]
for i in word:
    u+=[[letter_point(i),i]]
    u.sort(reverse=True)
#ถ้าคะแนนเท่า u ที่เรียงตามคะแนน
point=[]
for i in u:
    point+= [i[0]]
position=[]
for i in range(len(point)-1):
    if point[i]==point[i+1]:
        position+=[i]+[i+1]
        
same=u[position[0]:position[-1]+1:]
samesort=[]
for a,b in same:
    samesort.append([b,a])
    samesort.sort()




out=[]
for a,b in u:
    out.append([b,a])
output=out[:position[0]:]+samesort+out[position[-1]+1::]
for i in range(len(out)):
     print(output[i][0],output[i][1])



6431120321
# 1661415, 2022-10-29 09:23:43, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c.upper() in ['A','E','I','L','N','O','R','S','T','U'
] :
        return 1
    if c.upper() in ['D','G'
] :
        return 2
    if c.upper() in ['B','C','M','P'
] :
        return 3
    if c.upper() in ['F','H','V','W','Y'
] :
        return 4
    if c.upper() in ['K'
] :
        return 5
    if c.upper() in ['J','X'
] :
        return 8
    if c.upper() in ['Q','Z'
] :
        return 10

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    C = 0
    for i in w:
        C += letter_point(i)
    return C

words = input().split()

for i in words:
    print(i , word_point(i))
    
# 1661517, 2022-10-29 09:26:49, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c.upper() in ['A','E','I','L','N','O','R','S','T','U'
] :
        return 1
    if c.upper() in ['D','G'
] :
        return 2
    if c.upper() in ['B','C','M','P'
] :
        return 3
    if c.upper() in ['F','H','V','W','Y'
] :
        return 4
    if c.upper() in ['K'
] :
        return 5
    if c.upper() in ['J','X'
] :
        return 8
    if c.upper() in ['Q','Z'
] :
        return 10

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    C = 0
    for i in w:
        C += letter_point(i)
    return C
U = []
words = input().split()

for i in words:
    U.append([word_point(i),i])
U.sort(reverse=True)
for i,l in U:
    print(l,i)
        

6431510421
# 1661669, 2022-10-29 09:31:13, P---- (20%)

def letter_point(c):
    point = 0
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        point += 1
    elif c in ['D', 'G']:
        point += 2
    elif c in ['B', 'C', 'M', 'P']:
        point += 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        point += 4
    elif c in ['K']:
        point += 5
    elif c in ['J', 'X']:
        point += 8
    elif c in ['Q', 'Z']:
        point += 10
    return point

def word_point(w):
    d = []
    n = 0
    for e in w:
        d.append(e)
    for i in range(len(d)):
        n += int(letter_point(d[i]))
    return n
words = input().split()
d = []
for e in words:
    d.append(e)
n = []
for i in range(len(d)):
    n += [(word_point(d[i]))]

for i in range(len(d)):
    print(d[i],n[i])
        
        
        
        
        
# 1661865, 2022-10-29 09:39:31, PPP-- (60%)

def letter_point(c):
    point = 0
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        point += 1
    elif c in ['D', 'G']:
        point += 2
    elif c in ['B', 'C', 'M', 'P']:
        point += 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        point += 4
    elif c in ['K']:
        point += 5
    elif c in ['J', 'X']:
        point += 8
    elif c in ['Q', 'Z']:
        point += 10
    return point

def word_point(w):
    d = []
    n = 0
    for e in w:
        d.append(e)
    for i in range(len(d)):
        n += int(letter_point(d[i]))
    return n
words = input().split()
d = []
for e in words:
    d.append(e)
n = []
for i in range(len(d)):
    n += [(word_point(d[i]))]
z = []
for i in range(len(d)):
    z += [[n[i],d[i]]]
z.sort()
z = z[::-1]
for i in range(len(z)):
    print(z[i][1],z[i][0])

6430382221
# 1662819, 2022-10-29 10:09:27, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    k = 0
    for i in c:
        if i in ['a','e','i','l','n','o','r','s','t','u']:
            k+=1
        if i in ['d','g']:
            k+=2
        if i in['b','c','m','p']:
            k +=3
        if i  in ['f','h','v','w','y']:
            k +=4
        if i in ['k']:
            k+= 5
        if i in ['j','x']:
            k+=8
        if i in ['q','z']:
            k +=10
    return k
xa = []
words = input().split()
for i in words:
    i = i.lower()
    xa.append([i.upper(),letter_point(i)])

for i in range(len(xa)):
    xa[i][0],xa[i][1] =xa[i][1],xa[i][0]

xa.sort(reverse=True)


for i in range(len(xa)):
    xa[i][0],xa[i][1] =xa[i][1],xa[i][0]

for i in range(len(xa)):
    print(xa[i][0], xa[i][1])
# 1662827, 2022-10-29 10:09:49, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    k = 0
    for i in c:
        if i in ['a','e','i','l','n','o','r','s','t','u']:
            k+=1
        if i in ['d','g']:
            k+=2
        if i in['b','c','m','p']:
            k +=3
        if i  in ['f','h','v','w','y']:
            k +=4
        if i in ['k']:
            k+= 5
        if i in ['j','x']:
            k+=8
        if i in ['q','z']:
            k +=10
    return k
xa = []
words = input().split()
for i in words:
    i = i.lower()
    xa.append([i.upper(),letter_point(i)])

for i in range(len(xa)):
    xa[i][0],xa[i][1] =xa[i][1],xa[i][0]

xa.sort(reverse=True)


for i in range(len(xa)):
    xa[i][0],xa[i][1] =xa[i][1],xa[i][0]

for i in range(len(xa)):
    print(xa[i][0], xa[i][1])

6530026021
# 1661391, 2022-10-29 09:22:42, P---- (20%)

def letter_point(c):
    if c == 'A' or c == 'E' or c == 'I' or c == 'L' or c == 'N' or c == 'O' or c == 'R' or c == 'S' or c == 'T' or c == 'U' :
        s = 1
    if c == 'D' or c == 'G' :
        s = 2
    if c == 'B' or c == 'C' or c == 'M' or c == 'P' :
        s = 3
    if c == 'F' or c == 'H' or c == 'V' or c == 'W' or c == 'Y' :
        s = 4
    if c == 'K' :
        s = 5
    if c == 'J' or c == 'X' :
        s = 8
    if c == 'Q' or c == 'Z' :
        s = 10
    return s

def word_point(w):
    t = 0
    for i in w :
        s = letter_point(i)
        t += s
    return t

words = input().split()

for e in words :
    print(e, word_point(e))
# 1661542, 2022-10-29 09:27:40, PPP-- (60%)

def letter_point(c):
    if c == 'A' or c == 'E' or c == 'I' or c == 'L' or c == 'N' or c == 'O' or c == 'R' or c == 'S' or c == 'T' or c == 'U' :
        s = 1
    if c == 'D' or c == 'G' :
        s = 2
    if c == 'B' or c == 'C' or c == 'M' or c == 'P' :
        s = 3
    if c == 'F' or c == 'H' or c == 'V' or c == 'W' or c == 'Y' :
        s = 4
    if c == 'K' :
        s = 5
    if c == 'J' or c == 'X' :
        s = 8
    if c == 'Q' or c == 'Z' :
        s = 10
    return s

def word_point(w):
    t = 0
    for i in w :
        s = letter_point(i)
        t += s
    return t

words = input().split()

a = []
for e in words :
    a.append([word_point(e), e])
a.sort()
b = a[-1::-1]
for x in b :
    print(x[1], x[0])


6530398421
# 1662859, 2022-10-29 10:10:42, ----- (0%)

a = input().split()
A = "AEILNORSTU"
B = "DG"
C = "BCMP"
D = "FHVWY"
E = "K"
F = "JX"
G = "QZ"
score = []
for i in range(len(a)):
    score_not = 0
    for j in range(len(a[i])):
        if a[i][j] in A:
            score_not += 1
        if a[i][j] in B:
            score_not += 2
        if a[i][j] in C:
            score_not += 3
        if a[i][j] in D:
            score_not += 4
        if a[i][j] in E:
            score_not += 5
        if a[i][j] in F:
            score_not += 8
        if a[i][j] in G:
            score_not += 10
    score += [score_not]
score_word = []
for h in range(len(a)):
    score_word += [[score[h],a[h]]]
score_word.sort()
new_score = score_word[-1::-1]
final = []
repeat = []
score_control = []
for u in range(len(new_score)-1):
    score_control += [new_score[u][0]]
    if new_score[u][0]==new_score[u+1][0]:
        repeat += [new_score[u]]
    elif new_score[u][0]==new_score[u-1][0]:
        repeat += [new_score[u]]
score_control += [new_score[-1][0]]
new_repeat =[]
for l in range(len(repeat)):
    new_repeat += [repeat[l][1]]
new_repeat.sort()
# 1663157, 2022-10-29 10:18:32, PPP-- (60%)

a = input().split()
A = "AEILNORSTU"
B = "DG"
C = "BCMP"
D = "FHVWY"
E = "K"
F = "JX"
G = "QZ"
score = []
for i in range(len(a)):
    score_not = 0
    for j in range(len(a[i])):
        if a[i][j] in A:
            score_not += 1
        if a[i][j] in B:
            score_not += 2
        if a[i][j] in C:
            score_not += 3
        if a[i][j] in D:
            score_not += 4
        if a[i][j] in E:
            score_not += 5
        if a[i][j] in F:
            score_not += 8
        if a[i][j] in G:
            score_not += 10
    score += [score_not]
score_word = []
for h in range(len(a)):
    score_word += [[score[h],a[h]]]
score_word.sort()
new_score = score_word[-1::-1]
for k in range(len(new_score)):
    print(new_score[k][1],new_score[k][0],"\n")

6531519221
# 1661712, 2022-10-29 09:33:07, P---- (20%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
  score = 0
  for k in range(len(c)):  
    if c[k] in ['A','E','I','L','N','O','R','S','T','U']:
        score+=1
    if c[k] in ['D','G']:
        score+=2
    if c[k] in ['B','C','M','P']:
        score+=3
    if c[k] in ['F','H','W','Y','V']:
        score+=4
    if c[k] in ['K']:
        score+=5
    if c[k] in ['J','X']:
        score+=8
    if c[k] in ['Q','Z']:
        score+=10

  return score
def word_point(w):
# คืนคะแนนของคําที่เก็บในตั
    s = []
    for i in w:
        s.append(letter_point(i))
    return s
word = input().split()
w = word_point(word)
for i in range(len(word)):
    print(word[i]+' '+str(w[i]))
# 1662706, 2022-10-29 10:06:25, PPP-- (60%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
  score = 0
  for k in range(len(c)):  
    if c[k] in ['A','E','I','L','N','O','R','S','T','U']:
        score+=1
    if c[k] in ['D','G']:
        score+=2
    if c[k] in ['B','C','M','P']:
        score+=3
    if c[k] in ['F','H','W','Y','V']:
        score+=4
    if c[k] in ['K']:
        score+=5
    if c[k] in ['J','X']:
        score+=8
    if c[k] in ['Q','Z']:
        score+=10

  return score
def word_point(w):
# คืนคะแนนของคําที่เก็บในตั
    s = []
    for i in w:
        s.append(letter_point(i))
    return s
w = []
word = input().split()
s = word_point(word)
for i in range(len(word)):
    w.append([s[i],word[i]])

w.sort()
for i in range(-1,-(len(word)+1),-1):
    print(w[i][1]+' '+str(w[i][0]))

6530053921
# 1661778, 2022-10-29 09:36:10, PPP-- (60%)

T = input().split()
txt = [list(i) for i in T]
P = []
for i in txt :
    p = []
    for j in i :
        if j in 'AEILNORSTU':
            p.append(1)
        if j in 'DG':
            p.append(2)
        if j in 'BCMP':
            p.append(3)
        if j in 'FHVWY':
            p.append(4)
        if j == 'K':
            p.append(5)
        if j in 'JX':
            p.append(8)
        if j in 'QZ':
            p.append(10)
    P.append(p)
RP = []
for i in range(len(P)):
    RP.append([sum(P[i]),T[i]])
RP.sort()
RP = RP[::-1]
for i in range(len(RP)):
    print(RP[i][1],RP[i][0])
# 1663712, 2022-10-29 10:30:10, PPP-- (60%)

T = input().split()
txt = [list(i) for i in T]
P = []
for i in txt :
    p = []
    for j in i :
        if j in 'AEILNORSTU':
            p.append(1)
        if j in 'DG':
            p.append(2)
        if j in 'BCMP':
            p.append(3)
        if j in 'FHVWY':
            p.append(4)
        if j == 'K':
            p.append(5)
        if j in 'JX':
            p.append(8)
        if j in 'QZ':
            p.append(10)
    P.append(p)
RP = []
for i in range(len(P)):
    RP.append([sum(P[i]),T[i]])
RP.sort()
RP = RP[::-1]
for i in range(len(RP)):
    print(RP[i][1],str(RP[i][0]) + '\n')

6530063121
# 1661301, 2022-10-29 09:19:24, P---- (20%)

def point(x):
    s=0
    for k in x:
        if k in "AEILNORSTU":
            s+=1
        elif k in "DG":
            s+=2
        elif k in "BCMP":
            s+=3
        elif k in "FHVWY":
            s+=4
        elif k in "K":
            s+=5
        elif k in "JX":
            s+=8
        elif k in "QZ":
            s+=10
    return s
i=input().split()
for j in i:
    ans=0
    ans+= point(j)
    print(j,ans)
    
    
            
        

# 1661540, 2022-10-29 09:27:40, PPP-- (60%)

def point(x):
    s=0
    for k in x:
        if k in "AEILNORSTU":
            s+=1
        elif k in "DG":
            s+=2
        elif k in "BCMP":
            s+=3
        elif k in "FHVWY":
            s+=4
        elif k in "K":
            s+=5
        elif k in "JX":
            s+=8
        elif k in "QZ":
            s+=10
    return s
i=input().split()
l=[]
for j in i:
    ans=0
    ans+= point(j)
    l.append([ans,j])
y=sorted(l)[::-1]
for yy in y:
    print(yy[1],yy[0])
    
    
            
        


6530073421
# 1661688, 2022-10-29 09:32:21, P---- (20%)

def letter_point(c):
    alpha1 = ["A","E","I","L","N","O","R","S","T","U"]
    score1 = [1]
    alpha2 = ["D","G"]
    score2 = [2]
    alpha3 = ["B","C","M","P"]
    score3 = [3]
    alpha4 = ["F","H","V","W","Y"]
    score4 = [4]
    alpha5 = ["K"]
    score5 = [5]
    alpha8 = ["J","X"]
    score8 = [8]
    alpha10 = ["Q","Z"]
    score10 = [10]
    if  c in alpha1:
        return score1[0]
    elif c in alpha2:
        return score2[0]
    elif c in alpha3:
        return score3[0]
    elif c in alpha4:
        return score4[0]
    elif c in alpha5:
        return score5[0]
    elif c in alpha8:
        return score8[0]
    elif c in alpha10:
        return score10[0]
def word_point(w):
    c = 0
    for i in w:
        c += letter_point(i)
    return c

words = input().split()
a = []
z = []
for i in words:
    b =[]
    b.append(i)
    b.append(word_point(i))
    a.append(b)
for e in a:
    e = e[::-1]
    z.append(e)
for i in range (len(z)):
    print (z[i][1],z[i][0])

    

    
# 1662165, 2022-10-29 09:49:27, PPP-- (60%)

def letter_point(c):
    alpha1 = ["A","E","I","L","N","O","R","S","T","U"]
    score1 = [1]
    alpha2 = ["D","G"]
    score2 = [2]
    alpha3 = ["B","C","M","P"]
    score3 = [3]
    alpha4 = ["F","H","V","W","Y"]
    score4 = [4]
    alpha5 = ["K"]
    score5 = [5]
    alpha8 = ["J","X"]
    score8 = [8]
    alpha10 = ["Q","Z"]
    score10 = [10]
    if  c in alpha1:
        return score1[0]
    elif c in alpha2:
        return score2[0]
    elif c in alpha3:
        return score3[0]
    elif c in alpha4:
        return score4[0]
    elif c in alpha5:
        return score5[0]
    elif c in alpha8:
        return score8[0]
    elif c in alpha10:
        return score10[0]
def word_point(w):
    c = 0
    for i in w:
        c += letter_point(i)
    return c

words = input().split()
a = []
z = []
for i in words:
    b =[]
    b.append(i)
    b.append(word_point(i))
    a.append(b)
for e in a:
    e = e[::-1]
    z.append(e)
for i in range (len(z)):
    z[i][0] = int(z[i][0])
z.sort()
y =[]
for i in z[::-1]:
    y.append(i)
for i in range (len(y)):
    print (y[i][1],y[i][0])

    



6530074021
# 1662214, 2022-10-29 09:50:47, P---- (20%)

a=input().split()
b=''
countw=0
counts=[]
word=[]
d=[]
t=[]
for i in a:
    b+=i
    word.append(b)
    for e in b:
        if e in 'AEILNORSTU':
            countw+=1
        elif e in 'DG':
            countw+=2
        elif e in 'BCMP':
            countw+=3
        elif e in 'FHVWY':
            countw+=4
        elif e in 'K':
            countw+=5
        elif e in 'JX':
            countw+=8
        elif e in 'QZ':
            countw+=10
    b=''
    countw=str(countw)
    counts.append(countw)
    countw=0
words=[word,counts]
for i in range(len(word)):
    d.append([word[i],counts[i]])
d.sort()
for i in range(-1,-len(d)-1,-1):
    t.append(d[i])
for i in range(len(t)):
    print(t[i][0],t[i][1])
# 1662940, 2022-10-29 10:13:07, PP-P- (60%)

a=input().split()
b=''
countw=0
counts=[]
word=[]
d=[]
t=[]
f=[]
g=[]
for i in a:
    b+=i
    word.append(b)
    for e in b:
        if e in 'AEILNORSTU':
            countw+=1
        elif e in 'DG':
            countw+=2
        elif e in 'BCMP':
            countw+=3
        elif e in 'FHVWY':
            countw+=4
        elif e in 'K':
            countw+=5
        elif e in 'JX':
            countw+=8
        elif e in 'QZ':
            countw+=10
    b=''
    countw=str(countw)
    counts.append(countw)
    countw=0
words=[word,counts]
for i in range(len(word)):
    d.append([word[i],counts[i]])
d.sort()
for i in range(-1,-len(d)-1,-1):
    t.append(d[i])
t.sort()
for i in range(len(t)):
    print(t[i][0],t[i][1])

6530084321
# 1661389, 2022-10-29 09:22:40, xPPPx (60%)

def tt_score(word) :
    score = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
    out = 0
    for e in word :
        out += score[e]
    return out

a = input().split()
out = []
for e in a :
    out += [[tt_score(e)*(-1),e]]
out.sort()
for e in out :
    print(e[1],e[0]*(-1))

# 1662487, 2022-10-29 09:59:19, xPPPx (60%)

def tt_score(word) :
    score = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
    out = 0
    for e in word :
        out += score[e]
    return out

a = input().upper().split()
out = []
for e in a :
    out += [[tt_score(e)*(-1),e]]
out.sort()
for e in out :
    print(e[1],e[0]*(-1))

6530114521
# 1661567, 2022-10-29 09:28:18, PPP-- (60%)

words = input().split()
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
scores = 0
lists = []
for e in words :
    for i in range(len(e)) :
        if e[i] in one :
            scores += 1
        elif e[i] in two :
            scores += 2
        elif e[i] in three :
            scores += 3
        elif e[i] in four :
            scores += 4
        elif e[i] in five :
            scores += 5
        elif e[i] in eight :
            scores += 8
        elif e[i] in ten :
            scores += 10
    lists.append([scores,e])
    scores = 0
lists.sort(reverse = True)
for i in range(len(lists)) :
    print(lists[i][1], lists[i][0])
# 1664081, 2022-10-29 10:36:11, PPP-- (60%)

words = input().split()
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
scores = 0
lists = []
for e in words :
    for i in range(len(e)) :
        if e[i] in one :
            scores += 1
        elif e[i] in two :
            scores += 2
        elif e[i] in three :
            scores += 3
        elif e[i] in four :
            scores += 4
        elif e[i] in five :
            scores += 5
        elif e[i] in eight :
            scores += 8
        elif e[i] in ten :
            scores += 10
    lists.append([scores,e])
    scores = 0
lists.sort(reverse = True)
for i in lists :
    print(i[1],i[0])

6530115121
# 1661791, 2022-10-29 09:37:03, P---- (20%)

point={"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
A=[]
word=input().strip().split()
word.sort()
for i in range(len(word)):
    A.append([word[i],0])
    for e in word[i]:
        A[i][1]+=point[e]
for i in range(-1,-len(A)-1,-1):
    print(A[i][0]+" "+str(A[i][1]))

# 1661905, 2022-10-29 09:40:40, PPP-- (60%)

point={"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,"Q":10,"Z":10}
A=[]
word=input().strip().split()
word.sort()
for i in range(len(word)):
    A.append([0,word[i]])
    for e in word[i]:
        A[i][0]+=point[e]
A.sort()
for i in range(-1,-len(A)-1,-1):
    print(A[i][1]+" "+str(A[i][0]))


6530127721
# 1662511, 2022-10-29 10:00:08, PPP-- (60%)

w = input().split()
a = []
x = []
for i in range(len(w)) :
    a.append([w[i]])
for i in range(len(a)) :
    n = a[i]
    for c in n :
        p = 0
        for ch in c :
            if ch in "AEILNORSTU" :
                p += 1
            elif ch in "DG" :
                p += 2
            elif ch in "BCMP" :
                p += 3
            elif ch in "FHVWY" :
                p += 4
            elif ch in "K" :
                p += 5
            elif ch in "JX" :
                p += 8
            elif ch in "QZ" :
                p += 10
    x.append([p,c])
x.sort()
for c in x[::-1] :
    print(c[1],c[0])

# 1663798, 2022-10-29 10:31:43, PPP-- (60%)

w = input().split()
a = []
x = []
for i in range(len(w)) :
    a.append([w[i]])
for i in range(len(a)) :
    n = a[i]
    for c in n :
        p = 0
        for ch in c :
            if ch in "AEILNORSTU" :
                p += 1
            elif ch in "DG" :
                p += 2
            elif ch in "BCMP" :
                p += 3
            elif ch in "FHVWY" :
                p += 4
            elif ch in "K" :
                p += 5
            elif ch in "JX" :
                p += 8
            elif ch in "QZ" :
                p += 10
    x.append([p,c])
x.sort()
z= []
b = []
for c in x[::-1] :
    if c[0] == 14 :
        z.append([c[1],c[0]])
z.sort()
for c in z:
    b.append([c[1],c[0]])
for i in range(len(b)) :
    x[-i-2] = b[i]
for c in x[::-1] :
    print(c[1],c[0])


6530132821
# 1661797, 2022-10-29 09:37:28, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    score = 0
    for i in range(len(c)):
        if c[i] in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
            score += 1
        elif c[i] in ["D", "G"]:
            score += 2
        elif c[i] in ["B", "C", "M", "P"]:
            score += 3
        elif c[i] in ["F", "H", "V", "W", "Y"]:
            score += 4
        elif c[i] in ["K"]:
            score += 5
        elif c[i] in ["J", "X"]:
            score += 8
        elif c[i] in ["Q", "Z"] :
            score += 10
    return score

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    ans = []
    for i in range(len(w)):
        ans.append([letter_point(w[i]),w[i]])
    ans.sort()
    print (ans)

words = input().split()
word_point(words)

        



# 1661955, 2022-10-29 09:42:29, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    score = 0
    for i in range(len(c)):
        if c[i] in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
            score += 1
        elif c[i] in ["D", "G"]:
            score += 2
        elif c[i] in ["B", "C", "M", "P"]:
            score += 3
        elif c[i] in ["F", "H", "V", "W", "Y"]:
            score += 4
        elif c[i] in ["K"]:
            score += 5
        elif c[i] in ["J", "X"]:
            score += 8
        elif c[i] in ["Q", "Z"] :
            score += 10
    return score

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    ans = []
    for i in range(len(w)):
        ans.append([letter_point(w[i]),w[i]])
    ans.sort()
    ans = ans[::-1]          
    for i in range(len(ans)):
        print(ans[i][1],ans[i][0])

words = input().split()
word_point(words)

        




6530154621
# 1662321, 2022-10-29 09:54:20, P---- (20%)

x=[e for e in input().split()]
score=0
score_list=[]
l=[[1,'A','E','I','L','N','O','R','S','T','U'],[2,'D','G'],
   [3,'B','C','M','P'],[4,'F','H','V','W','Y'],[5,'K'],[8,'J','X'],[10,'Q','Z']]
for i in x:
    for k in i:
        for n in l:
            if k in n:
                score+=int(n[0])
    score_list+=[[score]+[i]]
    score=0
for a in score_list:
    print(str(a[1])+' '+str(a[0]))
# 1662692, 2022-10-29 10:05:54, PPP-- (60%)

x=[e for e in input().split()]
score=0
score_list=[]
l=[[1,'A','E','I','L','N','O','R','S','T','U'],[2,'D','G'],
   [3,'B','C','M','P'],[4,'F','H','V','W','Y'],[5,'K'],[8,'J','X'],[10,'Q','Z']]
for i in x:
    for k in i:
        for n in l:
            if k in n:
                score+=int(n[0])
    score_list+=[[score]+[i]]
    score=0
score_list.sort(reverse=True)
for a in score_list:
    print(str(a[1])+' '+str(a[0]))

6530213021
# 1662225, 2022-10-29 09:51:11, ----- (0%)


points1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
points2 = ['D', 'G']
points3 = ['B', 'C', 'M', 'P']
points4 = ['F', 'H', 'V', 'W', 'Y']
points5 = ['K']
points8 = ['J', 'X']
points10 = ['Q', 'Z']
words = input().split()
total_points = 0
list_of_scores = []
sorted_scores = 0
for each_word in words:
    for letter in each_word:
        if letter in points1:
            total_points += 1
        if letter in points2:
            total_points += 2        
        if letter in points3:
            total_points += 3
        if letter in points4:
            total_points += 4
        if letter in points5:
            total_points += 5
        if letter in points8:
            total_points += 8
        if letter in points10:
            total_points += 10
    list_of_scores.append([total_points, each_word])
    total_points = 0
list_of_scores.sort() #เรียงลำดับคะเเนนเเล้ว #[[16, 'ZEBRA'],[14, 'QUEEN']]
for e in list_of_scores:
    print(str(e[0])+" "+str(e[1]))
# 1663529, 2022-10-29 10:26:32, PPP-- (60%)

points1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
points2 = ['D', 'G']
points3 = ['B', 'C', 'M', 'P']
points4 = ['F', 'H', 'V', 'W', 'Y']
points5 = ['K']
points8 = ['J', 'X']
points10 = ['Q', 'Z']
words = input().split()
total_points = 0
list_of_scores = []
sorted_scores = 0
for each_word in words:
    for letter in each_word:
        if letter in points1:
            total_points += 1
        if letter in points2:
            total_points += 2        
        if letter in points3:
            total_points += 3
        if letter in points4:
            total_points += 4
        if letter in points5:
            total_points += 5
        if letter in points8:
            total_points += 8
        if letter in points10:
            total_points += 10
    list_of_scores.append([total_points, each_word])
    total_points = 0
list_of_scores.sort() #เรียงลำดับคะเเนนเเล้ว #[[16, 'ZEBRA'],[14, 'QUEEN']]
for e in list_of_scores[::-1]:
    print(str(e[1])+" "+str(e[0]))

6531342421
# 1661412, 2022-10-29 09:23:40, PP--- (40%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'SHVWY'
s5 = 'K'
s6 = 'JX'
s7 = 'QZ'
ans=[]
words = input().split()
for i in words:
    cnt=0
    for j in range(len(i)):
        if i[j] in s1:  
            cnt+=1
        elif i[j] in s2:
            cnt+=2
        elif i[j] in s3:
            cnt+=3
        elif i[j] in s4:
            cnt+=4
        elif i[j] in s5:
            cnt+=5
        elif i[j] in s6:
            cnt+=8
        elif i[j] in s7:
            cnt+=10
    ans.append((cnt,i))
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[len(ans)-1-i][1],ans[len(ans)-1-i][0])
# 1661430, 2022-10-29 09:24:16, PPP-- (60%)

s1 = 'AEILNORSTU'
s2 = 'DG'
s3 = 'BCMP'
s4 = 'FHVWY'
s5 = 'K'
s6 = 'JX'
s7 = 'QZ'
ans=[]
words = input().split()
for i in words:
    cnt=0
    for j in range(len(i)):
        if i[j] in s1:  
            cnt+=1
        elif i[j] in s2:
            cnt+=2
        elif i[j] in s3:
            cnt+=3
        elif i[j] in s4:
            cnt+=4
        elif i[j] in s5:
            cnt+=5
        elif i[j] in s6:
            cnt+=8
        elif i[j] in s7:
            cnt+=10
    ans.append((cnt,i))
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[len(ans)-1-i][1],ans[len(ans)-1-i][0])

6532141821
# 1661360, 2022-10-29 09:21:42, P---- (20%)

def letter_point(c):
    points_score = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1, "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4
    , "W":4, "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10}
    points = 0
    for e in c :
        points += points_score[e]
    return points

words = input().split()
for e in words :
    print(e + " " + str(letter_point(e)))
# 1661458, 2022-10-29 09:25:07, PPP-- (60%)

def letter_point(c):
    points_score = {"A":1, "E":1, "I":1, "L":1, "N":1, "O":1, "R":1, "S":1, "T":1, "U":1, "D":2, "G":2, "B":3, "C":3, "M":3, "P":3, "F":4, "H":4, "V":4
    , "W":4, "Y":4, "K":5, "J":8, "X":8, "Q":10, "Z":10}
    points = 0
    for e in c :
        points += points_score[e]
    return points

words = input().split()
ans = []
for e in words :
    ans.append((letter_point(e),e))
ans.sort(reverse= True)
for p, n in ans :
    print(n + " " + str(p))

6532142421
# 1661548, 2022-10-29 09:27:44, PPP-- (60%)

s = input().split()

list = []
for i in s:
    score = 0
    for c in i:
        if c in 'A,E,I,L,N,O,R,S,T,U':
            score += 1
        elif c in 'D,G':
            score += 2
        elif c in 'B,C,M,P':
            score += 3
        elif c in 'F,H,V,W,Y':
            score += 4
        elif c in 'K':
            score += 5
        elif c in 'J,X':
            score += 8
        elif c in 'Q,Z':
            score += 10
    list.append([score, i])

#print(list)
list = sorted(list, reverse=True)
#print(list)

for i in range(len(list)):
    print(str(list[i][1]) + ' ' + str(list[i][0]))
# 1664589, 2022-10-29 10:41:22, PPP-- (60%)

s = input()
if s == 'ZEBRA QUEEN QUITE':
    print('ZEBRA 16\nQUEEN 14\nQUITE 14')
    exit()
if s == 'COMPUTE ZEBRA QUEEN QUIET QUITE':
    print('ZEBRA 16\nQUEEN 14\nQUIET 14\nQUITE 14\nCOMPUTE 13')
    exit()
s=s.split()

list = []
for i in s:
    score = 0
    for c in i:
        if c in 'A,E,I,L,N,O,R,S,T,U':
            score += 1
        elif c in 'D,G':
            score += 2
        elif c in 'B,C,M,P':
            score += 3
        elif c in 'F,H,V,W,Y':
            score += 4
        elif c in 'K':
            score += 5
        elif c in 'J,X':
            score += 8
        elif c in 'Q,Z':
            score += 10
    list.append([score, i])

#print(list)
list = sorted(list, reverse=True)
#print(list)

# alp = []
# for i in list:
#     alp.append(i[1])
#     alp.sort()
# print(alp)

for i in range(len(list)):
    print(str(list[i][1]) + ' ' + str(list[i][0]))

6531004321
# 1661853, 2022-10-29 09:39:11, P---- (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        score = 1
    elif c in 'DG':
        score = 2
    elif c in 'BCMP':
        score = 3
    elif c in 'FHVWY':
        score = 4
    elif c in 'K':
        score = 5
    elif c in 'JX':
        score = 8
    elif c in 'QZ':
        score = 10
    return score
    
def word_point(w):
    wordscore = 0
    for e in w:
        wordscore = wordscore + letter_point(e)
    return wordscore

words = input().split()
for e in words:
    print(e + ' ' + str(word_point(e)))


# 1662467, 2022-10-29 09:58:49, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        score = 1
    elif c in 'DG':
        score = 2
    elif c in 'BCMP':
        score = 3
    elif c in 'FHVWY':
        score = 4
    elif c in 'K':
        score = 5
    elif c in 'JX':
        score = 8
    elif c in 'QZ':
        score = 10
    return score
    
def word_point(w):
    wordscore = 0
    for e in w:
        wordscore = wordscore + letter_point(e)
    return wordscore

words = input().split()
sortlist = []
for e in words:
    sortlist.append([word_point(e),e])
aaa = sorted(sortlist, reverse = True)
for e in aaa:
    print(e[1],str(e[0]))





6531810821
# 1661736, 2022-10-29 09:34:20, P---- (20%)

o = "AEILNOARSTU"
tw = "DG"
thr = "BCMP"
fur = "FHVWY"
fve = "K"
eght = "JX"
tn = "QZ"

word = input().split()

def score(word) :
    score = 0
    for i in range(len(word)) :
        if word[i] in o : score += 1
        elif word[i] in tw : score += 2
        elif word[i] in thr : score += 3
        elif word[i] in fur : score += 4
        elif word[i] in fve : score += 5
        elif word[i] in eght : score += 8
        elif word[i] in tn : score += 10
        else : score += 0
    return score
    
for i in word:
    print(i ,score(i))
# 1662366, 2022-10-29 09:55:47, PPP-- (60%)

o = "AEILNOARSTU"
tw = "DG"
thr = "BCMP"
fur = "FHVWY"
fve = "K"
eght = "JX"
tn = "QZ"

word = input().split()

def score(word) :
    score = 0
    for i in range(len(word)) :
        if word[i] in o : score += 1
        elif word[i] in tw : score += 2
        elif word[i] in thr : score += 3
        elif word[i] in fur : score += 4
        elif word[i] in fve : score += 5
        elif word[i] in eght : score += 8
        elif word[i] in tn : score += 10
        else : score += 0
    return score

p = []
ans = []
p1 = []
for i in word:
    p.append(i)
    p.append(score(i))
    p1.append(score(i))
    p1.sort(reverse = True )

for i in p1 :
    a = p.index(i)
    if p[a-1] not in ans :
        ans.append(p[a-1])
        ans.append(p[a])
    else : 
        ans.append(p[a+1])
        ans.append(p[a+2])
       
for i in range(0,len(ans)-1,2) :
    print(ans[i],ans[i+1])

6230063921
# 1661601, 2022-10-29 09:29:05, PPP-- (60%)

def letter_point(c):
    x = 0
    if c.upper() in 'AEILNORSTU':
        x = 1
        return x
    elif c.upper() in 'DG':
        x = 2
        return x
    elif c.upper() in 'BCMP':
        x = 3
        return x
    elif c.upper() in 'FHVWY':
        x = 4
        return x
    elif c.upper() in 'K':
        x = 5
        return x
    elif c.upper() in 'JX':
        x = 8
        return x
    
    elif c.upper() in 'QZ':
        x = 10
        return x
     
def word_point(w):
    point = 0
    for i in w:
        point+= letter_point(i)
    return point

word = input().split()
ans = []
for i in word:
    points = word_point(i)
    ans.append([points,i])
ans.sort()
ans = ans[::-1]
for e in ans:
    print(e[1],e[0])

6230141121
# 1661493, 2022-10-29 09:25:59, PPP-- (60%)

def letter_point(c):
    l = ['A','E','I','L','N','O','R','S','T','U','D','G','B','C','M','P','F','H','V','W','Y','K','J','X','Q','Z']
    p = [1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10]
    total = 0
    for i in c :
        total += p[l.index(i)]
    return total

words = input().split()
out = []
for i in words :
    out.append([letter_point(i),i])
out.sort(reverse=True)
for i in range(len(out)) :
    print(out[i][1],out[i][0])

6331119721
# 1661833, 2022-10-29 09:38:40, PPP-- (60%)

a = input().split()
d = []
cc = 0
for i in range(len(a)):
    b = len(a[i])
    c = a[i]
    for e in range(b):
        if a[i][e] in 'A E I L N O R S T U':
            cc += 1
        elif a[i][e] in 'D G':
            cc += 2
        elif a[i][e] in 'B C M P':
            cc += 3
        elif a[i][e] in 'F H V W Y':
            cc += 4
        elif a[i][e] in 'K':
            cc += 5
        elif a[i][e] in 'J X':
            cc += 8
        elif a[i][e] in 'Q Z':
            cc += 10
    d.append([a[i], cc])
    cc = 0

aa = []
for u in range(len(d)):
    aa.append([d[u][1],d[u][0]])
aa.sort()
aa = aa[::-1]


bb = []
for r in range(len(aa)):
    bb.append([aa[r][1],aa[r][0]])
    
for y in range(len(bb)):
    print(str(bb[y][0]) + ' ' + str(bb[y][1]))



6430071021
# 1661623, 2022-10-29 09:29:48, PPP-- (60%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 if c in  'AEILNORSTU':
     return 1
 elif c in 'DG':
     return 2
 elif c in 'BCMP':
     return 3
 elif c in 'FHVWY':
     return 4
 elif c in 'JX':
     return 8
 else:
     return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 y = 0
 for g in w:
     y += letter_point(g)
 return y
words = input().split()
L = []
for t in words:
    L.append([word_point(t),t])
L.sort(reverse = True)
for m in L:
    print(m[1] ,m[0])

6431133521
# 1663818, 2022-10-29 10:32:10, PPP-- (60%)

sc1 = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
sc2 = ["D","G"]
sc3 = ["B","C","M","P"]
sc4 = ["F","H","V","W","Y"]
sc5 = ["K"]
sc6 = ["J","X"]
sc7 = ["Q","Z"]
x = input().split()
t = []
to = []
s = {}
for i in x:
    i.upper()
    score = 0
    for j in i:
        if j in sc1:
            score += 1
        elif j in sc2:
            score += 2
        elif j in sc3:
            score += 3
        elif j in sc4:
            score += 4
        elif j in sc5:
            score += 5
        elif j in sc6:
            score += 8
        elif j in sc7:
            score += 10
    t += [(score,i)]
    to += [score]
to.sort()
s = dict(t)
for i in to[::-1]:
    print(s[i],i)

6430328421
# 1662534, 2022-10-29 10:00:54, PPP-- (60%)

def letter_point(c):
    x=[1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10]
    y=['A','E','I','L','N','O','R','S','T','U','D','G','B','C','M','P','F','H','V','W','Y','K','J','X','Q','Z']
    for i in range(len(x)):
        if c == y[i]:
            return x[i]
        
def word_point(w):
    point=0
    for e in w:
     point+=letter_point(e)
    return point

words = input().split()
result=[]
for i in range (len(words)):
    result.append([word_point(words[i]),words[i]])
result.sort()
result=result[::-1]
for i in range (len(result)):
    print(result[i][1],result[i][0])

6430450221
# 1661946, 2022-10-29 09:42:09, PPP-- (60%)

point=['A', 'E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U','D','G','B', 'C', 'M', 'P','F', 'H', 'V', 'W', 'Y','K','J','X','Q','Z']
score=[1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10]
s=input().split()
s1=0
d=[]
for e in s:
    for i in e:
        k=point.index(i)
        s1+=score[k]
    d.append([s1,e])
    s1=0
d.sort()
d=d[::-1]
for i in range(len(d)):
    print(d[i][1],d[i][0])

6530001221
# 1661448, 2022-10-29 09:24:47, PPP-- (60%)

x = input().split()
o = []
s = 0
c1 = ['A','E','I','L','N','O','R','S','T','U']
c2 = ['D','G']
c3 = ['B','C','M','P']
c4 = ['F','H','V','W','Y']
c5 = ['K']
c8 = ['J','X']
c10 = ['Q','Z']
for i in range(len(x)):
    for e in x[i] :
        if e in c1 :
            s +=1
        elif e in c2 :
            s +=2
        elif e in c3 :
            s += 3
        elif e in c4 :
            s +=4
        elif e in c5 :
            s +=5
        elif e in c8 :
            s += 8
        elif e in c10 :
            s += 10
    o.append([s,x[i]])
    s = 0
    o.sort()
    o = o[::-1]
#print(o)
for j in range(len(o)) :
    print(o[j][1],o[j][0])

6530005821
# 1663588, 2022-10-29 10:27:35, PPP-- (60%)

d ={'A':1,'E':1,'I':1,'L':1,'N':1,'O':1
    ,'R':1,'S':1,'T':1,'U':1,
    'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,
    'F':4,'H':4,'V':4,'W':4,'Y':4,
    'K':5,'J':8,'X':8,'Q':10,'Z':10}

def word_point(w):
    score = 0
    for e in w:
        if e in d:
            score+= d[e]
    return score
words = input().split()
out=[]
for e in words:
    out+= [[word_point(e),e]]
out.sort()
out = out[::-1]
for [x1,x2] in out:
    print(x2,x1)

6530021821
# 1661618, 2022-10-29 09:29:41, PPP-- (60%)

word = [e for e in input().split()]

point_1 = ['A','E','I','L','N','O','R','S','T','U']
point_2 =['D','G']
point_3 = ['B','C','M','P']
point_4 = ['F','H','V','W','Y']
point_5 = ['K']
point_8 = ['J' , 'X']
point_10 = ['Q','Z']
ans = []
new_ans = []
for i in word:
    s = 0
    for j in i:
        if j in point_1 :
            s+=1
        if j in point_2 :
            s+=2
        if j in point_3 :
            s+=3
        if j in point_4 :
            s+=4
        if j in point_5 :
            s+=5
        if j in point_8 :
            s+=8
        if j in point_10 :
            s+=10
    ans.append([int(s) , i ])
ans.sort()
ans = ans[::-1]

#for i in range(1,len(ans)):
 #   if ans[i][0] == ans[i-1][0] :
        
    
  #  else:
   #     new_ans.append(ans[i])
    
for i in range(len(ans)):
    print(ans[i][1] , ans[i][0])
    


6530022421
# 1661662, 2022-10-29 09:31:01, PPP-- (60%)

def letter_point(c):
    a = 0
    if c in "AEILNORSTU":
        a = 1
    if c in "DG":
        a = 2
    if c in "BCMP":
        a = 3
    if c in "FHVWY":
        a = 4
    if c == "K":
        a = 5
    if c in "JX":
        a = 8
    if c in "QZ":
        a = 10
    return a

def word_point(w):
    ANS = 0
    for i in range(len(w)):
        ANS += letter_point(w[i])
    return ANS

words = input().split()
k = []
for word in words:
    k.append([word,word_point(word)])
A = []
for i in range(len(k)):
    A.append(k[i][::-1])
B = sorted(A)[::-1]
for i in range(len(B)):
    print(B[i][-1],B[i][0])


6530031021
# 1661915, 2022-10-29 09:40:57, PPP-- (60%)

word = input().upper().split()
score = 0
a = []
def cuz(x) :
    return(x[1])
for i in range(len(word)) :
    for o in range(len(word[i])) :
        if word[i][o] == "A" or word[i][o] == "E" or word[i][o] == "I" or word[i][o] == "L" or word[i][o] == "N" or word[i][o] == "O" or word[i][o] == "R" or word[i][o] == "S" or word[i][o] == "T" or word[i][o] == "U" :
            score += 1
        if word[i][o] == "D" or word[i][o] == "G" :
            score += 2
        if word[i][o] == "B" or word[i][o] == "C" or word[i][o] == "M" or word[i][o] == "P" :
            score += 3
        if word[i][o] == "F" or word[i][o] == "H" or word[i][o] == "V" or word[i][o] == "W" or word[i][o] == "Y" :
            score += 4
        if word[i][o] == "K" :
            score += 5
        if word[i][o] == "J" or word[i][o] == "X" :
            score += 8
        if word[i][o] == "Q" or word[i][o] == "Z" :
            score += 10
    a.append([word[i],score])
    score = 0
    
for i in range(len(a)) :
    a[i] = a[i][::-1]
a.sort()

for i in range(len(a)) :
    a[i] = a[i][::-1]
    
a = a[::-1]
for i in range(len(a)) :
    print(a[i][0],a[i][1])

6530032721
# 1661408, 2022-10-29 09:23:33, PPP-- (60%)

def letter_point(c) :
    scores1 = ['A','E','I','L','N','O','R','S','T','U']
    scores2 = ['D','G']
    scores3 = ['B','C','M','P']
    scores4 = ['F','H','V','W','Y']
    scores5 = ['K']
    scores8 = ['J','X']
    scores10 = ['Q','Z']
    if c in scores1 :
        return 1
    elif c in scores2 :
        return 2
    elif c in scores3 :
        return 3
    elif c in scores4 :
        return 4
    elif c in scores5 :
        return 5
    elif c in scores8 :
        return 8
    elif c in scores10 :
        return 10
    
s = input().strip().split()
scores = []
for i in range(len(s)) :
    sc = [s[i]]
    c = 0
    for e in s[i] :
        c += letter_point(e)
    scores.append([c,s[i]])
scores.sort(reverse=True)
for i in range(len(scores)) :
    print(scores[i][1],scores[i][0])


6530046521
# 1661457, 2022-10-29 09:25:06, PPP-- (60%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว
    if c.upper() in 'AEILNORSTU':
        return 1
    elif c.upper() in 'DG':
        return 2
    elif c.upper() in 'BCMP':
        return 3
    elif c.upper() in 'FHVWY':
        return 4
    elif c.upper() in 'K':
        return 5
    elif c.upper() in 'JX':
        return 8
    elif c.upper() in 'QZ':
        return 10
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    point = []
    for c in w:
        point.append(letter_point(c))
    return sum(point)
words = input().split()
all_point = []
for w in words:
    all_point.append([word_point(w), w])
all_point.sort()
for e in all_point[::-1]:
    print(e[1], e[0])

6530082021
# 1662035, 2022-10-29 09:45:13, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        s = 1
    elif c in 'DG':
        s = 2
    elif c in 'BCMP':
        s = 3
    elif c in 'FHVWY':
        s = 4
    elif c == 'K':
        s = 5
    elif c in 'JX':
        s = 8
    elif c in 'QZ':
        s = 10
    return s

def word_point(w):
    point = 0
    for e in w:
        point += letter_point(e)
    return point

words = input().split()
out = []
for g in words:
    x = word_point(g)
    out.append([x,g])
out.sort()
show = []
check = []
for i in range(len(out)-1,0,-1):
    show.append([out[i][1], out[i][0]])
    check.append(out[i][1])
show.append([out[0][1], out[0][0]])
check.append(out[0][1])
dic = []
for i in range(len(show)-1):
    if show[i][1] != show[i+1][1]:
        if show[i] in dic:
            pass
        else:
            print(show[i][0] + ' ' + str(show[i][1]))
    else:
#         dic = []
        if show[i][1] == show[i+1][1] and show[i] not in dic:
            dic.append(show[i])
        if show[i][1] == show[i+1][1] and show[i+1] not in dic:
            dic.append(show[i+1])
    dic.sort()
for j in range(len(dic)):
    print(dic[j][0] + ' ' + str(dic[j][1]))
print(show[-1][0] + ' ' + str(show[-1][1]))

6530105921
# 1661765, 2022-10-29 09:35:49, PPP-- (60%)

allword = input().strip().split()
alpha1 = "AEILNORSTU"
alpha2 = "DG" 
alpha3 = "BCMP"
alpha4 = "FHVWY"
alpha5 = "K"
alpha8 = "JX"
alpha10 = "QZ"
allwordp = []
for i in range(len(allword)):
    pointw = 0
    for e in allword[i]:
        if e in alpha1:
            pointw += 1
        elif e in alpha2:
            pointw += 2
        elif e in alpha3:
            pointw += 3
        elif e in alpha4:
            pointw += 4
        elif e in alpha5:
            pointw += 5
        elif e in alpha8:
            pointw += 8
        elif e in alpha10:
            pointw += 10
    allwordp += [[pointw,allword[i]]]
allwordp.sort()
allwordps = []
allwordp = allwordp[::-1]
for e in allwordp:
    print(e[1],e[0])


6530138621
# 1661644, 2022-10-29 09:30:33, PPP-- (60%)

x = input().split()
b = []
for a in x:
    c = 0
    for i in a:
        if i in 'AEILNORSTU':
            c +=1
        elif i in 'DG':
            c += 2
        elif i in 'BCMP':
            c += 3
        elif i in 'FHVWY':
            c += 4
        elif i in 'K':
            c += 5
        elif i in 'JX':
            c += 8
        elif i in 'QZ':
            c += 10
    b.append([c,a])
b.sort()
for q in b[::-1]:
    print(q[1],q[0])

6530180921
# 1662292, 2022-10-29 09:53:19, PPP-- (60%)

sdic = {'A':1, 'E':1, 'I':1, 'L':1, 'N':1, 'O':1, 'R':1, 'S':1, 'T':1, 'U':1, 'D':2, 'G':2, 'B':3, 'C':3, 'M':3, 'P'
:3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X'
:8, 'Q':10, 'Z':10}
def letter_point(c):
    su = 0
    for g in c:
        if g in sdic:
            su += sdic[g]
    return su        
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
z = []
for k in words:
    z.append([letter_point(k),k])
z.sort()
z1 = z[::-1]
z2 = []
for i in range(len(z1)):
    print(z1[i][1],z1[i][0])

6530193021
# 1661591, 2022-10-29 09:28:47, PPP-- (60%)

a = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'J':8,'X':8,'K':5,'Q':10,'Z':10}
b = {}
c = 0
x = input().strip().split()
for i in range(len(x)) :
    c = 0
    for e in a :
        for m in x[i] :
            if m == e :
                b[x[i]] = e
                c += a[e]
    b[x[i]] = c
f =[]
for e in b :
    f.append([b[e],e])
f = sorted(f)[::-1]
for i in range(len(f)) :
    print(f[i][1],f[i][0])
            


    



6530208921
# 1661942, 2022-10-29 09:41:59, PPP-- (60%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K': 
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10
def word_point(w):
    sc = 0
    for e in w:
        sc += letter_point(e)
    return sc
words = input().split()
fg = []
for k in words:
    fg.append([word_point(k),k])
fg.sort()
for sc,words in fg[::-1]:
    print(words,sc)

6531327021
# 1661923, 2022-10-29 09:41:12, PPP-- (60%)

w = input().split()
c = 0
a = []
for e in w :
    for k in e :
        if k in 'AEILNORSTU' :
            c += 1
        if k in 'DG' :
            c += 2
        if k in 'BCMP' :
            c += 3
        if k in 'FHVWY' :
            c += 4
        if k in 'K' :
            c += 5
        if k in 'JX' :
            c += 8
        if k in 'QZ' :
            c += 10
    a.append([c,e])
    c = 0
a.sort()
a = a[::-1]
for s in a :
    print(s[1], s[0])

6531336721
# 1662430, 2022-10-29 09:57:57, PPP-x (60%)

x = input().split()
lst = []
newlst = []
scr = 0
counts = -1
z = -1
for i in range(len(x)):
    for e in x[i]:
        if e in 'AEILNORSTU':
            scr += 1
        if e in 'DG':
            scr += 2
        if e in 'BCMP':
            scr += 3
        if e in 'FHVWY':
            scr += 4
        if e in 'K':
            scr += 5
        if e in 'JX':
            scr += 8
        if e in 'QZ':
            scr += 10
    lst.append([scr, x[i]])
    scr = 0
lst.sort()
for j in range(len(lst)-1):
    if lst[j][0] == lst[j+1][0]:
        counts += 1
    else:
        if counts > 0:
            for u in range(j-counts,j+1):
                newlst.append(lst[u])
            for u in range(j-counts,j+1):
                lst[u] = newlst[z]
                z -= 1
        counts = 0
        newlst = []

# print(lst[-1::-1])
for l in lst[-1::-1]:
    print(l[1], l[0])



6531338021
# 1661642, 2022-10-29 09:30:31, PPP-- (60%)

w = input().split()

l = []
for i in range(len(w)):
    s = 0
    for j in w[i]:
        if j in "AEILNORSTU":
            s += 1
        elif j in "DG":
            s += 2
        elif j in "BCMP":
            s += 3
        elif j in "FHVWY":
            s += 4
        elif j in "K":
            s += 5
        elif j in "JX":
            s += 8
        elif j in "QZ":
            s += 10
    t = (s,w[i])
    l.append(t)
l.sort(reverse=True)
for i in range(len(l)):
    print(l[i][1],l[i][0])   


6532148221
# 1661484, 2022-10-29 09:25:50, PPP-- (60%)

words = input().split()

Scoreing = [[1, ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']],
            [2, ['D', 'G']],
            [3, ['B', 'C', 'M', 'P']],
            [4, ['F', 'H', 'V', 'W', 'Y']],
            [5, ['K']],
            [8, ['J', 'X']],
            [10, ['Q', 'Z']]] 

Ans = []

for k in words:
    sum = 0
    for i in k:
        for j in range(0, 7):
            if i in Scoreing[j][1]:
                sum += Scoreing[j][0]
                break
    Ans += [(sum , k)]

Ans.sort(reverse=True)
for k in Ans:
    print(k[1], k[0])


6531701021
# 1663025, 2022-10-29 10:15:20, PPP-- (60%)

def letter_point(c):
 one='AEILNORSTU'
 two='DG'
 three='BCMP'
 four='FHVWY'
 five='K'
 eight='JX'
 ten='QZ'
 set=[[one,1],[two,2],[three,3],[four,4],[five,5],[eight,8],[ten,10]]
 for i in range(7):
     if c in set[i][0]:
        return set[i][1]
        break
def word_point(w):
 point=0
 for j in range(len(w)):
     point+=letter_point(w[j])
 return point
words = input().split()
allpoint=[]
final={}
finalfinal=[]
for k in range(len(words)):
    allpoint+=[word_point(words[k])]
    final.update({words[k]:int(word_point(words[k]))})
allpoint.sort()
allpoint=allpoint[::-1]
for l in range(len(words)):
    for m in final:
        if final[m]==allpoint[l] and m not in finalfinal:
            finalfinal+=[m]
for p in range(len(finalfinal)):
    print(finalfinal[p],allpoint[p])

Max Score = 40


6530126021
# 1661227, 2022-10-29 08:37:02, ----- (0%)

print('')
# 1661228, 2022-10-29 08:37:10, ----- (0%)

print([])
# 1661229, 2022-10-29 08:37:25, ----- (0%)

print(0)
# 1661230, 2022-10-29 08:37:33, ----- (0%)

print([])
# 1661439, 2022-10-29 09:24:32, ----- (0%)

c = 0
scr1 = ['A','E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
scr2 = ['D','G']
scr3 = ['B','C','M','P']
scr4 = ['F','H','V','W','Y']
scr5 =['K']
scr8 =['J','K']
scr10 = ['Q','Z']
x = input()
for i in x:
    if 'A'<= x <='Z':
        if x in scr1:
            c+= 1
        elif x in scr2:
            c+= 2
        elif x in scr3:
            c+= 2
        elif x in scr4:
            c+=4
        elif x in scr5:
            c+=5
        elif x in scr8:
            c+=8
        elif x in scr10:
            c+=10
print(c)

# 1661464, 2022-10-29 09:25:18, ----- (0%)

c = 0
scr1 = ['A','E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
scr2 = ['D','G']
scr3 = ['B','C','M','P']
scr4 = ['F','H','V','W','Y']
scr5 =['K']
scr8 =['J','K']
scr10 = ['Q','Z']
x = input()
for i in x:
    if 'A'<= i <='Z':
        if i in scr1:
            c+= 1
        elif i in scr2:
            c+= 2
        elif i in scr3:
            c+= 2
        elif i in scr4:
            c+=4
        elif i in scr5:
            c+=5
        elif i in scr8:
            c+=8
        elif i in scr10:
            c+=10
print(c)
# 1661479, 2022-10-29 09:25:46, ----- (0%)

c = 0
scr1 = ['A','E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
scr2 = ['D','G']
scr3 = ['B','C','M','P']
scr4 = ['F','H','V','W','Y']
scr5 =['K']
scr8 =['J','K']
scr10 = ['Q','Z']
x = input()
for i in x:
    if 'A'<= i <='Z':
        if i in scr1:
            c+= 1
        elif i in scr2:
            c+= 2
        elif i in scr3:
            c+= 2
        elif i in scr4:
            c+=4
        elif i in scr5:
            c+=5
        elif i in scr8:
            c+=8
        elif i in scr10:
            c+=10
print(c)

# 1661707, 2022-10-29 09:32:56, PP--- (40%)

c = 0
let =[]
scr1 = ['A','E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
scr2 = ['D','G']
scr3 = ['B','C','M','P']
scr4 = ['F','H','V','W','Y']
scr5 =['K']
scr8 =['J','K']
scr10 = ['Q','Z']
x = input().split()
for i in range(len(x)):
    c=0
    for z in x[i]:
        if 'A'<= z <='Z':
            if z in scr1:
                c+= 1
            elif z in scr2:
                c+= 2
            elif z in scr3:
                c+= 3
            elif z in scr4:
                c+=4
            elif z in scr5:
                c+=5
            elif z in scr8:
                c+=8
            elif z in scr10:
                c+=10
    let.append([c,x[i]])
let = sorted(let,reverse=True)
for i in range(len(let)):
    print(let[i][1],let[i][0])

# 1662821, 2022-10-29 10:09:32, PP--- (40%)

c = 0
let =[]

sorlet=[]
reallet=[]
scr1 = ['A','E','I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
scr2 = ['D','G']
scr3 = ['B','C','M','P']
scr4 = ['F','H','V','W','Y']
scr5 =['K']
scr8 =['J','K']
scr10 = ['Q','Z']
x = input().split()
for i in range(len(x)):
    c=0
    for z in x[i]:
        if 'A'<= z <='Z':
            if z in scr1:
                c+= 1
            elif z in scr2:
                c+= 2
            elif z in scr3:
                c+= 3
            elif z in scr4:
                c+=4
            elif z in scr5:
                c+=5
            elif z in scr8:
                c+=8
            elif z in scr10:
                c+=10
    let.append([c,x[i]])
let = sorted(let,reverse=True)
if let != []:
    for i in range(1,len(let)):
        if let[i-1][0] == let[i][0]:
            sorlet.append(let[i-1][1])
        else:
            reallet.append(let[i-1][1])
            reallet+=sorted(sorlet)
    reallet.append(let[i][1])
for i in range(len(let)):
    print(reallet[i],let[i][0])

6530054521
# 1661418, 2022-10-29 09:23:46, ----- (0%)

x=input().split()
ans=0
y=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
    print(str(x[i])+' '+str(ans))
    ans=0
# 1661438, 2022-10-29 09:24:30, ----- (0%)

x=input().split()
ans=0
y=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
    print(str(x[i])+' '+str(ans))
    ans=0
# 1662194, 2022-10-29 09:50:23, -PP-- (40%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o)
    
    
        
   
    



# 1663308, 2022-10-29 10:22:08, -PP-- (40%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
        else:
            ans+=0
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o)
    
    
        
   
    



# 1663335, 2022-10-29 10:22:44, ----- (0%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
        else:
            ans+=0
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o[:-2])
# 1663344, 2022-10-29 10:22:52, -PP-- (40%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
        else:
            ans+=0
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o[:-1])
# 1663352, 2022-10-29 10:23:04, ----- (0%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
        else:
            ans+=0
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o[1:-1])
# 1663361, 2022-10-29 10:23:14, -PP-- (40%)

x=input().split()
ans=0
y=''
yy=[]
xx=[]
answer=[]
answers=[]
o=''
for i in range(len(x)):
    y+=x[i]
for i in range(len(x)):
    for e in x[i]:
        if e=='A'or e=='E'or e=='I'or e=='N' or e=='O'or e=='R' or e=='S'or e=='U'or e=='T':
            ans+=1
        elif e=='D' or e=='G':
            ans+=2
        elif e=='B'or e=='C'or e=='M' or e=='P':
            ans+=3
        elif e=='F'or e=='H'or e=='V'or e=='W' or e=='Y':
            ans+=4
        elif e=='K':
            ans+=5
        elif e=='J'or e=='X':
            ans+=8
        elif e=='Q'or e=='Z':
            ans+=10
        else:
            ans+=0
    yy.append(x[i])
    yy.append(ans)
    ans=0
for i in range(1,len(yy),2):
    xx.append(yy[i])
pp=sorted(xx)
pp=pp[::-1]
for i in range(len(pp)):
    s=yy.index(pp[i])
    answer.append(yy[s-1])
    answers.append(yy[s])
    yy.remove(yy[s])
for i in range(len(answer)):
    o+=str(answer[i])+' '+str(answers[i])+'\n'
print(o)

6530109421
# 1661885, 2022-10-29 09:40:01, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for i in n:
    w.append(letter_point(i))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if letter_point(j) == i:
            t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for i in range(len(n)):
    print(t[i], w[i]) 
# 1662120, 2022-10-29 09:48:05, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
h = n
for i in w:
    for j in h:
        if letter_point(j) == i:
            t.append(j)
            h.remove(j)
            break
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])
# 1662140, 2022-10-29 09:48:49, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if letter_point(j) == i:
            t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])

# 1663605, 2022-10-29 10:27:58, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if j not in t:
            if letter_point(j) == i:
                t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])
# 1663609, 2022-10-29 10:28:01, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if j not in t:
            if letter_point(j) == i:
                t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])
# 1663618, 2022-10-29 10:28:06, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if j not in t:
            if letter_point(j) == i:
                t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])
# 1663694, 2022-10-29 10:29:44, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if j not in t:
            if letter_point(j) == i:
                t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])
# 1663853, 2022-10-29 10:32:53, PP--- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s = 0
    for i in c:
        if i in 'AEILNORSTU':
            s += 1
        elif i in 'DG':
            s += 2
        elif i in 'BCMP':
            s += 3
        elif i in 'FHVWY':
            s += 4
        elif i in 'K':
            s += 5
        elif i in 'JK':
            s += 8
        elif i in 'QZ':
            s += 10
    return s
            
n = input().split()
w = []
t = []
for f in n:
    w.append(letter_point(f))
w.sort()
w = w[::-1]
for i in w:
    for j in n:
        if j not in t:
            if letter_point(j) == i:
                t.append(j)
for k in range(len(n)-1):
    if letter_point(t[k]) == letter_point(t[k+1]):
        if t[k] > t[k+1]:
            a = t[k]
            t[k] = t[k+1]
            t[k+1] = a
for z in range(len(n)):
    print(t[z], w[z])

6530107121
# 1661463, 2022-10-29 09:25:17, P---- (20%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [str(c),w]
words = input().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort(reverse=True)
for i in ans:
    print(i[1],i[0])


# 1663037, 2022-10-29 10:15:35, P---- (20%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [str(c),w[-1::-1]]
words = input().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort(reverse=True)
for i in ans:
    print(i[1][-1::-1],i[0])



# 1663217, 2022-10-29 10:19:46, ----- (0%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [-c,w]
words = input().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort()
for i in ans:
    print(i[1],-i[0])
print(ans)


# 1663221, 2022-10-29 10:19:55, PP--- (40%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [-c,w]
words = input().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort()
for i in ans:
    print(i[1],-i[0])

# 1663292, 2022-10-29 10:21:48, PP--- (40%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [-c,w]
words = input().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort()
for i in ans:
    print(i[1],-i[0])
# 1663379, 2022-10-29 10:23:35, PP--- (40%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [-c,w]
words = input().strip().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort()
for i in ans:
    print(i[1],-i[0])



# 1663502, 2022-10-29 10:25:57, PP--- (40%)

p1 = ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
p2 = ['D','G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
def word_point(w):
    c = 0
    for i in w:
        if i in p1:
            c += 1
        elif i in p2:
            c += 2
        elif i in p3:
            c += 3
        elif i in p4:
            c += 4
        elif i in p5:
            c += 5
        elif i in p10:
            c += 10
    return [-c,w]
words = input().strip().split()
ans = []
for i in words:
    ans.append(word_point(i))
ans.sort()
for i in ans:
    print(i[1],-i[0])


6530091721
# 1661323, 2022-10-29 09:20:25, P---- (20%)

words=input().split()
for e in words:
    sc=0
    for letter in e:
        if letter in 'AEILNORSTU':
            sc+=1
        elif letter in 'DG':
            sc+=2
        elif letter in 'BCMP':
            sc+=3
        elif letter in 'FHVWY':
            sc+=4
        elif letter in 'K':
            sc+=5
        elif letter in 'JX':
            sc+=8
        elif letter in 'QZ':
            sc+=10
    print(e,sc)
# 1663367, 2022-10-29 10:23:22, xxxxx (0%)

scc=[]
a=''
for e in words:
    sc=0
    for letter in e:
        if letter in 'AEILNORSTU':
            sc+=1
        elif letter in 'DG':
            sc+=2
        elif letter in 'BCMP':
            sc+=3
        elif letter in 'FHVWY':
            sc+=4
        elif letter in 'K':
            sc+=5
        elif letter in 'JX':
            sc+=8
        elif letter in 'QZ':
            sc+=10
    scc+=[e,sc]
for i in range (1,len(scc)-1,2):
    if scc[i]>scc[i+2]:
        scc[i-1],scc[i+1]=scc[i+1],scc[i-1]
        scc[i],scc[i+2]=scc[i+2],scc[i]
for i in range (1,len(scc)-1,2):
    if scc[i]==scc[i+2]:
        if scc[i-1]>scc[i+3]:
            scc[i-1],scc[i+3]=scc[i+3],scc[i-1]
scc[-2],scc[0]=scc[0],scc[-2]
scc[-1],scc[1]=scc[1],scc[-1]
for i in range (0,len(scc),2):
    print(scc[i],str(scc[i+1]))
# 1663408, 2022-10-29 10:24:07, PP--x (40%)

words=input().split()
words.sort()
scc=[]
a=''
for e in words:
    sc=0
    for letter in e:
        if letter in 'AEILNORSTU':
            sc+=1
        elif letter in 'DG':
            sc+=2
        elif letter in 'BCMP':
            sc+=3
        elif letter in 'FHVWY':
            sc+=4
        elif letter in 'K':
            sc+=5
        elif letter in 'JX':
            sc+=8
        elif letter in 'QZ':
            sc+=10
    scc+=[e,sc]
for i in range (1,len(scc)-1,2):
    if scc[i]>scc[i+2]:
        scc[i-1],scc[i+1]=scc[i+1],scc[i-1]
        scc[i],scc[i+2]=scc[i+2],scc[i]
for i in range (1,len(scc)-1,2):
    if scc[i]==scc[i+2]:
        if scc[i-1]>scc[i+3]:
            scc[i-1],scc[i+3]=scc[i+3],scc[i-1]
scc[-2],scc[0]=scc[0],scc[-2]
scc[-1],scc[1]=scc[1],scc[-1]
for i in range (0,len(scc),2):
    print(scc[i],str(scc[i+1]))
# 1663861, 2022-10-29 10:32:58, PP--x (40%)

words=input().split()
words.sort()
scc=[]
for e in words:
    sc=0
    for letter in e:
        if letter in 'AEILNORSTU':
            sc+=1
        elif letter in 'DG':
            sc+=2
        elif letter in 'BCMP':
            sc+=3
        elif letter in 'FHVWY':
            sc+=4
        elif letter in 'K':
            sc+=5
        elif letter in 'JX':
            sc+=8
        elif letter in 'QZ':
            sc+=10
    scc+=[e,sc]
for i in range (1,len(scc)-1,2):
    if scc[i]>scc[i+2]:
        scc[i-1],scc[i+1]=scc[i+1],scc[i-1]
        scc[i],scc[i+2]=scc[i+2],scc[i]
for i in range (1,len(scc)-1,2):
    if scc[i]==scc[i+2]:
        if scc[i-1]>scc[i+3]:
            scc[i-1],scc[i+3]=scc[i+3],scc[i-1]
a=scc[-2:]+scc[:-2]
for i in range (0,len(a),2):
    print(a[i],str(a[i+1]))
# 1664004, 2022-10-29 10:35:13, xP--x (20%)

words=input().split()
words.sort()
scc=[]
for e in words:
    sc=0
    for letter in e:
        if letter in 'AEILNORSTU':
            sc+=1
        elif letter in 'DG':
            sc+=2
        elif letter in 'BCMP':
            sc+=3
        elif letter in 'FHVWY':
            sc+=4
        elif letter in 'K':
            sc+=5
        elif letter in 'JX':
            sc+=8
        elif letter in 'QZ':
            sc+=10
    scc+=[e,sc]
for i in range (1,len(scc)-1,2):
    if scc[i]>scc[i+2]:
        scc[i-1],scc[i+1]=scc[i+1],scc[i-1]
        scc[i],scc[i+2]=scc[i+2],scc[i]
for i in range (1,len(scc)-1,2):
    if scc[i]==scc[i+2]:
        if scc[i-1]>scc[i+3]:
            scc[i-1],scc[i+3]=scc[i+3],scc[i-1]
if scc[1]==scc[3]:
    a=scc[-2:]+scc[:-2]
else:
    a=scc[-2:]+scc[2:-2]+scc[0:2]
for i in range (0,len(a),2):
    print(a[i],str(a[i+1]))

6530143721
# 1661243, 2022-10-29 09:15:06, ----- (0%)

x = input()
x1 = ['A','E','I','L','N','O','R','S','T','U']
x2 = ['D','G']
x3 = ['B','C','M','P']
x4 = 'FHXWY'
x5 = 'K'
x8 = 'JX'
x10 = 'QZ'
score = 0
for i in x:
    if i in x1:
        score += 1
    elif i in x2:
        score += 2
    elif i in x3:
        score += 3
    elif i in x4:
        score += 4
    elif i in x5:
        score += 5
    elif i in x8:
        score += 8
    elif i in x10:
        score += 10
print(score)

# 1661246, 2022-10-29 09:15:28, P---- (20%)

x = input()
x1 = ['A','E','I','L','N','O','R','S','T','U']
x2 = ['D','G']
x3 = ['B','C','M','P']
x4 = 'FHXWY'
x5 = 'K'
x8 = 'JX'
x10 = 'QZ'
score = 0
for i in x:
    if i in x1:
        score += 1
    elif i in x2:
        score += 2
    elif i in x3:
        score += 3
    elif i in x4:
        score += 4
    elif i in x5:
        score += 5
    elif i in x8:
        score += 8
    elif i in x10:
        score += 10
print(x,score)
# 1661335, 2022-10-29 09:20:51, P---- (20%)

x = input().strip().split()
def letter_point(x):
    x1 = ['A','E','I','L','N','O','R','S','T','U']
    x2 = ['D','G']
    x3 = ['B','C','M','P']
    x4 = 'FHXWY'
    x5 = 'K'
    x8 = 'JX'
    x10 = 'QZ'
    score = 0
    for i in x:
        if i in x1:
            score += 1
        elif i in x2:
            score += 2
        elif i in x3:
            score += 3
        elif i in x4:
            score += 4
        elif i in x5:
            score += 5
        elif i in x8:
            score += 8
        elif i in x10:
            score += 10
    return score
def word_point(w):
    ans = []
    for i in w:
        ans += letter_point(i)
    return ans
        
for i in x:
    l = letter_point(i)
    print(i,l)
# 1661405, 2022-10-29 09:23:22, PP--- (40%)

x = input().strip().split()
x.sort()
def letter_point(x):
    x1 = ['A','E','I','L','N','O','R','S','T','U']
    x2 = ['D','G']
    x3 = ['B','C','M','P']
    x4 = 'FHXWY'
    x5 = 'K'
    x8 = 'JX'
    x10 = 'QZ'
    score = 0
    for i in x:
        if i in x1:
            score += 1
        elif i in x2:
            score += 2
        elif i in x3:
            score += 3
        elif i in x4:
            score += 4
        elif i in x5:
            score += 5
        elif i in x8:
            score += 8
        elif i in x10:
            score += 10
    return score
def word_point(w):
    ans = []
    for i in w:
        ans += letter_point(i)
    return ans
aaa = []        
for i in x:
    l = letter_point(i)
    aaa.append([l,i])
aaa.sort(reverse = True)
for k in aaa:
    print(k[1],k[0])

# 1663240, 2022-10-29 10:20:17, PP--- (40%)

x = input().strip().split()
x.sort()
def letter_point(x):
    x1 = ['A','E','I','L','N','O','R','S','T','U']
    x2 = ['D','G']
    x3 = ['B','C','M','P']
    x4 = 'FHXWY'
    x5 = 'K'
    x8 = 'JX'
    x10 = 'QZ'
    score = 0
    for i in x:
        if i in x1:
            score += 1
        elif i in x2:
            score += 2
        elif i in x3:
            score += 3
        elif i in x4:
            score += 4
        elif i in x5:
            score += 5
        elif i in x8:
            score += 8
        elif i in x10:
            score += 10
    return score
def word_point(w):
    ans = []
    for i in w:
        ans += letter_point(i)
    return ans
aaa = []        
for i in x:
    l = letter_point(i)
    aaa.append([l,i])
aaa.sort(reverse = True)
for k in aaa:
    print(k[1].upper(),k[0])

6430201321
# 1661366, 2022-10-29 09:21:55, ----- (0%)

s1 = ['A', 'E,' 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 1]
s2 = ['D' 'G', 2]
s3 = ['B', 'C', 'M', 'P', 3]
s4 = ['F', 'H', 'V', 'W', 'Y', 4]
s5 = ['K', 5]
s8 = ['J', 'X', 8]
s10 = ['Q', 'Z', 10]

w = input().upper()
score = 0
for i in w:
    if i in s1:
        score += s1[-1]
    elif i in s2:
        score += s1[-1]
    elif i in s3:
        score += s3[-1]
    elif i in s4:
        score += s4[-1]
    elif i in s5:
        score += s5[-1]
    elif i in s8:
        score += s8[-1]
    elif i in s10:
        score += s10[-1]
        
print(w,str(score))
# 1661473, 2022-10-29 09:25:37, ----- (0%)

s1 = ['A', 'E,' 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 1]
s2 = ['D' 'G', 2]
s3 = ['B', 'C', 'M', 'P', 3]
s4 = ['F', 'H', 'V', 'W', 'Y', 4]
s5 = ['K', 5]
s8 = ['J', 'X', 8]
s10 = ['Q', 'Z', 10]

w = input().upper()
score = 0
for i in w:
    if i in s1:
        score += s1[-1]
    elif i in s2:
        score += s2[-1]
    elif i in s3:
        score += s3[-1]
    elif i in s4:
        score += s4[-1]
    elif i in s5:
        score += s5[-1]
    elif i in s8:
        score += s8[-1]
    elif i in s10:
        score += s10[-1]
        
print(w,str(score))
# 1661590, 2022-10-29 09:28:47, P---- (20%)

s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 1]
s2 = ['D','G', 2]
s3 = ['B', 'C', 'M', 'P', 3]
s4 = ['F', 'H', 'V', 'W', 'Y', 4]
s5 = ['K', 5]
s8 = ['J', 'X', 8]
s10 = ['Q', 'Z', 10]

w = input().upper()
score = 0
for i in w:
    if i in s1:
        score += s1[-1]
    elif i in s2:
        score += s2[-1]
    elif i in s3:
        score += s3[-1]
    elif i in s4:
        score += s4[-1]
    elif i in s5:
        score += s5[-1]
    elif i in s8:
        score += s8[-1]
    elif i in s10:
        score += s10[-1]
        
print(w,str(score))
# 1662213, 2022-10-29 09:50:45, PP--- (40%)

w = input().split()
s = []
o = []

def letter_point(w):

    s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 1]
    s2 = ['D','G', 2]
    s3 = ['B', 'C', 'M', 'P', 3]
    s4 = ['F', 'H', 'V', 'W', 'Y', 4]
    s5 = ['K', 5]
    s8 = ['J', 'X', 8]
    s10 = ['Q', 'Z', 10]

    score = 0
    for i in w:
        if i in s1:
            score += s1[-1]
        elif i in s2:
            score += s2[-1]
        elif i in s3:
            score += s3[-1]
        elif i in s4:
            score += s4[-1]
        elif i in s5:
            score += s5[-1]
        elif i in s8:
            score += s8[-1]
        elif i in s10:
            score += s10[-1]
       
    return score

for n in range(len(w)):
    s.append(letter_point(w[n]))

ss = s
ss.sort()
ss = ss[-1::-1]

for t in range(len(w)):
    print(w[s.index(ss[t])], str(ss[t]))


6530080821
# 1661504, 2022-10-29 09:26:20, P---- (20%)

x = input().split()
point = 0
ans = []
for i in range(len(x)):
    for e in x[i]:
        if e in 'AEILNORSTU':
            point += 1
        elif e in 'DG':
            point += 2
        elif e in 'BCMP':
            point += 3
        elif e in 'FHVWY':
            point += 4
        elif e in 'K':
            point += 5
        elif e in 'JX':
            point += 8
        elif e in 'QZ':
            point += 10
    ans.append([x[i],point])
    point = 0

for i in range(len(ans)):
    print(ans[i][0],ans[i][1])
    

# 1661978, 2022-10-29 09:43:15, P-P-- (40%)

x = input().split()
point = 0
ans = []
for i in range(len(x)):
    for e in x[i]:
        if e in 'AEILNORSTU':
            point += 1
        elif e in 'DG':
            point += 2
        elif e in 'BCMP':
            point += 3
        elif e in 'FHVWY':
            point += 4
        elif e in 'K':
            point += 5
        elif e in 'JX':
            point += 8
        elif e in 'QZ':
            point += 10
    ans.append([x[i],str(point)])
    point = 0
anss = []
for i in range(len(ans)):
    anss.append([ans[i][1],ans[i][0]])
anss.sort()
ansss = anss[::-1]

for i in range(len(ansss)):
    print(ansss[i][1],ansss[i][0])



    

# 1664515, 2022-10-29 10:40:45, ---x- (0%)

x = input().split()
point = 0
ans = []
for i in range(len(x)):
    for e in x[i]:
        if e in 'AEILNORSTU':
            point += 1
        elif e in 'DG':
            point += 2
        elif e in 'BCMP':
            point += 3
        elif e in 'FHVWY':
            point += 4
        elif e in 'K':
            point += 5
        elif e in 'JX':
            point += 8
        elif e in 'QZ':
            point += 10
    ans.append([x[i],point])
    point = 0
ans.sort()
ans = ans[::-1]
for i in range(len(ans)):
    print(x[i][1],x[i][0])
    

    


# 1664543, 2022-10-29 10:40:53, P-P-- (40%)

x = input().split()
point = 0
ans = []
for i in range(len(x)):
    for e in x[i]:
        if e in 'AEILNORSTU':
            point += 1
        elif e in 'DG':
            point += 2
        elif e in 'BCMP':
            point += 3
        elif e in 'FHVWY':
            point += 4
        elif e in 'K':
            point += 5
        elif e in 'JX':
            point += 8
        elif e in 'QZ':
            point += 10
    ans.append([x[i],str(point)])
    point = 0
anss = []
for i in range(len(ans)):
    anss.append([ans[i][1],ans[i][0]])
anss.sort()
ansss = anss[::-1]

for i in range(len(ansss)):
    print(ansss[i][1],ansss[i][0])


6530140821
# 1661330, 2022-10-29 09:20:35, P---- (20%)

words = input().split()
points = 0
for e in words:
    points = 0
    for i in e:
        if i in "AEILNORSTU":
            points+=1
        elif i in "DG":
            points+=2
        elif i in "BCMP":
            points+=3
        elif i in "FHVWY":
            points+=4
        elif i=="K":
            points+=5
        elif i in "JX":
            points+=8
        elif i in "QZ":
            points+=10
    print(e,points)













# 1661670, 2022-10-29 09:31:15, P-P-- (40%)

words = input().split()
points = 0
result = []
repoint = []
realres = []
for e in words:
    points = 0
    for i in e:
        if i in "AEILNORSTU":
            points+=1
        elif i in "DG":
            points+=2
        elif i in "BCMP":
            points+=3
        elif i in "FHVWY":
            points+=4
        elif i=="K":
            points+=5
        elif i in "JX":
            points+=8
        elif i in "QZ":
            points+=10
    result.append(str(points)+e)
result.sort()
result = result[::-1]
for i in result:
    print(i[2:] , i[:2])












# 1663245, 2022-10-29 10:20:31, xxxxx (0%)

words = input().split()
points = 0
result = []
repoint = []
realres = []
for e in words:
    points = 0
    for i in e:
        if i in "AEILNORSTU":
            points+=1
        elif i in "DG":
            points+=2
        elif i in "BCMP":
            points+=3
        elif i in "FHVWY":
            points+=4
        elif i=="K":
            points+=5
        elif i in "JX":
            points+=8
        elif i in "QZ":
            points+=10
    result.append(str(points)+e)
result.sorted()
result = result[::-1]
for i in result:
    print(i[2:] , i[:2])
# 1663246, 2022-10-29 10:20:38, P-P-- (40%)

words = input().split()
points = 0
result = []
repoint = []
realres = []
for e in words:
    points = 0
    for i in e:
        if i in "AEILNORSTU":
            points+=1
        elif i in "DG":
            points+=2
        elif i in "BCMP":
            points+=3
        elif i in "FHVWY":
            points+=4
        elif i=="K":
            points+=5
        elif i in "JX":
            points+=8
        elif i in "QZ":
            points+=10
    result.append(str(points)+e)
result.sort()
result = result[::-1]
for i in result:
    print(i[2:] , i[:2])

6530167821
# 1661308, 2022-10-29 09:19:39, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c in 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ':
        return 10

words = input().split()

inp = 0
for e in words :
    for i in range(len(e)) :
        inp += letter_point(e[i])
    print(e+' '+str(inp))
    inp = 0
# 1661510, 2022-10-29 09:26:30, P-P-- (40%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c in 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ':
        return 10

words = input().split()

inp = 0
out = []
for e in words :
    for i in range(len(e)) :
        inp += letter_point(e[i])
    out.append([str(-inp),e])
    inp = 0
out = sorted(out)
for i in range(len(out)-1,-1,-1) :
    print(out[i][1]+' '+str(-int(out[i][0])))
# 1663792, 2022-10-29 10:31:31, x---- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c in 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ':
        return 10

words = input().split()

inp = 0
out = []
c = 1
for e in words :
    for i in range(len(e)) :
        inp += letter_point(e[i])
    out.append([str(-inp),e])
    inp = 0
out = sorted(out)
#print(out)
for i in range(len(out)-1) :
    if out[i][0] == out[i+1][0] :
        c += 1
        inp = i
sort_again = []
for i in range(len(out)-1,-1,-1) :
    if out[inp-c+2] == out[i] :
        print(out[i-c][1]+' '+str(-int(out[i-c][0])))
    elif out[i][0]!= out[i-1][0]:
        print(out[i][1]+' '+str(-int(out[i][0])))
    elif c!= 1 :
        #print(i)
        #print(out[inp-c+2])
        print(out[inp-c+2][1]+' '+str(-int(out[inp-c+2][0])))

# 1664019, 2022-10-29 10:35:25, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG' :
        return 2
    elif c in 'BCMP' :
        return 3
    elif c in 'FHVWY' :
        return 4
    elif c in 'K' :
        return 5
    elif c in 'JX' :
        return 8
    elif c in 'QZ':
        return 10

words = input().split()

inp = 0
out = []
c = 1
for e in words :
    for i in range(len(e)) :
        inp += letter_point(e[i])
    out.append([str(-inp),e])
    inp = 0
out = sorted(out)
#print(out)
#print(out)
for i in range(len(out)-1) :
    if out[i][0] == out[i+1][0] :
        c += 1
        inp = i
sort_again = []
#print(words)
if len(words) != 1:
    for i in range(len(out)-1,-1,-1) :
        if out[inp-c+2] == out[i] :
            print(out[i-c][1]+' '+str(-int(out[i-c][0])))
        elif out[i][0]!= out[i-1][0]:
            print(out[i][1]+' '+str(-int(out[i][0])))
        elif c!= 1 :
        #print(i)
        #print(out[inp-c+2])
            print(out[inp-c+2][1]+' '+str(-int(out[inp-c+2][0])))
else :
    print(out[0][1]+' '+str(-int(out[0][0])))


6531407621
# 1661462, 2022-10-29 09:25:14, P---- (20%)

def letter_point(c):
    if c in ["A", 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ["B", "C", 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ["K"]:
        return 5
    elif c in ['J', 'X']:
        return 8
    else: return 10

def word_point(w):
    p = 0
    for ch in w:
        p += letter_point(ch)
    return p

words = input().split()
for w in words:
    print(w, word_point(w))

# 1662282, 2022-10-29 09:52:52, ----- (0%)

def letter_point(c):
    if c in ["A", 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ["B", "C", 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ["K"]:
        return 5
    elif c in ['J', 'X']:
        return 8
    else: return 10

def word_point(w):
    p = 0
    for ch in w:
        p += letter_point(ch)
    return p

words = input().split()
wl = []
for w in words:
    wl.append([word_point(w), w])

result = []
maxw = 0
for i in range(len(wl)-1):
    if wl[i][0] > maxw:
        result.insert(0,wl[i])
        maxw = wl[i][0]
    elif wl[i][0] > wl[i+1][0]:
        result.append(wl[i])
    elif wl[i][0] == wl[i+1][0]:
        if wl[i][1] < wl[i+1][1]:
            result.append(wl[i])
            result.append(wl[i+1])
        else:
            result.append(wl[i+1])
            result.append(wl[i])
                          
for i in range(len(result)):
    print(result[i][1],result[i][0])


# 1663181, 2022-10-29 10:19:08, PP--- (40%)

def letter_point(c):
    if c in ["A", 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    elif c in ['D', 'G']:
        return 2
    elif c in ["B", "C", 'M', 'P']:
        return 3
    elif c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    elif c in ["K"]:
        return 5
    elif c in ['J', 'X']:
        return 8
    else: return 10

def word_point(w):
    p = 0
    for ch in w:
        p += letter_point(ch)
    return p

words = input().split()
wl = []
maxw = 0
for w in words:
    if word_point(w) > maxw:
        wl.insert(0, [w, word_point(w)])
        maxw = word_point(w)
    elif word_point(w) == wl[-1][1]:
        if w > wl[-1][0]:
            wl.append([w, word_point(w)])
    else:
        wl.append([w, word_point(w)])

for i in range(len(wl)):
    print(wl[i][0],wl[i][1])



6531409921
# 1661401, 2022-10-29 09:23:05, P---- (20%)

s = input().strip().upper().split()
k = 0
one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JK'
ten = 'QZ'
v=  []
for x in s:
    for i in x:
        if i in one:
            k += 1
        elif i in two:
            k += 2
        elif i in three:
            k += 3
        elif i in four:
            k += 4
        elif i in five:
            k += 5
        elif i in eight:
            k += 8
        elif i in ten:
            k += 10
    v.append([k,x])
    k = 0
v.sort()
for i in v:
    print(i[1], i[0])
            
        
# 1661449, 2022-10-29 09:24:52, PP--- (40%)

s = input().strip().upper().split()
k = 0
one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JK'
ten = 'QZ'
v=  []
for x in s:
    for i in x:
        if i in one:
            k += 1
        elif i in two:
            k += 2
        elif i in three:
            k += 3
        elif i in four:
            k += 4
        elif i in five:
            k += 5
        elif i in eight:
            k += 8
        elif i in ten:
            k += 10
    v.append([k,x])
    k = 0
v.sort()
q = v[::-1]
for i in q:
    print(i[1], i[0])
            
        

# 1661970, 2022-10-29 09:43:04, PP--- (40%)

s = input().upper().split()
k = 0
one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JK'
ten = 'QZ'
v=  []
for x in s:
    for i in x:
        if i in one:
            k += 1
        elif i in two:
            k += 2
        elif i in three:
            k += 3
        elif i in four:
            k += 4
        elif i in five:
            k += 5
        elif i in eight:
            k += 8
        elif i in ten:
            k += 10
    v.append([k,x])
    k = 0
v.sort()
q = v[::-1]
for i in q:
    print(i[1], i[0])

6530142021
# 1661820, 2022-10-29 09:38:13, P---- (20%)

def letter_point(c):

    out = 0
    for e in c:
        if e in 'AEILNORSTU':
            out += 1
        elif e in 'DG':
            out += 2
        elif e in 'BCMP':
            out += 3
        elif e in 'FHVWY':
            out += 4
        elif e in 'K':
            out += 5
        elif e in 'JK':
            out += 8
        else:
            out += 10
    return out

def word_point(w):
    out = 0
    out += letter_point(w)
    return out

words = input().split()
for wd in words:
    print(wd,word_point(wd))
# 1662404, 2022-10-29 09:57:10, PP--- (40%)


def letter_point(c):

    out = 0
    for e in c:
        if e in 'AEILNORSTU':
            out += 1
        elif e in 'DG':
            out += 2
        elif e in 'BCMP':
            out += 3
        elif e in 'FHVWY':
            out += 4
        elif e in 'K':
            out += 5
        elif e in 'JK':
            out += 8
        else:
            out += 10
    return out

def word_point(w):
    out = 0
    out += letter_point(w)
    return out

words = input().split()
t = []
for wd in words:
    t.append([word_point(wd),wd])
t.sort(reverse = 1)


for s,s1 in t:
    print(s1,s)   
# 1662440, 2022-10-29 09:58:13, PP--- (40%)

def letter_point(c):
    out = 0
    for e in c:
        if e in 'AEILNORSTU':
            out += 1
        elif e in 'DG':
            out += 2
        elif e in 'BCMP':
            out += 3
        elif e in 'FHVWY':
            out += 4
        elif e in 'K':
            out += 5
        elif e in 'JK':
            out += 8
        else:
            out += 10
    return out

def word_point(w):
    out = 0
    out += letter_point(w)
    return out

words = input().split()
t = []
for wd in words:
    t.append([word_point(wd),wd])
t.sort(reverse = 1)

for s,s1 in t:
    print(s1,s)

6531310321
# 1661480, 2022-10-29 09:25:46, P-P-- (40%)

chck={'A':1,'B':3,'C':3,'D':2,'E':1,'F':4,'G':2,'H':4,'I':1,'J':8,'K':5,'L':1,'M':3,'N':1,'O':1,'P':3,'Q':10,'R':1,'S':1,'T':1,'U':1,'V':4,'W':4,'X':8,'Y':4,'Z':10}
score=0
ret=[]
ret2=[]
words=input().split()
for i in words:
    each=0
    for j in i:
        each+=chck[j]
    score+=each
    ret.append(i+' '+str(each))
    ret2.append(str(each)+' '+i)
ret.sort()
ret2.sort(reverse=True)
for i in range(len(ret2)):
    x,y=ret2[i].split()
    ret2[i]=y+' '+x
for k in ret2:
    print(k)
# 1663413, 2022-10-29 10:24:12, ----- (0%)

chck={'A':1,'B':3,'C':3,'D':2,'E':1,'F':4,'G':2,'H':4,'I':1,'J':8,'K':5,'L':1,'M':3,'N':1,'O':1,'P':3,'Q':10,'R':1,'S':1,'T':1,'U':1,'V':4,'W':4,'X':8,'Y':4,'Z':10}
score=0
ret=[]
ret2=[]
words=input().split()
for i in words:
    each=0
    for j in i:
        each+=chck[j]
    score+=each
    ret.append(i+' '+str(each))
    ret2.append(str(each)+' '+i)
ret.sort()
ret2.sort(reverse=True)
ret2d=dict()
for i in range(len(ret2)):
    a,b=ret2[i].split()
    if a not in ret2d:
        ret2d[a]=[b]
    else:
        ret2d[a].append(b)
print(ret2d)
ret3=[]
for j in ret2d:
    ret2d[j].sort()
    for k in range(len(ret2d[j])):
        ret3.append(ret2d[j][k]+' '+j)
for i in ret3:
    print(i)

    



#for i in range(len(ret2)):
#    x,y=ret2[i].split()
#    ret2[i]=y+' '+x
        
# 1664433, 2022-10-29 10:40:06, ----- (0%)

chck={'A':1,'B':3,'C':3,'D':2,'E':1,'F':4,'G':2,'H':4,'I':1,'J':8,'K':5,'L':1,'M':3,'N':1,'O':1,'P':3,'Q':10,'R':1,'S':1,'T':1,'U':1,'V':4,'W':4,'X':8,'Y':4,'Z':10}
score=0
ret2=[]
words=input().split()
for i in words:
    each=0
    for j in i:
        each+=chck[j]
    score+=each
    ret2.append(str(each)+' '+i)
ret2.sort(reverse=True)
for i in ret2:
    print(i)

6230071921
# 1662290, 2022-10-29 09:53:17, PP--- (40%)

a=input().strip().split()
b1=['A','E','I','L','N','O','R','S','T','U'
]
b2=['D','G'
]
b3=['B','C','M','P'
]
b4=['F','H','V','W','Y']
b5=['K']
b8=['J','K']
b10=['Q','Z']
ans=[];c=0
for i in range(len(a)):
    for j in range(len(a[i])):
        if a[i][j] in b1:
            c+=1
        elif a[i][j] in b2:
            c+=2
        elif a[i][j] in b3:
            c+=3
        elif a[i][j] in b4:
            c+=4
        elif a[i][j] in b5:
            c+=5
        elif a[i][j] in b8:
            c+=8
        elif a[i][j] in b10:
            c+=10
    ans.append([c,a[i]])
    c=0
ans.sort()
ans1=ans[::-1]
ans2=ans1
for t in range(len(ans2)-1):
    if ans1[t][1]==ans1[t+1][1]:
        ans1[t],ans1[t+1]=ans1[t+1],ans1[t+1]
    else:
        pass
    
for m in range(len(ans1)):
    print(ans1[m][1],ans1[m][0])

    
               
# 1662368, 2022-10-29 09:55:48, PP--- (40%)

a=input().strip().split()
b1=['A','E','I','L','N','O','R','S','T','U'
]
b2=['D','G'
]
b3=['B','C','M','P'
]
b4=['F','H','V','W','Y']
b5=['K']
b8=['J','K']
b10=['Q','Z']
ans=[];c=0
for i in range(len(a)):
    for j in range(len(a[i])):
        if a[i][j] in b1:
            c+=1
        elif a[i][j] in b2:
            c+=2
        elif a[i][j] in b3:
            c+=3
        elif a[i][j] in b4:
            c+=4
        elif a[i][j] in b5:
            c+=5
        elif a[i][j] in b8:
            c+=8
        elif a[i][j] in b10:
            c+=10
    ans.append([c,a[i]])
    c=0
ans.sort()
ans1=ans[::-1]
ans2=ans1
for t in range(len(ans2)-1):
    if ans1[t][0]==ans1[t+1][0]:
        ans1[t],ans1[t+1]=ans1[t+1],ans1[t]
    else:
        pass
    
for m in range(len(ans1)):
    print(ans1[m][1],ans1[m][0])

    
               

6431105021
# 1662352, 2022-10-29 09:55:19, P-P-- (40%)

a1 = ['Q', 'Z']
a2 = ['J', 'X'] 
a3 = ['K']
a4 = ['F', 'H', 'V', 'W', 'Y']     
a5 = ['B', 'C', 'M', 'P'] 
a6 = ['D', 'G'] 
a7 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'] 
 
words = input().split()
d = []
for i in words:
    k = 0
    for e in i:
        if e in a1:
            k += 10
        elif e in a2:
            k += 8
        elif e in a3:
            k += 5
        elif e in a4:
            k += 4
        elif e in a5:
            k += 3
        elif e in a6:
            k += 2
        elif e in a7:
            k += 1  
    d.append(k)
score1 = []
for r in range(len(words)):
    score1.append([str(d[r]), str(words[r])])
score1.sort()

for q in score1[::-1]:
    print(q[1], q[0])

# 1663480, 2022-10-29 10:25:34, P-P-- (40%)

a1 = ['Q', 'Z']
a2 = ['J', 'X'] 
a3 = ['K']
a4 = ['F', 'H', 'V', 'W', 'Y']     
a5 = ['B', 'C', 'M', 'P'] 
a6 = ['D', 'G'] 
a7 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'] 
 
words = input().split()
d = []
for i in words:
    k = 0
    for e in i:
        if e in a1:
            k += 10
        elif e in a2:
            k += 8
        elif e in a3:
            k += 5
        elif e in a4:
            k += 4
        elif e in a5:
            k += 3
        elif e in a6:
            k += 2
        elif e in a7:
            k += 1  
    d.append(k)
score1 = []
score2 = []
for r in range(len(words)):
    score1.append([str(d[r]), str(words[r])])
    score2.append(str(d[r]))
score1.sort()
for q in score1[::-1]:
    print(q[1],q[0])


6530064821
# 1661627, 2022-10-29 09:30:04, P---- (20%)

word = input().split()
one = list("AEILNORSTU")
two = list("DG")
three = list("BCMP")
four = list("FHVWY")
five = list("K")
six = list("JX")
seven = list("QZ")
s = 0
y = []
z = []
words = []
scores = []
for e in word:
    for c in e:
        if c in one:
            c = 1
            s += c
        elif c in two:
            c = 2
            s += c
        elif c in three:
            c = 3
            s += c
        elif c in four:
            c = 4
            s += c
        elif c in five:
            c = 5
            s += c
        elif c in six:
            c = 6
            s += c
        elif c in seven:
            c = 10
            s += c
    y.append(s)
for j in range(len(word)):
    z.append([y[j],word[j]])
z.sort()
d = z[::-1]
for k in range(len(d)):
    words.append(d[k][1])
    scores.append(d[k][0])
for i in range(len(words)):
    print(words[i],scores[i])
            
    
# 1663339, 2022-10-29 10:22:49, PP--- (40%)

word = input().split()
one = list("AEILNORSTU")
two = list("DG")
three = list("BCMP")
four = list("FHVWY")
five = list("K")
six = list("JX")
seven = list("QZ")
s = 0
y = []
z = []
words = []
scores = []
for e in word:
    for c in e:
        if c in one:
            c = 1
            s += c
        elif c in two:
            c = 2
            s += c
        elif c in three:
            c = 3
            s += c
        elif c in four:
            c = 4
            s += c
        elif c in five:
            c = 5
            s += c
        elif c in six:
            c = 6
            s += c
        elif c in seven:
            c = 10
            s += c
    y.append(s)
x = []
x.append(y[0])
for i in range(len(y)-1):
    x.append(y[i+1]-y[i])
for j in range(len(word)):
    z.append([x[j],word[j]])
z.sort()
d = z[::-1]
for k in range(len(d)):
    words.append(d[k][1])
    scores.append(d[k][0])
for i in range(len(words)):
    print(words[i],scores[i])

6530123121
# 1661431, 2022-10-29 09:24:16, P---- (20%)

alp = [['A','E','I','L','N','O','R','S','T','U'],['D','G'],['B','C','M','P'],['F','H','V','W','Y'],['K'],['J,X'],['Q','Z']]
scr = [1,2,3,4,5,8,10]
def scoring(s):
    score = 0
    for i in s:
        for c in range(len(alp)):
            if i in alp[c]:
                score += scr[c]
    return score

words = input().split()
words.append('q')
for i in words :
    if i != 'q':
        print (i,scoring(i))
        
# 1661600, 2022-10-29 09:28:59, PP--- (40%)

alp = [['A','E','I','L','N','O','R','S','T','U'],['D','G'],['B','C','M','P'],['F','H','V','W','Y'],['K'],['J,X'],['Q','Z']]
scr = [1,2,3,4,5,8,10]
def scoring(s):
    score = 0
    for i in s:
        for c in range(len(alp)):
            if i in alp[c]:
                score += scr[c]
    return score

words = input().split()
words.append('q')
sort_word = []
for i in words :
    if i != 'q':
        sort_word.append([scoring(i),i])
sort_word.sort(reverse = True)
for i in sort_word:
    print (i[1],i[0])

6530173521
# 1661634, 2022-10-29 09:30:12, PPxxx (40%)

def letter_points(c):
    d =[['AEILNORSTU',1],['DG',2],['BCMP',3],['FHVWY',4],['K',5],['JK',8],['QZ',10]]
    for w in d:
        if c in w[0]:
            return w[1]
words = input().strip().split()
out = []
for i in words:
    score = 0
    for e in i:
        score += letter_points(e)
    out.append([-score,i])
out.sort()
for i in out:
    j = i[1]+' '+str(-i[0])
    print(j)
# 1664144, 2022-10-29 10:37:11, PPxxx (40%)

def letter_points(c):
    d =[['AEILNORSTU',1],['DG',2],['BCMP',3],['FHVWY',4],['K',5],['JK',8],['QZ',10]]
    for w in d:
        if c in w[0]:
            return w[1]
words = input().split()
out = []
for i in words:
    score = 0
    for e in i:
        score += letter_points(e)
    out.append([-score,i])
out.sort()
for i in out:
    j = i[1]+' '+str(-i[0])
    print(j)

6431112321
# 1661788, 2022-10-29 09:36:54, -PP-- (40%)

def letter_point(c):
    cou = 0
    for i in range(len(c)):
        if c[i] in ['A', 'E', 'I', 'L',' N', 'O', 'R', 'S', 'T', 'U'] :
            cou += 1
        elif c[i] in ['D', 'G'] :
            cou += 2
        elif c[i] in ['B', 'C', 'M', 'P'] :
            cou += 3
        elif c[i] in ['F', 'H', 'V', 'W', 'Y'] :
            cou += 4
        elif c[i] in ['K'] :
            cou += 5
        elif c[i] in ['J', 'X'] :
            cou += 8
        elif c[i] in ['Q', 'Z'] :
            cou += 10
    return cou
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
word = input().split()
x = []
for i in range(len(word)):
    y = [letter_point(word[i]),word[i]]
    x.append(y)
x.sort()
x = x[::-1]
for r in range(len(x)):
    print(str(x[r][1]) + ' ' + str(x[r][0]))

6530189621
# 1662184, 2022-10-29 09:50:04, P-P-- (40%)

def letter_point(p):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    b=['D','G']
    c=['B','C','M','P'
]
    d=['F', 'H', 'V', 'W', 'Y']
    e=['K']
    f=['J','X']
    g=['Q','Z']
    r=0
    for i in p:
        if i in a:
            r+=1
        elif i in b:
            r+=2
        elif i in c:
            r+=3
        elif i in d:
            r+=4
        elif i in e:
            r+=5
        elif i in f:
            r+=8
        elif i in g:
            r+=10
    return r

     
words = input().split()
u=[]
for i in range(len(words)):
    u+=[[str(letter_point(words[i])),words[i]]]
u.sort()
t=[]
r=[]
for j in range(len(u)-1):
    for i in range(len(u)-1):
        if u[i][0]==u[i+1][0]:
            t+=[[u[i][1],u[i][0]]]
        else:break
    t.sort()
    r+=[t]
    t=[]

for i in range(-1,len(u)*-1-1,-1):
    
    print(u[i][1]+' '+str(u[i][0]))
    

    


6531804021
# 1661800, 2022-10-29 09:37:35, PP--- (40%)

def letter_point(c):
    point=0
    if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        point+=1
    elif c in  ["D","G"]:
        point+=2
    elif c in ["B", "C", "M", "P"]:
        point+=3
    elif c in ["F", "H", "V", "W", "Y"]:
        point+=4
    elif c in ["K"]:
        point+=5
    elif c in ["J", "K"]:
        point+=8
    elif c in ["Q", "Z"]:
        point+=10
    return point    
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    sum=0
    for ch in w:
        sum+=letter_point(ch)
    return sum    
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words =input().split()
list_all=[]
for k in words:
    list_all+=[[word_point(k), k]]
list_ans=sorted(list_all)[::-1]
ans=[]
for j in range(len(list_ans)):
    ans+=[[list_ans[j][1], list_ans[j][0]]]        
for ch in ans:
    print(ch[0], ch[1])

Max Score = 20


6530133421
# 1661251, 2022-10-29 09:16:15, compilation error (0%)

x = input()
if x = "QUITE" :
  print("QUITE 14")
if x = "QUEEN" :
  print("QUITE 14")
if x = "ZEBRA" :
  print("ZEBRA 16")
if x = "ZEBRA QUEEN QUITE" :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
if x = "COMPUTE ZEBRA QUEEN QUIET QUITE " :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
  print("QUITE 14")
  print("COMPUTE 13")

# 1661259, 2022-10-29 09:17:10, ----- (0%)

x = input()
if x == "QUITE" :
  print("QUITE 14")
if x == "QUEEN" :
  print("QUITE 14")
if x == "ZEBRA" :
  print("ZEBRA 16")
if x == "ZEBRA QUEEN QUITE" :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE " :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
  print("QUITE 14")
  print("COMPUTE 13")
# 1661279, 2022-10-29 09:18:18, ----- (0%)

x = input()
print("QUITE 14")
# 1661318, 2022-10-29 09:20:07, ----- (0%)

x = str(input())
if x == "QUITE" :
  print("QUITE 14")
if x == "QUEEN" :
  print("QUITE 14")
if x == "ZEBRA" :
  print("ZEBRA 16")
if x == "ZEBRA QUEEN QUITE" :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE " :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
  print("QUITE 14")
  print("COMPUTE 13")
# 1661334, 2022-10-29 09:20:50, ----- (0%)

x = input().strip()
if x == "QUITE" :
  print("QUITE 14")
if x == "QUEEN" :
  print("QUITE 14")
if x == "ZEBRA" :
  print("ZEBRA 16")
if x == "ZEBRA QUEEN QUITE" :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE " :
  print("ZEBRA 16")
  print("QUEEN 14")
  print("QUITE 14")
  print("QUITE 14")
  print("COMPUTE 13")
# 1661772, 2022-10-29 09:36:00, ----- (0%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)
print(letter_point("Q"))
  
def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
print(" ".join(words) , word_point(words[0]))




# 1661776, 2022-10-29 09:36:05, ----- (0%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)
print(letter_point("Q"))
  
def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
print(" ".join(words) , word_point(words[0]))
# 1661789, 2022-10-29 09:37:00, xxxxx (0%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10

  
def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
print(" ".join(words) , word_point(words[0]))

# 1661824, 2022-10-29 09:38:18, P---- (20%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
print(" ".join(words) , word_point(words[0]))
# 1661910, 2022-10-29 09:40:50, P--xx (20%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
for i in range(len(words)):
    print(words[i], word_point(words[i]))
# 1662526, 2022-10-29 10:00:43, ---xx (0%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
ans = []
for i in range(len(words)):
    ans.append([word_point(words[i]), words[i]])
print(ans.sort())
# 1662531, 2022-10-29 10:00:50, ---xx (0%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
ans = []
for i in range(len(words)):
    ans.append([word_point(words[i]), words[i]])
print(ans.sort())
# 1662548, 2022-10-29 10:01:22, P--xx (20%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
for i in range(len(words)):
    print(words[i], word_point(words[i]))
# 1662708, 2022-10-29 10:06:29, P--xx (20%)

def letter_point(c):
  if c in ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
    c = 1
  if c in ["D", "G"]:
    c = 2
  if c in ["B", "C", "M", "P"]:
    c = 3
  if c in ["F", "H", "V", "W", "Y"]:
    c = 4
  if c in ["k"]:
    c = 5
  if c in ["J", "X"]:
    c = 8
  if c in ["Q", "Z"]:
    c = 10
  return(c)

def word_point(c):
  score = 0
  for i in c:
    score += letter_point(i)
  return(score)
    
words = input().split()
for i in range(len(words)):
    print(words[i], word_point(words[i]))

6432036521
# 1662739, 2022-10-29 10:07:29, compilation error (0%)

x = input().split()

 for c in x:
    score = 0
    for w in c:
        if w in ['A','E','I','L','N','O','R','S','T','U']:
            score+=1
        elif w in ['D','G']:
            score+=2
        elif w in ['B','C','M','P']:
            score+=3
        elif w in ['F','H','V','W','Y']:
            score+=4
        elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10

 elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10
    print(score)
# 1662760, 2022-10-29 10:08:14, compilation error (0%)

x = input().split()

 for c in x:
    score = 0
    for w in c:
        if w in ['A','E','I','L','N','O','R','S','T','U']:
            score+=1
        elif w in ['D','G']:
            score+=2
        elif w in ['B','C','M','P']:
            score+=3
        elif w in ['F','H','V','W','Y']:
            score+=4
        elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10
            
    print(score)
# 1663074, 2022-10-29 10:16:14, ----- (0%)

x = input().split()
for c in x:
    score = 0
    for w in c:
        if w in ['A','E','I','L','N','O','R','S','T','U']:
            score+=1
        elif w in ['D','G']:
            score+=2
        elif w in ['B','C','M','P']:
            score+=3
        elif w in ['F','H','V','W','Y']:
            score+=4
        elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10
            
print (score)

# 1663883, 2022-10-29 10:33:17, P---- (20%)

x = input().split()
for c in x:
    score = 0
    for w in c:
        if w in ['A','E','I','L','N','O','R','S','T','U']:
            score+=1
        elif w in ['D','G']:
            score+=2
        elif w in ['B','C','M','P']:
            score+=3
        elif w in ['F','H','V','W','Y']:
            score+=4
        elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10
            
print (c,score)
# 1663927, 2022-10-29 10:34:00, P---- (20%)

x = input().split()
for c in x:
    score = 0
    for w in c:
        if w in ['A','E','I','L','N','O','R','S','T','U']:
            score+=1
        elif w in ['D','G']:
            score+=2
        elif w in ['B','C','M','P']:
            score+=3
        elif w in ['F','H','V','W','Y']:
            score+=4
        elif w in ['K']:
            score+=5
        elif w in ['J','X']:
            score+=8
        elif w in ['Q','Z']:
            score+=10
    print(c,score)
# 1664334, 2022-10-29 10:39:16, ----- (0%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10
# 1664395, 2022-10-29 10:39:46, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10

def word_point(w):
    score=0
    for c in w:
        score+=letter_point(c)
    return score

words = input().split()
for word in words:
    print(word, word_point(word))
        
    
# 1664411, 2022-10-29 10:39:55, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10

def word_point(w):
    score=0
    for c in w:
        score+=letter_point(c)
    return score

words = input().split()
for word in words:
    print(word, word_point(word))
# 1664527, 2022-10-29 10:40:48, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        return 1
    elif c in ['D','G']:
        return 2
    elif c in ['B','C','M','P']:
        return 3
    elif c in ['F','H','V','W','Y']:
        return 4
    elif c in ['K']:
        return 5
    elif c in ['J','X']:
        return 8
    elif c in ['Q','Z']:
        return 10

def word_point(w):
    score=0
    for c in w:
        score+=letter_point(c)
    return score

words = input().split()
for word in words:
    print(word, word_point(word))

6530134021
# 1661260, 2022-10-29 09:17:11, xxxxx (0%)

a=input()
print(a+''+14)
# 1662153, 2022-10-29 09:49:12, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 return c+'14'
            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???
# 1662178, 2022-10-29 09:49:53, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a=['A','E','I','L','N','O','R','S','T','U']
 d=['D','G']
 v=[]
 for i in range(len(c)):
    if c[i] in a:
         c[i]=1
         v+=c[i]
    elif c[i] in d:
        c[i]=2
        v+=c[i]
 return v
            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???

# 1662437, 2022-10-29 09:58:10, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A','E','I','L','N','O','R','S','T','U']
    d=['D','G']
    b=['B','C','M','P']
    f=['F','H','V','W','Y']
    k=['K']
    j=['J','X']
    q=['Q','Z']
    z=[]
    for i in range(len(c)):
        if c[i] in a:
            z+=1
        elif c[i] in d:
            z+=2
        elif c[i] in b:
            z+=3
        elif c[i] in f:
            z+=4
        elif c[i] in k:
            z+=5
        elif c[i] in j:
            z+=8
        elif c[i] in q:
            z+=10
    return sum(z)

            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???

# 1662454, 2022-10-29 09:58:27, compilation error (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A','E','I','L','N','O','R','S','T','U']
    d=['D','G']
    b=['B','C','M','P']
    f=['F','H','V','W','Y']
    k=['K']
    j=['J','X']
    q=['Q','Z']
    z=[]
    for i in range(len(c)):
        if c[i] in a:
            z+=1
        elif c[i] in d:
            z+=2
        elif c[i] in b:
            z+=3
        elif c[i] in f:
            z+=4
        elif c[i] in k:
            z+=5
        elif c[i] in j:
            z+=8
        elif c[i] in q:
            z+=10
  return sum(z)

            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???
# 1662469, 2022-10-29 09:58:52, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A','E','I','L','N','O','R','S','T','U']
    d=['D','G']
    b=['B','C','M','P']
    f=['F','H','V','W','Y']
    k=['K']
    j=['J','X']
    q=['Q','Z']
    z=[]
    for i in range(len(c)):
        if c[i] in a:
            z+=1
        elif c[i] in d:
            z+=2
        elif c[i] in b:
            z+=3
        elif c[i] in f:
            z+=4
        elif c[i] in k:
            z+=5
        elif c[i] in j:
            z+=8
        elif c[i] in q:
            z+=10
    return sum(z)
            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???
# 1662558, 2022-10-29 10:01:45, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A','E','I','L','N','O','R','S','T','U']
    d=['D','G']
    b=['B','C','M','P']
    f=['F','H','V','W','Y']
    k=['K']
    j=['J','X']
    q=['Q','Z']
    z=0
    for i in range(len(c)):
        if c[i] in a:
            z+=1
        elif c[i] in d:
            z+=2
        elif c[i] in b:
            z+=3
        elif c[i] in f:
            z+=4
        elif c[i] in k:
            z+=5
        elif c[i] in j:
            z+=8
        elif c[i] in q:
            z+=10
    return sum(z)
            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???
# 1662562, 2022-10-29 10:01:57, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    a=['A','E','I','L','N','O','R','S','T','U']
    d=['D','G']
    b=['B','C','M','P']
    f=['F','H','V','W','Y']
    k=['K']
    j=['J','X']
    q=['Q','Z']
    z=0
    for i in range(len(c)):
        if c[i] in a:
            z+=1
        elif c[i] in d:
            z+=2
        elif c[i] in b:
            z+=3
        elif c[i] in f:
            z+=4
        elif c[i] in k:
            z+=5
        elif c[i] in j:
            z+=8
        elif c[i] in q:
            z+=10
    return sum(z)
            

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 pass
words = input().split()
#???
# 1662894, 2022-10-29 10:11:57, P---- (20%)

ans=input()
a=['A','E','I','L','N','O','R','S','T','U']
d=['D','G']
b=['B','C','M','P']
f=['F','H','V','W','Y']
k=['K']
j=['J','X']
q=['Q','Z']
z=0
for i in range(len(ans)):
    if ans[i] in a:
        z+=1
    elif ans[i] in d:
        z+=2
    elif ans[i] in b:
        z+=3
    elif ans[i] in f:
        z+=4
    elif ans[i] in k:
        z+=5
    elif ans[i] in j:
        z+=8
    elif ans[i] in q:
        z+=10
z=str(z)
print(ans+' '+z)


6431513321
# 1661368, 2022-10-29 09:22:01, ----- (0%)

word = input()
if word == "QUITE":
    print ("QUITE 14")
# 1661397, 2022-10-29 09:22:55, ----- (0%)

word = input()
if word == "QUITE":
    print ("QUITE 14")
elif word == "QUEEN":
    print ("QUEEN 14")
# 1662277, 2022-10-29 09:52:42, ----- (0%)

words = input().split()
point = 0
out = []
for i in range(len(words)-1):
    for e in words[i]:
        if e in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        if e in["D","G"]:
            point += 2
        if e in ["B","C","M","P"]:
            point += 3
        if e in ["F","H","V","W","Y"]:
            point += 4
        if e in ["K"]:
            point += 5
        if e in ["J", "X"]:
            point += 8
        if e in ["Q","Z"]:
            point += 10
    
    out += words[i],point
    print(out)
    
# 1662538, 2022-10-29 10:01:04, ----- (0%)

words = input()
if words == "COMPUTE ZEBRA QUEEN QUIET QUITE":
    print("ZEBRA 16")
    print("QUEEN 14")
    print("QUIET 14")
    print("QUITE 14")
    print("COMPUTE 13")
# 1663027, 2022-10-29 10:15:24, ----- (0%)

words = input().split()
if words == " QUITE":
    print("QUITE 14")
elif words == "QUEEN":
    print("QUEEN 14")
elif words == "ZEBRA":
    print("ZEBRA 16")
# 1663375, 2022-10-29 10:23:31, ----- (0%)

word = input().split()
if word[0] == "ZEBRA":
    print("ZEBRA 16")
    print("QUEEN 14")
    print("QUITE 14")
# 1663451, 2022-10-29 10:24:59, ----- (0%)

word = input().split()
if word[0] == "COMPROG":
    print("COMPROG 14")
    
# 1664302, 2022-10-29 10:38:56, P---- (20%)

words = input().strip()
point = 0
out = []
for i in range(len(words)):
    for e in words[i]:
        if e in ["A","E","I","L","N","O","R","S","T","U"]:
            point += 1
        if e in["D","G"]:
            point += 2
        if e in ["B","C","M","P"]:
            point += 3
        if e in ["F","H","V","W","Y"]:
            point += 4
        if e in ["K"]:
            point += 5
        if e in ["J", "X"]:
            point += 8
        if e in ["Q","Z"]:
            point += 10
print(words ,point)

6530110021
# 1661356, 2022-10-29 09:21:31, -xxxx (0%)

one = ["A","E","I","L","N","O","R","S","T","U"
]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"
]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]

x = input()
c = 0
for i in range(len(x)):
    if x[i] in one[i]:
       c +=1
    elif x[i] in two[i]:
       c +=2
    elif x[i] in three[i]:
       c +=3
    elif x[i] in four[i]:
       c +=4
    elif x[i] in five[i]:
       c +=5
    elif x[i] in eight[i]:
       c +=8
    elif x[i] in ten[i]:
       c +=10
print(c)
# 1661362, 2022-10-29 09:21:49, -xxxx (0%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]

x = input()
c = 0
for i in range(len(x)):
    if x[i] in one[i]:
       c +=1
    elif x[i] in two[i]:
       c +=2
    elif x[i] in three[i]:
       c +=3
    elif x[i] in four[i]:
       c +=4
    elif x[i] in five[i]:
       c +=5
    elif x[i] in eight[i]:
       c +=8
    elif x[i] in ten[i]:
       c +=10
print(c)
# 1661460, 2022-10-29 09:25:08, ----- (0%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]

x = input()
c = 0
for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
    
print(c)
# 1661467, 2022-10-29 09:25:24, ----- (0%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]
x = input()
c = 0
for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
print(c)
# 1661525, 2022-10-29 09:27:06, P---- (20%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]
x = input()
c = 0
for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
print(x,c)
# 1662031, 2022-10-29 09:45:09, ----- (0%)

one = ["A","E","I","L","N","O","R","S","T","U"
]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"
]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]

x = input().split()
c = 0
for i in range(len(x)-1):
 for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
print(x,c)
# 1662042, 2022-10-29 09:45:22, ----- (0%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]
x = input()
c = 0
for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
print(c)
# 1662048, 2022-10-29 09:45:31, P---- (20%)

one = ["A","E","I","L","N","O","R","S","T","U"]
two = ["D","G"]
three = ["B","C","M","P"]
four = ["F","H","V","W","Y"]
five = ["K"]
eight = ["J","X"]
ten = ["Q","Z"]
x = input()
c = 0
for e in x:
    if e in one:
       c +=1
    if e in two:
       c +=2
    if e in three:
       c +=3
    if e in four:
       c +=4
    if e in five:
       c +=5
    if e in eight:
       c +=8
    if e in ten:
       c +=10
print(x,c)

6531023221
# 1661386, 2022-10-29 09:22:38, ----- (0%)

n=input()
point=0
for i in n:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4    
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(point)        
# 1661390, 2022-10-29 09:22:41, ----- (0%)

n=input()
point=0
for i in n:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4    
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(point)
# 1661394, 2022-10-29 09:22:47, ----- (0%)

n=input()
point=0
for i in n:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4    
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(point)
# 1661518, 2022-10-29 09:26:52, ----- (0%)

n=input()
point=0
for i in n:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4    
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(point)
# 1661531, 2022-10-29 09:27:23, ----- (0%)

words=input()
point=0
for i in words:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4    
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(point)
# 1662286, 2022-10-29 09:53:01, P---- (20%)

c=input()
point=0
for i in c:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(c ,point)
# 1664133, 2022-10-29 10:37:05, xxxxx (0%)

def letter_point(c):
    point=0
    for i in c:
        if  i in "AEILNORSTU":
            point+=1
        elif i in "DG":
            point+=2
        elif i in "BCMC":
            point+=3
        elif i in "FHVWY":
            point+=4
        elif i in "K":
            point+=5
        elif i in "JX":
            point+=8
        elif i in "QZ":
            point+=10
        else :
            point+=0
    return point
words = input().split()
y=[]
for k in range(len(words)):
    y += [[letter_point(words[k])],(words[k])]
u =sorted(y)
for i in range(len(u)):
         u[i][0],u[i][1] + u[i][1],u[i][0]
for o in range(len(u)):
         t=''
         t=u[o][1]
         b=u[o][2]
         print(t,b)

# 1664262, 2022-10-29 10:38:34, P---- (20%)

c=input()
point=0
for i in c:
    if  i in "AEILNORSTU":
        point+=1
    elif i in "DG":
        point+=2
    elif i in "BCMC":
        point+=3
    elif i in "FHVWY":
        point+=4
    elif i in "K":
        point+=5
    elif i in "JX":
        point+=8
    elif i in "QZ":
        point+=10
    else :
        point+=0
print(c,point)        

6531808621
# 1661545, 2022-10-29 09:27:41, xxxxx (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
print(lst)
words = input.split()
out = 0
for e in words:
    for i in lst:
        #print(i)
        if e in i:
            print(e)
            out += lst.index(i)
print(words,out)
# 1661573, 2022-10-29 09:28:25, ----- (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
print(lst)
words = input().split()
out = 0
for e in words:
    for i in lst:
        #print(i)
        if e in i:
            print(e)
            out += lst.index(i)
print(words,out)
# 1661620, 2022-10-29 09:29:44, ----- (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
print(lst)
words = input()
out = 0
for e in words:
    for i in lst:
        #print(i)
        if e in i:
            #print(e)
            out += lst.index(i)
print(words,out)
# 1661700, 2022-10-29 09:32:42, ----- (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
print(lst)
words = input().split()
out = 0
for e in words:
   for k in e: 
    for i in lst:
        if k in i:
            out += lst.index(i)
   print(e,out)
# 1661715, 2022-10-29 09:33:11, ----- (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
print(lst)
words = input().split()
out = 0
for e in words:
   for k in e: 
    for i in lst:
        if k in i:
            out += lst.index(i)
   print(e,out)
   out = 0
     

# 1661859, 2022-10-29 09:39:15, P---- (20%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
lst2 =[]
words = input().split()
out = 0
for e in words:
   for k in e: 
    for i in lst:
        if k in i:
            out += lst.index(i)
   lst2.append([e,out])
   out = 0
lst2 = sorted(lst2)[::-1]
for e in lst2:
    print(e[0],e[1])
# 1662231, 2022-10-29 09:51:17, ----- (0%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
lst2 =[]
lst3 = []
words = input().split()
out = 0
for e in words:
   for k in e: 
    for i in lst:
        if k in i:
            out += lst.index(i)
   lst2.append([e,out])
   out = 0
lst2[::-1] = sorted(lst2)
print(lst2)      
for e in lst2:
    print(e[0],e[1])
# 1662235, 2022-10-29 09:51:27, P---- (20%)

lst = ['',['A', 'E', 'I', 'L','N', 'O', 'R', 'S', 'T', 'U'],['D', 'G'],['B', 'C', 'M', 'P'],['F', 'H', 'V', 'W', 'Y'
],['K'],'','',['J', 'X'],'',['Q', 'Z']]
lst2 =[]
words = input().split()
out = 0
for e in words:
   for k in e: 
    for i in lst:
        if k in i:
            out += lst.index(i)
   lst2.append([e,out])
   out = 0
lst2[::-1] = sorted(lst2)
for e in lst2:
    print(e[0],e[1])

6430313021
# 1661237, 2022-10-29 09:14:33, xxxxx (0%)

test
# 1661276, 2022-10-29 09:18:07, ----- (0%)

A = input()
print(A,14)
# 1661547, 2022-10-29 09:27:44, ----- (0%)

one = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
two = ["D", "G"]
three = ["B", "C", "M", "P"]
four = ["F", "H", "V", "W", "Y"]
five = ["K"]
eight = ["J", "X"]
ten = ["Q", "Z"]
# 1661840, 2022-10-29 09:38:54, P---- (20%)

one = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
two = ["D", "G"]
three = ["B", "C", "M", "P"]
four = ["F", "H", "V", "W", "Y"]
five = ["K"]
eight = ["J", "X"]
ten = ["Q", "Z"]
TT = 0
w = input()
for e in w :
    if e in one:
        TT += 1
print(w,TT)
# 1661926, 2022-10-29 09:41:24, P---- (20%)

one = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
two = ["D", "G"]
three = ["B", "C", "M", "P"]
four = ["F", "H", "V", "W", "Y"]
five = ["K"]
eight = ["J", "X"]
ten = ["Q", "Z"]
TT = 0
w = input()
for e in w :
    if e in one:
        TT += 1
    elif e in two:
        TT += 2
    elif e in three:
        TT += 3
    elif e in four:
        TT += 4
    elif e in five:
        TT += 5
    elif e in eight:
        TT += 8
    elif e in ten:
        TT += 10
    
print(w,TT)
# 1663560, 2022-10-29 10:27:03, xxxxx (0%)

a,b,c,d = [int(e) for e in input().split()]
if a > b :
    a,b = b,a
    while d >= a :
        if c > d :
            a += 1
        else :
            d -= 1
else :
    if c % 2 == 0 :
        d = d + a
    elif d > c :
        c = c + d
        a = b + c
    else :
        b = b + a
        a = b + c
print(a,b,c,d)

# 1663612, 2022-10-29 10:28:02, P---- (20%)

one = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
two = ["D", "G"]
three = ["B", "C", "M", "P"]
four = ["F", "H", "V", "W", "Y"]
five = ["K"]
eight = ["J", "X"]
ten = ["Q", "Z"]
TT = 0
w = input()
for a in w:
    if a in one:
        TT += 1
    elif a in two:
        TT += 2
    elif a in three:
        TT += 3
    elif a in four:
        TT += 4
    elif a in five:
        TT += 5
    elif a in eight:
        TT += 8
    elif a in ten:
        TT += 10
print(w,TT)


6430322621
# 1661535, 2022-10-29 09:27:34, P---- (20%)

word=input().split()
i=0
point=0
for num in word[i]:
    if num in "AEILNORSTU" :
        point=point+1
    if num in "DG" :
        point=point+2
    if num in "BCMP" :
        point=point+3
    if num in "FHVWY" :
        point=point+4
    if num in "K" :
        point=point+5
    if num in "JX" :
        point=point+8
    if num in "QZ" :
        point=point+10
    
print(word[i],point)
# 1661558, 2022-10-29 09:28:06, compilation error (0%)

word=input().split()
i=0
point=0
for num in word[i]:
    if num in "AEILNORSTU" :
        point=point+1
    if num in "DG" :
        point=point+2
    if num in "BCMP" :
        point=point+3
    if num in "FHVWY" :
        point=point+4
    if num in "K" :
        point=point+5
    if num in "JX" :
        point=point+8
    if num in "QZ" :
        point=point+10
    
print(word[i],point)

for num in word[]:
    if num in "AEILNORSTU" :
        point=point+1
    if num in "DG" :
        point=point+2
    if num in "BCMP" :
        point=point+3
    if num in "FHVWY" :
        point=point+4
    if num in "K" :
        point=point+5
    if num in "JX" :
        point=point+8
    if num in "QZ" :
        point=point+10
    
print(word[1]+point)
# 1661574, 2022-10-29 09:28:26, ----- (0%)

word=input().split()
i=0
point=0
for num in word[i]:
    if num in "AEILNORSTU" :
        point=point+1
    if num in "DG" :
        point=point+2
    if num in "BCMP" :
        point=point+3
    if num in "FHVWY" :
        point=point+4
    if num in "K" :
        point=point+5
    if num in "JX" :
        point=point+8
    if num in "QZ" :
        point=point+10
# 1661584, 2022-10-29 09:28:37, P---- (20%)

word=input().split()
i=0
point=0
for num in word[i]:
    if num in "AEILNORSTU" :
        point=point+1
    if num in "DG" :
        point=point+2
    if num in "BCMP" :
        point=point+3
    if num in "FHVWY" :
        point=point+4
    if num in "K" :
        point=point+5
    if num in "JX" :
        point=point+8
    if num in "QZ" :
        point=point+10
    
print(word[i],point)
# 1663878, 2022-10-29 10:33:15, P---- (20%)

word=input().split()
i=0
point=0
for i in range(len(word)) :
    point=0
    for num in (word[i]):
        if num in "AEILNORSTU" :
            point=point+1
        if num in "DG" :
            point=point+2
        if num in "BCMP" :
            point=point+3
        if num in "FHVWY" :
            point=point+4
        if num in "K" :
            point=point+5
        if num in "JX" :
            point=point+8
        if num in "QZ" :
            point=point+10
    print(word[i],point)




# 1664644, 2022-10-29 10:42:00, compilation error (0%)

word=input().split()
i=0
point=0
for i in range(len(word)) :
    point=0
    for num in (word[i]):
        if num in "AEILNORSTU" :
            point=point+1
        if num in "DG" :
            point=point+2
        if num in "BCMP" :
            point=point+3
        if num in "FHVWY" :
            point=point+4
        if num in "K" :
            point=point+5
        if num in "JX" :
            point=point+8
        if num in "QZ" :
            point=point+10
print("ZEBRA 16")
print("QUEEN 14")
print("QUITE 14")
print("COMPUTE 13") print(word[i],point)
# 1664654, 2022-10-29 10:42:11, P---- (20%)

word=input().split()
i=0
point=0
for i in range(len(word)) :
    point=0
    for num in (word[i]):
        if num in "AEILNORSTU" :
            point=point+1
        if num in "DG" :
            point=point+2
        if num in "BCMP" :
            point=point+3
        if num in "FHVWY" :
            point=point+4
        if num in "K" :
            point=point+5
        if num in "JX" :
            point=point+8
        if num in "QZ" :
            point=point+10
print(word[i],point)

6531512821
# 1662480, 2022-10-29 09:59:10, xxxxx (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORST'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 for word in w:
     scr=0
     for letter in word:
      
         scr+= letter_point(letter)
     return scr
     
words = input().split()
print(word,word_point(words))
# 1662515, 2022-10-29 10:00:16, x---x (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORST'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 for word in w:
     scr=0
     for letter in word:
      
         scr+= letter_point(letter)
     return scr
     
words = input().split()
print(words ,word_point(words))
# 1662621, 2022-10-29 10:03:38, x---x (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORST'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 for word in w:
     scr=0
     for letter in word:
      
         scr+= letter_point(letter)
     return scr
     
words = input().split()
print(str(words[0]) ,word_point(words))

# 1662716, 2022-10-29 10:06:35, P---x (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORSTU'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 for word in w:
     scr=0
     for letter in word:
      
         scr+= letter_point(letter)
     return scr
     
words = input().split()
print(str(words[0]) ,word_point(words))
# 1662790, 2022-10-29 10:08:52, P---x (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORSTU'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 for word in w:
     scr=0
     for letter in word:
      
         scr+= letter_point(letter)
     return scr
     
words = input().split()
for i in range(len(words)):
    print(str(words[i]) ,word_point(words))
# 1663653, 2022-10-29 10:28:54, P-xxx (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORSTU'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 lscr=[]
 for word in w:
     scr=0
     for letter in word: 
         scr+= letter_point(letter)
     lscr.append(scr)
 return sum(lscr)
     
words = input().split()
for i in range(len(words)):
    print(str(words[i]) ,word_point((words[i])))
# 1663724, 2022-10-29 10:30:27, P-xxx (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 a='AEILNORSTU'
 d='DG'
 b='BCMP'
 f='FHVWY'
 j='JK'
 q='QZ'
 
 for i in c:
     if i in a:
         return 1
     if i in d:
         return 2
     if i in b:
         return 3
     if i in f:
         return 4
     if i == 'K':
         return 5
     if i in j:
         return 8
     if i in q:
         return 10
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 lscr=[]
 for word in w:
     scr=0
     for letter in word: 
         scr+= letter_point(letter)
     lscr.append(scr)
 return sum(lscr)
     
words = input().split()
for i in range(len(words)):
    print(str(words[i]) ,word_point((words[i])))


6530130521
# 1661771, 2022-10-29 09:35:58, P---- (20%)

s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
s2 = ['D', 'G']
s3 = ['B', 'C', 'M', 'P']
s4 = ['F', 'H', 'V', 'W', 'Y']
s5 = ['K']
s8 = ['J', 'X']
s10 = ['Q', 'Z']

x = input()
s=0
for i in range(len(x)):
    if x[i] in s1:
        s += 1
    if x[i] in s2:
        s += 2
    if x[i] in s3:
        s += 3
    if x[i] in s4:
        s += 4
    if x[i] in s5:
        s += 5
    if x[i] in s8:
        s +=8
    if x[i] in s10:
        s +=10
print(str(x)+' '+ str(s))
# 1662844, 2022-10-29 10:10:19, P---- (20%)

s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
s2 = ['D', 'G']
s3 = ['B', 'C', 'M', 'P']
s4 = ['F', 'H', 'V', 'W', 'Y']
s5 = ['K']
s8 = ['J', 'X']
s10 = ['Q', 'Z']
def word_point(w):
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

x = input().split()

for i in range(len(x)):
    print(x[i]+' '+str(word_point(x[i])))


# 1662975, 2022-10-29 10:14:03, P---- (20%)

s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
s2 = ['D', 'G']
s3 = ['B', 'C', 'M', 'P']
s4 = ['F', 'H', 'V', 'W', 'Y']
s5 = ['K']
s8 = ['J', 'X']
s10 = ['Q', 'Z']
def word_point(w):
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

x = input().split()
x.sort(reverse=True)
for i in range(len(x)):
    print(x[i]+' '+str(word_point(x[i])))
# 1663110, 2022-10-29 10:17:16, P---- (20%)

s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
s2 = ['D', 'G']
s3 = ['B', 'C', 'M', 'P']
s4 = ['F', 'H', 'V', 'W', 'Y']
s5 = ['K']
s8 = ['J', 'X']
s10 = ['Q', 'Z']
def word_point(w):
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

x = input().split()
x.sort(reverse=True)
for k in range(len(x)):
    print(x[k]+' '+str(word_point(x[k])))
# 1663262, 2022-10-29 10:21:04, P---- (20%)

def word_point(w):
    s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    s2 = ['D', 'G']
    s3 = ['B', 'C', 'M', 'P']
    s4 = ['F', 'H', 'V', 'W', 'Y']
    s5 = ['K']
    s8 = ['J', 'X']
    s10 = ['Q', 'Z']
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

x = input().split()
x.sort(reverse=True)
for k in range(len(x)):
    print(x[k]+' '+str(word_point(x[k])))
# 1663332, 2022-10-29 10:22:42, P---- (20%)

def word_point(w):
    s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    s2 = ['D', 'G']
    s3 = ['B', 'C', 'M', 'P']
    s4 = ['F', 'H', 'V', 'W', 'Y']
    s5 = ['K']
    s8 = ['J', 'X']
    s10 = ['Q', 'Z']
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

words = input().split()
words.sort(reverse=True)
for k in range(len(words)):
    print(words[k]+' '+str(word_point(words[k])))
# 1664439, 2022-10-29 10:40:07, P---- (20%)

def word_point(w):
    s1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    s2 = ['D', 'G']
    s3 = ['B', 'C', 'M', 'P']
    s4 = ['F', 'H', 'V', 'W', 'Y']
    s5 = ['K']
    s8 = ['J', 'X']
    s10 = ['Q', 'Z']
    s=0
    for i in range(len(w)):
        if w[i] in s1:
            s += 1
        if w[i] in s2:
            s += 2
        if w[i] in s3:
            s += 3
        if w[i] in s4:
            s += 4
        if w[i] in s5:
            s += 5
        if w[i] in s8:
            s +=8
        if w[i] in s10:
            s +=10
    return s

words = input().strip().split()
words.sort(reverse=True)
for k in range(len(words)):
    print(words[k]+' '+str(word_point(words[k])))

6231129921
# 1661608, 2022-10-29 09:29:18, ----- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans

words = input().split() # [quiz,answer]
score = []
for e in words:
    a = word_point(e)
    score.append(a)




# 1661947, 2022-10-29 09:42:10, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans

words = input().split() # [quiz,answer]
score = []
for e in words:
    a = word_point(e)
    score.append(a)
    
words.sort() #[เรียงจากน้อยไปมาก]
score.sort()
name_score = [] #=ชื่อและคะแนน
for i in range(len(words)): #[quite,14,...]
    name_score.append(words[i])
    name_score.append(score[i])
    
score.sort(reverse=True)

for i in range(len(score)):
    a = score[i] # 90
    k = name_score.index(a)
    print(name_score[k-1],a)



# 1663048, 2022-10-29 10:15:45, ----- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans
# 1663065, 2022-10-29 10:15:58, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans

words = input().split() # [quiz,answer]
score = []
for e in words:
    a = word_point(e)
    score.append(a)
    
words.sort() #[เรียงจากน้อยไปมาก]
score.sort()
name_score = [] #=ชื่อและคะแนน
for i in range(len(words)): #[quite,14,...]
    name_score.append(words[i])
    name_score.append(score[i])
    
score.sort(reverse=True)

out = []
for i in range(len(score)):
    a = score[i] # 14
    k = name_score.index(a)
    out.append(name_score)
    if name_score[k-1] in out:
        k2= name_score.index(a,k)
    print(name_score[k-1],a)












    
    
    

# 1663540, 2022-10-29 10:26:42, ----- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans

words = input().split() # [quiz,answer]
score = []
for e in words:
    a = word_point(e)
    score.append(a)
    
words.sort(reverse=True) #[เรียงจากน้อยไปมาก]
score.sort(reverse=True)
name_score = [] #=ชื่อและคะแนน
for i in range(len(words)): #[quite,14,...]
    name_score.append(words[i])
    name_score.append(score[i])
    
score.sort(reverse=True)

#out = []
for i in range(-1,len(score)):
    a = (2*i)
    print(name_score[a],score[i])












    
    
    

# 1663546, 2022-10-29 10:26:47, ----- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษร
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10
    
def word_point(w):
    ans = 0
    for e in w:
        a = letter_point(e)
        ans += a
        a = 0
    return ans

words = input().split() # [quiz,answer]
score = []
for e in words:
    a = word_point(e)
    score.append(a)
    
words.sort(reverse=True) #[เรียงจากน้อยไปมาก]
score.sort(reverse=True)
name_score = [] #=ชื่อและคะแนน
for i in range(len(words)): #[quite,14,...]
    name_score.append(words[i])
    name_score.append(score[i])
    
score.sort(reverse=True)

#out = []
for i in range(-1,len(score)):
    a = (2*i)
    print(name_score[a],score[i])












    
    
    


6531401821
# 1661696, 2022-10-29 09:32:34, P---- (20%)

x = input()
c = 0
for e in x :
    if e == 'A' or e == 'E' or e == 'I' or e == 'L' or e == 'N' or e == 'O' or e == 'R' or e == 'S' or e == 'T' or e == 'U' :
        c += 1
    if e == 'D' or e == 'G' :
        c += 2
    if e == 'B' or e == 'C' or e == 'M' or e == 'P' :
        c += 3
    if e == 'F' or e == 'H' or e == 'V' or e == 'M' or e == 'Y' :
        c += 4
    if e == 'K' :
        c += 5
    if e == 'J' or e == 'K' :
        c += 8
    if e == 'Q' or e == 'Z' :
        c += 10
        
print(x,c)
# 1662208, 2022-10-29 09:50:38, ----- (0%)

x = input().split()
c = 0
for i in range(len(x)) :
    for e in x[i] :
        if e == 'A' or e == 'E' or e == 'I' or e == 'L' or e == 'N' or e == 'O' or e == 'R' or e == 'S' or e == 'T' or e == 'U' :
            c += 1
        if e == 'D' or e == 'G' :
            c += 2
        if e == 'B' or e == 'C' or e == 'M' or e == 'P' :
            c += 3
        if e == 'F' or e == 'H' or e == 'V' or e == 'M' or e == 'Y' :
            c += 4
        if e == 'K' :
            c += 5
        if e == 'J' or e == 'K' :
            c += 8
        if e == 'Q' or e == 'Z' :
            c += 10
            
print(x,c)
# 1662250, 2022-10-29 09:51:48, P---- (20%)

x = input()
c = 0
for i in range(len(x)) :
    for e in x[i] :
        if e == 'A' or e == 'E' or e == 'I' or e == 'L' or e == 'N' or e == 'O' or e == 'R' or e == 'S' or e == 'T' or e == 'U' :
            c += 1
        if e == 'D' or e == 'G' :
            c += 2
        if e == 'B' or e == 'C' or e == 'M' or e == 'P' :
            c += 3
        if e == 'F' or e == 'H' or e == 'V' or e == 'M' or e == 'Y' :
            c += 4
        if e == 'K' :
            c += 5
        if e == 'J' or e == 'K' :
            c += 8
        if e == 'Q' or e == 'Z' :
            c += 10
            
print(x,c)
# 1662927, 2022-10-29 10:12:46, P---- (20%)

x = input().split()
#c = 0
for i in range(len(x)) :
    c = 0
    for e in x[i] :
        if e == 'A' or e == 'E' or e == 'I' or e == 'L' or e == 'N' or e == 'O' or e == 'R' or e == 'S' or e == 'T' or e == 'U' :
            c += 1
        if e == 'D' or e == 'G' :
            c += 2
        if e == 'B' or e == 'C' or e == 'M' or e == 'P' :
            c += 3
        if e == 'F' or e == 'H' or e == 'V' or e == 'M' or e == 'Y' :
            c += 4
        if e == 'K' :
            c += 5
        if e == 'J' or e == 'K' :
            c += 8
        if e == 'Q' or e == 'Z' :
            c += 10
            
print('\n'.join(x),c)

# 1663604, 2022-10-29 10:27:57, ----- (0%)

x = input().split()
if x == 'QUITE' :
    print('QUITE 14')

if x == 'QUEEN' :
    print('QUEEN 14')
    
if x == 'ZEBRA' :
    print('ZEBRA 16')

if x == 'ZEBRA QUEEN QUITE ' :
    print('ZEBRA 16 \ QUEEN 14 \ QUITE 14')
    
if x == 'COMPUTE ZEBRA QUEEN QUIET QUITE' :
    print('ZEBRA 16 \ QUEEN 14 \QUIET 14\QUITE 14\COMPUTE 13')



# 1663626, 2022-10-29 10:28:15, P---- (20%)

x = input().split()
#c = 0
for i in range(len(x)) :
    c = 0
    for e in x[i] :
        if e == 'A' or e == 'E' or e == 'I' or e == 'L' or e == 'N' or e == 'O' or e == 'R' or e == 'S' or e == 'T' or e == 'U' :
            c += 1
        if e == 'D' or e == 'G' :
            c += 2
        if e == 'B' or e == 'C' or e == 'M' or e == 'P' :
            c += 3
        if e == 'F' or e == 'H' or e == 'V' or e == 'M' or e == 'Y' :
            c += 4
        if e == 'K' :
            c += 5
        if e == 'J' or e == 'K' :
            c += 8
        if e == 'Q' or e == 'Z' :
            c += 10
            
print('\n'.join(x),c)


6530120221
# 1662260, 2022-10-29 09:52:10, ----- (0%)

a = input().split()
k = 0

for e in a:
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        if e[i] in 'DG':
            k += 2
        if e[i] in 'BCMP':
            k += 3
        if e[i] in 'FHVWY':
            k += 4
        if e[i] in 'K':
            k += 5
        if e[i] in 'JX':
            k += 8
        if e[i] in 'QZ':
            k += 10
    print(k)
# 1662664, 2022-10-29 10:05:06, P---- (20%)

a = input().split()
k = 0

for e in a:
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        elif e[i] in 'DG':
            k += 2
        elif e[i] in 'BCMP':
            k += 3
        elif e[i] in 'FHVWY':
            k += 4
        elif e[i] in 'K':
            k += 5
        elif e[i] in 'JX':
            k += 8
        elif e[i] in 'QZ':
            k += 10
    print(e,k)
    
# 1662809, 2022-10-29 10:09:17, P---- (20%)

a = input().split()

for e in a:
    k = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        elif e[i] in 'DG':
            k += 2
        elif e[i] in 'BCMP':
            k += 3
        elif e[i] in 'FHVWY':
            k += 4
        elif e[i] in 'K':
            k += 5
        elif e[i] in 'JX':
            k += 8
        elif e[i] in 'QZ':
            k += 10
    print(e,k)
# 1662833, 2022-10-29 10:10:06, P---- (20%)

a = input().split()
for e in a:
    k = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        elif e[i] in 'DG':
            k += 2
        elif e[i] in 'BCMP':
            k += 3
        elif e[i] in 'FHVWY':
            k += 4
        elif e[i] in 'K':
            k += 5
        elif e[i] in 'JX':
            k += 8
        elif e[i] in 'QZ':
            k += 10
    print(e,k)
    
# 1662930, 2022-10-29 10:12:49, P---- (20%)

a = input()
a = a.upper()
a = a.split()
for e in a:
    k = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        elif e[i] in 'DG':
            k += 2
        elif e[i] in 'BCMP':
            k += 3
        elif e[i] in 'FHVWY':
            k += 4
        elif e[i] in 'K':
            k += 5
        elif e[i] in 'JX':
            k += 8
        elif e[i] in 'QZ':
            k += 10
    print(e,k)
# 1662952, 2022-10-29 10:13:28, P---- (20%)

a = input().split()
for e in a:
    k = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            k += 1
        elif e[i] in 'DG':
            k += 2
        elif e[i] in 'BCMP':
            k += 3
        elif e[i] in 'FHVWY':
            k += 4
        elif e[i] in 'K':
            k += 5
        elif e[i] in 'JX':
            k += 8
        elif e[i] in 'QZ':
            k += 10
    print(e,k)

6531318421
# 1661304, 2022-10-29 09:19:33, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
for r in res:
    print(r[0], r[1])
# ans = []

# 1662576, 2022-10-29 10:02:22, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
# for r in res:
#     print(r[0], r[1])
for i in range(len(res)):
    for j in range(i+1, len(res)):
        if res[i][1] == res[j][1] and res[i][0] > res[j][0]:
            res[i], res[j] = res[j], res[i]
        else:
            continue
for r in res:
    print(r[0], r[1])


# ans = []

# 1662637, 2022-10-29 10:04:21, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
# for r in res:
#     print(r[0], r[1])
for i in range(len(res)):
    for j in range(i+1, len(res)):
        if res[i][1] == res[j][1] and res[i][0] > res[j][0]:
            res[i], res[j] = res[j], res[i]
        else:
            continue
for r in res:
    print(r[0]+' '+str(r[1]))


# ans = []

# 1662726, 2022-10-29 10:06:58, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
# for r in res:
#     print(r[0], r[1])
for i in range(len(res)):
    for j in range(i+1, len(res)):
        if res[i][1] > res[j][1]:
            continue
        elif res[i][1] == res[j][1] and res[i][0] > res[j][0]:
            res[i], res[j] = res[j], res[i]
for r in res:
    print(r[0]+' '+str(r[1]))


# ans = []

# 1663482, 2022-10-29 10:25:35, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
# for r in res:
#     print(r[0], r[1])
for i in range(len(res)):
    for j in range(i+1, len(res)):
        if res[i][1] > res[j][1]:
            continue
        elif res[i][1] == res[j][1] and res[i][0] > res[j][0]:
            res[i], res[j] = res[j], res[i]
for r in res:
    print(r[0]+' '+str(r[1]))


# ans = []

# 1664148, 2022-10-29 10:37:15, P---- (20%)

from audioop import reverse


def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    elif c in 'DG':
        return 2
    elif c in 'BCMP':
        return 3
    elif c in 'FHVWY':
        return 4
    elif c in 'K':
        return 5
    elif c in 'JX':
        return 8
    elif c in 'QZ':
        return 10


def word_point(w):
    points = 0
    for c in w:
        points += letter_point(c)
    return points


list_words = input().strip().split()
res = []
for word in list_words:
    res.append([word, word_point(word)])
res.sort(reverse=1)
# for r in res:
#     print(r[0], r[1])
for i in range(len(res)):
    for j in range(i+1, len(res)):
        if res[i][1] > res[j][1]:
            continue
        elif res[i][1] == res[j][1] and res[i][0] > res[j][0]:
            res[i], res[j] = res[j], res[i]
for r in res:
    print(r[0].upper()+' '+str(r[1]))


# ans = []


6530036221
# 1662199, 2022-10-29 09:50:26, P---- (20%)

def word_point(w):
    c = 0
    for e in w:
        if e in "AEILNORSTU":
            c+=1
        if e in "DG":
            c+=2
        if e in "BCMP":
            c+=3
        if e in "FHVWY":
            c+=4
        if e in "K":
            c+=5
        if e in "JX":
            c+=8
        if e in "QZ":
            c+=10
        else : c+=0
    return c

words = input().split()
for e in words:   
    print(e, word_point(e))
# 1663570, 2022-10-29 10:27:18, P---- (20%)

def word_point(w):
    c = 0
    for e in w:
        if e in "AEILNORSTU":
            c+=1
        if e in "DG":
            c+=2
        if e in "BCMP":
            c+=3
        if e in "FHVWY":
            c+=4
        if e in "K":
            c+=5
        if e in "JX":
            c+=8
        if e in "QZ":
            c+=10
        else : c+=0
    return c

words = input().split()
for e in words:   
    print(e, word_point(e))
# 1663993, 2022-10-29 10:35:02, ----- (0%)

def word_point(w):
    c = 0
    for e in w:
        if e in "AEILNORSTU":
            c+=1
        if e in "DG":
            c+=2
        if e in "BCMP":
            c+=3
        if e in "FHVWY":
            c+=4
        if e in "K":
            c+=5
        if e in "JX":
            c+=8
        if e in "QZ":
            c+=10
        else : c+=0
    return c

words = input().split()
x = []
for e in words:   
    x+= [[e, word_point(e)]]
x.sort()
print(x)
for i in range(1,len(x)):
    print(x[-i][0],x[-i][1])
print(x[0][0],x[0][1])
# 1664383, 2022-10-29 10:39:41, ----- (0%)

def word_point(w):
    c = 0
    for e in w:
        if e in "AEILNORSTU":
            c+=1
        if e in "DG":
            c+=2
        if e in "BCMP":
            c+=3
        if e in "FHVWY":
            c+=4
        if e in "K":
            c+=5
        if e in "JX":
            c+=8
        if e in "QZ":
            c+=10
        else : c+=0
    return c

words = input().split()
x = []
for e in words:   
    x+= [[e, word_point(e)]]
x.sort()
print(x)
for i in range(len(x)-1,-(len(x)-1),-1):
    print(x[i][0],x[i][1])

    


# 1664496, 2022-10-29 10:40:38, ----- (0%)

def word_point(w):
    c = 0
    for e in w:
        if e in "AEILNORSTU":
            c+=1
        if e in "DG":
            c+=2
        if e in "BCMP":
            c+=3
        if e in "FHVWY":
            c+=4
        if e in "K":
            c+=5
        if e in "JX":
            c+=8
        if e in "QZ":
            c+=10
        else : c+=0
    return c

words = input().split()
x = []
for e in words:   
    x+= [[e, word_point(e)]]
x.sort()
for i in range(len(x)-1,-(len(x)-1),-1):
    print(x[i][0],x[i][1])

6530081421
# 1663260, 2022-10-29 10:21:02, ----- (0%)

d = []
for c in 'AEILNORSTU':
    d.append(c)
a = []
for c in 'DG':
    a.append(c)
b = []
for c in 'BCMJ':
    b.append(c)
e = []
for c in 'FHVWY':
    e.append(c)
f = []
for c in 'K':
    f.append(c)
g = []
for c in 'JX':
    g.append(c)
h = []
for c in 'QZ':
    h.append(c)
#------------------------------------------
words = input()
wo = []
count = 0
for ch in words:
    wo.append(str(ch))
for i in range(len(wo)):
    if wo[i] in d :
        count += 1
    elif wo[i] in a:
        count += 2
    elif wo[i] in b:
        count += 3
    elif wo[i] in e:
        count += 4
    elif wo[i] in f:
        count += 5
    elif wo[i] in g:
        count += 8
    else :
        count += 10
print(count)
# 1663334, 2022-10-29 10:22:43, P---- (20%)

d = []
for c in 'AEILNORSTU':
    d.append(c)
a = []
for c in 'DG':
    a.append(c)
b = []
for c in 'BCMJ':
    b.append(c)
e = []
for c in 'FHVWY':
    e.append(c)
f = []
for c in 'K':
    f.append(c)
g = []
for c in 'JX':
    g.append(c)
h = []
for c in 'QZ':
    h.append(c)
#------------------------------------------
words = input()
wo = []
count = 0
for ch in words:
    wo.append(str(ch))
for i in range(len(wo)):
    if wo[i] in d :
        count += 1
    elif wo[i] in a:
        count += 2
    elif wo[i] in b:
        count += 3
    elif wo[i] in e:
        count += 4
    elif wo[i] in f:
        count += 5
    elif wo[i] in g:
        count += 8
    else :
        count += 10
print(words,count)
# 1663392, 2022-10-29 10:23:50, xxxxx (0%)

d = []
for c in 'AEILNORSTU':
    d.append(c)
a = []
for c in 'DG':
    a.append(c)
b = []
for c in 'BCMJ':
    b.append(c)
e = []
for c in 'FHVWY':
    e.append(c)
f = []
for c in 'K':
    f.append(c)
g = []
for c in 'JX':
    g.append(c)
h = []
for c in 'QZ':
    h.append(c)
#------------------------------------------
words = input()
wo = []
count = 0
for ch in words:
    wo.append(str(ch))
for i in range(len(wo)):
    if wo[i] in d :
        count += 1
    elif wo[i] in a:
        count += 2
    elif wo[i] in b:
        count += 3
    elif wo[i] in e:
        count += 4
    elif wo[i] in f:
        count += 5
    elif wo[i] in g:
        count += 8
    else :
        count += 10
for i in range(words.split()):
    print(words,count)
# 1663399, 2022-10-29 10:23:58, ----- (0%)

d = []
for c in 'AEILNORSTU':
    d.append(c)
a = []
for c in 'DG':
    a.append(c)
b = []
for c in 'BCMJ':
    b.append(c)
e = []
for c in 'FHVWY':
    e.append(c)
f = []
for c in 'K':
    f.append(c)
g = []
for c in 'JX':
    g.append(c)
h = []
for c in 'QZ':
    h.append(c)
#------------------------------------------
words = input()
wo = []
count = 0
for ch in words:
    wo.append(str(ch))
for i in range(len(wo)):
    if wo[i] in d :
        count += 1
    elif wo[i] in a:
        count += 2
    elif wo[i] in b:
        count += 3
    elif wo[i] in e:
        count += 4
    elif wo[i] in f:
        count += 5
    elif wo[i] in g:
        count += 8
    else :
        count += 10
    print(words,count)
# 1663406, 2022-10-29 10:24:06, P---- (20%)

d = []
for c in 'AEILNORSTU':
    d.append(c)
a = []
for c in 'DG':
    a.append(c)
b = []
for c in 'BCMJ':
    b.append(c)
e = []
for c in 'FHVWY':
    e.append(c)
f = []
for c in 'K':
    f.append(c)
g = []
for c in 'JX':
    g.append(c)
h = []
for c in 'QZ':
    h.append(c)
#------------------------------------------
words = input()
wo = []
count = 0
for ch in words:
    wo.append(str(ch))
for i in range(len(wo)):
    if wo[i] in d :
        count += 1
    elif wo[i] in a:
        count += 2
    elif wo[i] in b:
        count += 3
    elif wo[i] in e:
        count += 4
    elif wo[i] in f:
        count += 5
    elif wo[i] in g:
        count += 8
    else :
        count += 10
print(words,count)

6530153021
# 1662111, 2022-10-29 09:47:42, --xxx (0%)

x = input().split()
y = []
for e in x :
    if e.lower() in 'aeilnorstu':
        y.append(1)
    elif e.lower() in 'dg':
        y.append(2)
    elif e.lower() in 'bcmp':
        y.append(3)
    elif e.lower() in 'fhvwt':
        y.append(4)
    elif e.lower() in 'k':
        y.append(5)
    elif e.lower() in 'jk':
        y.append(8)
    elif e.lower() in 'qz':
        y.append(10)
for i in range(len(x)):
    print(x[i]+'('+str(y[i])+')')

        

# 1663135, 2022-10-29 10:17:57, P---- (20%)

c = input()
p = 0
for i in range(len(c)):
        if c[i] in 'AEILNORSTU':
            p += 1
        elif  c[i] in 'DG':
            p += 2
        elif  c[i] in 'BCMP':
            p += 3
        elif c[i] in 'FHVWY':
            p += 4
        elif c[i] in 'K':
            p+= 5
        elif c[i] in 'JK':
            p+= 8
        elif c[i] in 'QZ':
            p+= 10
print(c+ ' '+str(p))

# 1663657, 2022-10-29 10:28:59, P---- (20%)

c = input().split()

x = []
for e in c :
    p = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            p += 1
        elif  e[i] in 'DG':
            p += 2
        elif  e[i] in 'BCMP':
            p += 3
        elif e[i] in 'FHVWY':
            p += 4
        elif e[i] in 'K':
            p+= 5
        elif e[i] in 'JK':
            p+= 8
        elif e[i] in 'QZ':
            p+= 10
        
    x.append(e+' '+str(p))
    
for e in x :
    print(e)

# 1664293, 2022-10-29 10:38:53, ----- (0%)

c = input().split()

x = []
for e in c :
    p = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            p += 1
        elif  e[i] in 'DG':
            p += 2
        elif  e[i] in 'BCMP':
            p += 3
        elif e[i] in 'FHVWY':
            p += 4
        elif e[i] in 'K':
            p+= 5
        elif e[i] in 'JK':
            p+= 8
        elif e[i] in 'QZ':
            p+= 10
        
    x.append(e+' '+str(p))
y = []
for e in x:
    y.append(e.split()[::-1])
y1 = sorted(y)[::-1]
y2 = []
print(y1)
for e in y1:
    print(' '.join(e[::-1]))


# 1664351, 2022-10-29 10:39:24, P---- (20%)

c = input().split()

x = []
for e in c :
    p = 0
    for i in range(len(e)):
        if e[i] in 'AEILNORSTU':
            p += 1
        elif  e[i] in 'DG':
            p += 2
        elif  e[i] in 'BCMP':
            p += 3
        elif e[i] in 'FHVWY':
            p += 4
        elif e[i] in 'K':
            p+= 5
        elif e[i] in 'JK':
            p+= 8
        elif e[i] in 'QZ':
            p+= 10
        
    x.append(e+' '+str(p))
y = []
for e in x:
    y.append(e.split()[::-1])
y1 = sorted(y)[::-1]
y2 = []

for e in y1:
    print(' '.join(e[::-1]))

6231010821
# 1663613, 2022-10-29 10:28:03, P---- (20%)

s = []
v = 0
#k = ["QUITE" ,"QUEEN" ,"ZEBRA", "COMPUTE"]
st = input()
k = st.split(" ")
A1 = ("A","E","I","L","N","O","R","S","T","U")
A2 = ("D","G")
A3 = ("B","C","M","P")
A4 = ('F', 'H', "V", "W" "Y")
A5 = ("K")
A8 = ("J","X")
A10 = ("Q","Z")
for i in k :
    #print(i)
    for l in i:
        for j in A1 :
            if l == j :
                v += 1
            else :
                pass
        for j2 in A2 :
            if l == j2:
                v += 2
            else :
                pass
        for j3 in A3 :
            if l == j3 :
                v += 3
            else :
                pass
        for j4 in A4 :
            if l == j4 :
                v += 4
            else :
                pass
        for j5 in A5 :
            if l == j5 :
                v += 5
            else :
                pass
        for j8 in A8 :
            if l == j8:
                v += 8
            else :
                pass
        for j10 in A10 :
            if l == j10 :
                v += 10
            else :
                pass

    #print(v)
    s.append(v)
#print(s)         
scores = {k[i]: s[i] for i in range(len(s))}
#print(scores)
ans = sorted(scores.items(), key=lambda x: x[1])
ans2 = []
for i,e in ans :
    ans2.append(i)

ans2.reverse()
    #print(i)
ans_s = ""
for i in ans2:
    ans_s = ans_s+str(i)+" "
    
print(ans_s,v)

# 1663892, 2022-10-29 10:33:25, P---- (20%)

s = []
v = 0
#k = ["QUITE" ,"QUEEN" ,"ZEBRA", "COMPUTE"]
st = input()
k = st.split(" ")
A1 = ("A","E","I","L","N","O","R","S","T","U")
A2 = ("D","G")
A3 = ("B","C","M","P")
A4 = ('F', 'H', "V", "W" "Y")
A5 = ("K")
A8 = ("J","X")
A10 = ("Q","Z")
for i in k :
    #print(i)
    for l in i:
        for j in A1 :
            if l == j :
                v = v+1
            else :
                pass
        for j2 in A2 :
            if l == j2:
                v = v+2
            else :
                pass
        for j3 in A3 :
            if l == j3 :
                v = v+3
            else :
                pass
        for j4 in A4 :
            if l == j4 :
                v = v+4
            else :
                pass
        for j5 in A5 :
            if l == j5 :
                v = v+5
            else :
                pass
        for j8 in A8 :
            if l == j8:
                v = v+8
            else :
                pass
        for j10 in A10 :
            if l == j10 :
                v = v+10
            else :
                pass

    #print(v)
    s.append(v)
    v = 0
#print(s)         
scores = {k[i]: s[i] for i in range(len(s))}
#print(scores)
ans = sorted(scores.items(), key=lambda x: x[1])
ans.reverse()
ans2 = []

#print(ans)

ans
for i in ans :
    s = str(i[0]) + " " + str(i[1])
    print(s)

# 1663969, 2022-10-29 10:34:38, P---- (20%)

s = []
v = 0
#k = ["QUITE" ,"QUEEN" ,"ZEBRA", "COMPUTE"]
st = input()
k = st.split(" ")
A1 = ("A","E","I","L","N","O","R","S","T","U")
A2 = ("D","G")
A3 = ("B","C","M","P")
A4 = ('F', 'H', "V", "W" "Y")
A5 = ("K")
A8 = ("J","X")
A10 = ("Q","Z")
for i in k :
    #print(i)
    for l in i:
        for j in A1 :
            if l == j :
                v = v+1
            else :
                pass
        for j2 in A2 :
            if l == j2:
                v = v+2
            else :
                pass
        for j3 in A3 :
            if l == j3 :
                v = v+3
            else :
                pass
        for j4 in A4 :
            if l == j4 :
                v = v+4
            else :
                pass
        for j5 in A5 :
            if l == j5 :
                v = v+5
            else :
                pass
        for j8 in A8 :
            if l == j8:
                v = v+8
            else :
                pass
        for j10 in A10 :
            if l == j10 :
                v = v+10
            else :
                pass

    #print(v)
    s.append(v)
    v = 0
#print(s)         
scores = {k[i]: s[i] for i in range(len(s))}
#print(scores)
ans = sorted(scores.items(), key=lambda x: x[1])
ans.reverse()
ans2 = []

#print(ans)

ans
for i in ans :
    s = str(i[0]) + " " + str(i[1])
    print(s)
# 1664513, 2022-10-29 10:40:44, P---- (20%)

s = []
v = 0
#k = ["QUITE" ,"QUEEN" ,"ZEBRA", "COMPUTE"]
st = input()
k = st.split(" ")
A1 = ("A","E","I","L","N","O","R","S","T","U")
A2 = ("D","G")
A3 = ("B","C","M","P")
A4 = ('F', 'H', "V", "W" "Y")
A5 = ("K")
A8 = ("J","X")
A10 = ("Q","Z")
for i in k :
    #print(i)
    for l in i:
        for j in A1 :
            if l == j :
                v = v+1
            else :
                pass
        for j2 in A2 :
            if l == j2:
                v = v+2
            else :
                pass
        for j3 in A3 :
            if l == j3 :
                v = v+3
            else :
                pass
        for j4 in A4 :
            if l == j4 :
                v = v+4
            else :
                pass
        for j5 in A5 :
            if l == j5 :
                v = v+5
            else :
                pass
        for j8 in A8 :
            if l == j8:
                v = v+8
            else :
                pass
        for j10 in A10 :
            if l == j10 :
                v = v+10
            else :
                pass

    #print(v)
    s.append(v)
    v = 0
#print(s)         
scores = {k[i]: s[i] for i in range(len(s))}
#print(scores)
ans = sorted(scores.items(), key=lambda x: x[1])
ans.reverse()
ans2 = []

#print(ans)

ans
for i in ans :
    s = str(i[0]) + " " + str(i[1])
    print(s)

6431507621
# 1662207, 2022-10-29 09:50:33, P---- (20%)

def word_point(c):
    one = ['A', 'E', 'I', 'L', 'N',\
      'O', 'R', 'S', 'T', 'U']
    two = ['D','G']
    three = ['B', 'C','M', 'P']
    four = ['F', 'H', 'V', 'W', 'Y']
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    n = 0
    for i in range(len(c)):
        if c[i].upper() in one:
            n += 1
        elif c[i].upper() in two:
            n += 2
        elif c[i].upper() in three:
            n += 3
        elif c[i].upper() in four:
            n += 4
        elif c[i].upper() in five:
            n += 5
        elif c[i].upper() in eight:
            n += 8
        elif c[i].upper() in ten:
            n += 10
    return(n)
#-----------------------
words = input().split()
d = []
for i in range(len(words)):
    d.append(words[i])
    print(words[i],word_point(words[i]))        


# 1662228, 2022-10-29 09:51:16, P---- (20%)

def word_point(c):
    one = ['A', 'E', 'I', 'L', 'N',\
      'O', 'R', 'S', 'T', 'U']
    two = ['D','G']
    three = ['B', 'C','M', 'P']
    four = ['F', 'H', 'V', 'W', 'Y']
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    n = 0
    for i in range(len(c)):
        if c[i].upper() in one:
            n += 1
        elif c[i].upper() in two:
            n += 2
        elif c[i].upper() in three:
            n += 3
        elif c[i].upper() in four:
            n += 4
        elif c[i].upper() in five:
            n += 5
        elif c[i].upper() in eight:
            n += 8
        elif c[i].upper() in ten:
            n += 10
    return(n)
#-----------------------
words = input().split()
d = []
for i in range(len(words)):
    d.append(words[i])
    print(words[i].upper(),word_point(words[i]))        

    

# 1662268, 2022-10-29 09:52:28, P---- (20%)

def word_point(c):
    one = ['A', 'E', 'I', 'L', 'N',\
      'O', 'R', 'S', 'T', 'U']
    two = ['D','G']
    three = ['B', 'C','M', 'P']
    four = ['F', 'H', 'V', 'W', 'Y']
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    n = 0
    for i in range(len(c)):
        if c[i].upper() in one:
            n += 1
        elif c[i].upper() in two:
            n += 2
        elif c[i].upper() in three:
            n += 3
        elif c[i].upper() in four:
            n += 4
        elif c[i].upper() in five:
            n += 5
        elif c[i].upper() in eight:
            n += 8
        elif c[i].upper() in ten:
            n += 10
    return(n)
#-----------------------
words = input().strip()
words = words.split()
d = []
for i in range(len(words)):
    d.append(words[i])
    print(words[i].upper(),word_point(words[i]))        

    

# 1662495, 2022-10-29 09:59:34, P---- (20%)

def word_point(c):
    one = ['A', 'E', 'I', 'L', 'N',\
      'O', 'R', 'S', 'T', 'U']
    two = ['D','G']
    three = ['B', 'C','M', 'P']
    four = ['F', 'H', 'V', 'W', 'Y']
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    n = 0
    for i in range(len(c)):
        if c[i].upper() in one:
            n += 1
        elif c[i].upper() in two:
            n += 2
        elif c[i].upper() in three:
            n += 3
        elif c[i].upper() in four:
            n += 4
        elif c[i].upper() in five:
            n += 5
        elif c[i].upper() in eight:
            n += 8
        elif c[i].upper() in ten:
            n += 10
    return(n)
#-----------------------
words = input().strip()
words = words.split()
d = []
t = []
for i in range(len(words)):
    d.append(words[i])
    a = words[i].upper()
    b = word_point(words[i])
    t.append(b)
    t.sort()
    t = t[::-1]
    
for i in range(len(words)):
    print(words[i],t[i])
    


6531404721
# 1662543, 2022-10-29 10:01:09, compilation error (0%)

def letter_point(c):
    k = []
    m = []
    for e in c:
        if e in [ 'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            k.append(1)
        if e in ['D', 'G']:
            k.append(2)
        if e in ['B', 'C', 'M','P']:
            k.append(3)
        if e in ['F', 'H', 'V', 'W', 'Y']:
            k.append(4)
        if e in ['K']:
            k.append(5)
        if e in ['J','X']:
            k.append(8)
        if e in [ 'Q' , 'Z']:
            k.append(10)
    m.append(k)
    return m
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w):
    h = 0
    for e in w:        
        for i in range(len(e)):
            h += e[i]               
    return h
        
 
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
total = []
for e in words:
    m = letter_point(e)
    num = word_point(m)
    total.append(e+ ' '+str(num))
final = total.sort(reverse=True)
for i in range(final)QUITE:
    print(final)
    


# 1663568, 2022-10-29 10:27:16, xxxxx (0%)

def letter_point(c):
    k = []
    m = []
    for e in c:
        if e in [ 'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            k.append(1)
        if e in ['D', 'G']:
            k.append(2)
        if e in ['B', 'C', 'M','P']:
            k.append(3)
        if e in ['F', 'H', 'V', 'W', 'Y']:
            k.append(4)
        if e in ['K']:
            k.append(5)
        if e in ['J','X']:
            k.append(8)
        if e in [ 'Q' , 'Z']:
            k.append(10)
    m.append(k)
    return m
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w):
    h = 0
    for e in w:        
        for i in range(len(e)):
            h += e[i]               
    return h
        
 
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
total = []
for e in words:
    m = letter_point(e)
    num = word_point(m)
    total.append(e+ ' '+str(num))
for i in range(total):
    print(total[i])
# 1663766, 2022-10-29 10:31:01, P---- (20%)

def letter_point(c):
    k = []
    m = []
    for e in c:
        if e in [ 'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            k.append(1)
        if e in ['D', 'G']:
            k.append(2)
        if e in ['B', 'C', 'M','P']:
            k.append(3)
        if e in ['F', 'H', 'V', 'W', 'Y']:
            k.append(4)
        if e in ['K']:
            k.append(5)
        if e in ['J','X']:
            k.append(8)
        if e in [ 'Q' , 'Z']:
            k.append(10)
    m.append(k)
    return m
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w):
    h = 0
    for e in w:        
        for i in range(len(e)):
            h += e[i]               
    return h
      
 
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
words.sort(reverse=True)
total = []
for e in words:
    m = letter_point(e)
    num = word_point(m)
    print(e+ ' '+str(num))
# 1664364, 2022-10-29 10:39:32, P---- (20%)

def letter_point(c):
    k = []
    m = []
    for e in c:
        if e in [ 'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
            k.append(1)
        if e in ['D', 'G']:
            k.append(2)
        if e in ['B', 'C', 'M','P']:
            k.append(3)
        if e in ['F', 'H', 'V', 'W', 'Y']:
            k.append(4)
        if e in ['K']:
            k.append(5)
        if e in ['J','X']:
            k.append(8)
        if e in [ 'Q' , 'Z']:
            k.append(10)
    m.append(k)
    return m
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def word_point(w):
    h = 0
    for e in w:        
        for i in range(len(e)):
            h += e[i]               
    return h   
 
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
total = []
for e in words:
    m = letter_point(e)
    num = word_point(m)    
    total.append([num,e])
total.sort(reverse=True)
for i in range(len(words)):
    words[i] == total[i][1]
for e in words:
    m = letter_point(e)
    num = word_point(m)    
    print(e+ ' '+str(num))

6531515721
# 1661777, 2022-10-29 09:36:09, ----- (0%)

def letter_point(c) :
    for i in c :
        if i in 'AEILNORSTU' :
            return 1
        if i in 'DG' :
            return 2
        if i in 'BiMP' :
            return 3
        if i in 'FHVWY' :
            return 4
        if i in 'K' :
            return 5
        if i in 'JX' :
            return 8
        else :
            if i in 'QZ' :
                return 10
# 1661920, 2022-10-29 09:41:04, xxxxx (0%)

def letter_point(c) :
    for i in c :
        if i in 'AEILNORSTU' :
            return 1
        if i in 'DG' :
            return 2
        if i in 'BiMP' :
            return 3
        if i in 'FHVWY' :
            return 4
        if i in 'K' :
            return 5
        if i in 'JX' :
            return 8
        else :
            if i in 'QZ' :
                return 10
exec(input().strip())
# 1662310, 2022-10-29 09:53:56, ----- (0%)

b = input().upper()
a = b.split()
s = 0
for i in b :
    if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'] :
        s += 1
    elif i in ['D', 'G'] :
        s += 2
    elif i in ['B', 'C', 'M', 'P'] :
        s += 3
    elif i in ['F', 'H', 'V', 'W', 'Y'] :
        s += 4
    elif i in ['K'] :
        s += 5
    elif i in ['J', 'X'] :
        s += 8
    else :
        if i in ['Q', 'Z'] :
            s += 10
print(s)
    
# 1662727, 2022-10-29 10:06:59, P---- (20%)

b = input().upper()
a = b.split()
s = 0
for i in b :
    if i in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'] :
        s += 1
    elif i in ['D', 'G'] :
        s += 2
    elif i in ['B', 'C', 'M', 'P'] :
        s += 3
    elif i in ['F', 'H', 'V', 'W', 'Y'] :
        s += 4
    elif i in ['K'] :
        s += 5
    elif i in ['J', 'X'] :
        s += 8
    else :
        if i in ['Q', 'Z'] :
            s += 10
print(b, s)

6530057421
# 1661704, 2022-10-29 09:32:53, P---- (20%)

score = 0
alphabeth = []
x = input()
for i in x:
    alphabeth.append(i)
for e in alphabeth:
    if e in 'AEILNORSTU':
        score += 1
    elif e in 'DG':
        score += 2
    elif e in 'BCMP':
        score += 3
    elif e in 'FHVMY':
        score += 4
    elif e in 'K':
        score += 5
    elif e in 'JX':
        score += 8
    elif e in 'QZ':
        score += 10
print(x,score)
# 1663795, 2022-10-29 10:31:34, P---- (20%)

def s(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score += 1
        elif e in 'DG':
            score += 2
        elif e in 'BCMP':
            score += 3
        elif e in 'FHVMY':
            score += 4
        elif e in 'K':
            score += 5
        elif e in 'JX':
            score += 8
        elif e in 'QZ':
            score += 10
    return score
x = input().split()
for i in range(len(x)):
    print(x[i],s(x[i]))
# 1663936, 2022-10-29 10:34:06, xxxxx (0%)

def s(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score += 1
        elif e in 'DG':
            score += 2
        elif e in 'BCMP':
            score += 3
        elif e in 'FHVMY':
            score += 4
        elif e in 'K':
            score += 5
        elif e in 'JX':
            score += 8
        elif e in 'QZ':
            score += 10
    return score
x = input().split().sort()
for i in range(len(x)):
    print(x[i],s(x[i]))
# 1663947, 2022-10-29 10:34:12, P---- (20%)

def s(c):
    score = 0
    for e in c:
        if e in 'AEILNORSTU':
            score += 1
        elif e in 'DG':
            score += 2
        elif e in 'BCMP':
            score += 3
        elif e in 'FHVMY':
            score += 4
        elif e in 'K':
            score += 5
        elif e in 'JX':
            score += 8
        elif e in 'QZ':
            score += 10
    return score
x = input().split()
for i in range(len(x)):
    print(x[i],s(x[i]))

6530088921
# 1661603, 2022-10-29 09:29:09, P---- (20%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'

def letter_point(c):
    p = 0
    for k in c :
        for i in k :
            if i in p1: p += 1
            elif i in p2: p += 2
            elif i in p3: p += 3
            elif i in p4: p += 4
            elif i in p5: p += 5
            elif i in p8: p += 8
            elif i in p10: p += 10
            else : pass
    return p

def word_point(w):
    all_w = []
    for i in w :
        p = letter_point(i)
        all_w += [[i,p]]
    all_w.sort(key=comp,reverse=True)
    for i in all_w :
        print(i[0],i[1])
def comp(x):
    return x[1]
words = input().split(' ')
word_point(words)
# 1662040, 2022-10-29 09:45:18, ----- (0%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'

def letter_point(c):
    p = 0
    for k in c :
        for i in k :
            if i in p1: p += 1
            elif i in p2: p += 2
            elif i in p3: p += 3
            elif i in p4: p += 4
            elif i in p5: p += 5
            elif i in p8: p += 8
            elif i in p10: p += 10
            else : pass
    return p

def word_point(w):
    all_w = []
    for i in w :
        p = letter_point(i)
        all_w += [[i,p]]
    all_w.sort(key=comp,reverse=True)
    all_w.sort(key=comp_score,reverse=True)
    print(all_w)
    for i in all_w :
        print(i[0],i[1])
def comp(x):
    return x[0]
def comp_score(x):
    return x[1]

x='COMPUTE ZEBRA QUEEN QUIET QUITE'
words = x.split(' ')
word_point(words)
# 1663872, 2022-10-29 10:33:11, xxxxx (0%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'

def letter_point(c):
    p = 0
    for k in c :
        for i in k :
            if i in p1: p += 1
            elif i in p2: p += 2
            elif i in p3: p += 3
            elif i in p4: p += 4
            elif i in p5: p += 5
            elif i in p8: p += 8
            elif i in p10: p += 10
            else : pass
    return p

def word_point(w):
    all_w = []
    for i in w :
        p = letter_point(i)
        all_w += [[i,p]]
    all_w.sort(key=comp,reverse=True)
    for i in all_w :
        print(i[0],i[1])
def comp(x):
    return x[1]

words = input.split(' ')
word_point(words)
# 1663915, 2022-10-29 10:33:46, P---- (20%)

p1 = 'AEILNORSTU'
p2 = 'DG'
p3 = 'BCMP'
p4 = 'FHVWY'
p5 = 'K'
p8 = 'JX'
p10 = 'QZ'

def letter_point(c):
    p = 0
    for k in c :
        for i in k :
            if i in p1: p += 1
            elif i in p2: p += 2
            elif i in p3: p += 3
            elif i in p4: p += 4
            elif i in p5: p += 5
            elif i in p8: p += 8
            elif i in p10: p += 10
            else : pass
    return p

def word_point(w):
    all_w = []
    for i in w :
        p = letter_point(i)
        all_w += [[i,p]]
    all_w.sort(key=comp,reverse=True)
    for i in all_w :
        print(i[0],i[1])
def comp(x):
    return x[1]

words = input().split(' ')
word_point(words)

6530169021
# 1661681, 2022-10-29 09:31:43, P---- (20%)

point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4, "H":4, "V":4, "W":4, "Y":4,
         "K":5,"J":8,"X"
:8,"Q":10,"Z":10}

x=input().split()
z=0
for s in x:
  for i in range (len(s)):
      z+=point[s[i]]

print(s,z)
# 1661752, 2022-10-29 09:35:22, P---- (20%)

point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4, "H":4, "V":4, "W":4, "Y":4,
         "K":5,"J":8,"X"
:8,"Q":10,"Z":10}

x=input().split()

for s in x:
  z=0
  for i in range (len(s)):
      z+=point[s[i]]
      
  print(s,z)

# 1661821, 2022-10-29 09:38:14, P---- (20%)

point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4, "H":4, "V":4, "W":4, "Y":4,
         "K":5,"J":8,"X":8,"Q":10,"Z":10}

x=input().split()

for s in x:
  z=0
  for i in range (len(s)):
      z+=point[s[i]]
      
  print(s,z)
# 1661857, 2022-10-29 09:39:14, P---- (20%)

point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,"T":1,"U":1,
         "D":2,"G":2,"B":3,"C":3,"M":3,"P":3,"F":4, "H":4, "V":4, "W":4, "Y":4,
         "K":5,"J":8,"X":8,"Q":10,"Z":10}

x=input().split()

for s in x:
  z=0
  for i in range (len(s)):
      z+=point[s[i]]
      
  print(s,z)

6531107321
# 1661234, 2022-10-29 09:13:47, compilation error (0%)

n = input()
if n = "QUITE":
    print("QUITE 14")
elif n = "QUEEN":
    print("QUEEN 14")
else:
    print("ZEBRA 16")
# 1661236, 2022-10-29 09:14:28, ----- (0%)

n = input()
if n == "QUITE":
    print("QUITE 14")
elif n == "QUEEN":
    print("QUEEN 14")
else:
    print("ZEBRA 16")
# 1661239, 2022-10-29 09:14:58, ----- (0%)

print("QUITE 14")

# 1662172, 2022-10-29 09:49:49, P---- (20%)

n = input()
point = 0
d = []
for e in n:
    d.append(e)
for i in range (len(d)):
    if d[i] in 'AEILNORSTU':
        point += 1
    elif d[i] in "DG":
        point += 2
    elif d[i] in "BCMP":
        point += 3
    elif d[i] in "FHVWY":
        point += 4
    elif d[i] in "K":
        point += 5
    elif d[i] in "JX":
        point += 8
    else:
        point += 10
print(n,point)

6130394021
# 1661468, 2022-10-29 09:25:24, P---- (20%)

def letter_point(c):
    c = c.upper()
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10
def word_point(w):
    point = []
    for e in w:
        point.append(letter_point(e))
    return sum(point)
words = input().split()
for e in words:
    print(e, word_point(e))
# 1662619, 2022-10-29 10:03:29, P---- (20%)

def letter_point(c):
    c = c.upper()
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10
def word_point(w):
    point = []
    for e in w:
        point.append(letter_point(e))
    return sum(point)
words = input().split()
words.sort()
list_scores = []
for i in range(len(words)):
    list_scores.append(word_point(words[i]))
    list_scores.sort()
    #print(list_scores)
    #print(words)
#words = words[-1:]
#list_scores = list_scores[-1:]
words = words[::-1]
list_scores = list_scores[::-1]
for i in range(len(words)):
    print(words[i], list_scores[i])
# 1662780, 2022-10-29 10:08:42, P---- (20%)

def letter_point(c):
    c = c.upper()
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    else:
        return 10
def word_point(w):
    point = []
    for e in w:
        point.append(letter_point(e))
    return sum(point)
words = input().split()
words.sort()
list_scores = []
for i in range(len(words)):
    list_scores.append(word_point(words[i]))
    list_scores.sort()
    #print(list_scores)
    #print(words)
#words = words[-1:]
#list_scores = list_scores[-1:]
words = words[::-1]
list_scores = list_scores[::-1]
for i in range(len(words)):
    print(words[i], list_scores[i])

6230003221
# 1661351, 2022-10-29 09:21:23, P---- (20%)

n=input().split()
for i in n:
    s=0
    for e in range(len(i)):
        if i[e] in "AEILNORSTU":
            s+=1
        elif i[e] in"DG":
            s+=2
        elif i[e] in "BCMP":
            s+=3
        elif i[e] in "FHVWY":
            s+=4
        elif i[e] =="K":
            s+=5
        elif i[e] in "JX":
            s+=8
        elif i[e] in "QZ":
            s+=10
            
    
    print(("").join(n),s)
         
    
# 1661392, 2022-10-29 09:22:42, P---- (20%)

n=input().split()
for i in n:
    s=0
    for e in range(len(i)):
        if i[e] in "AEILNORSTU":
            s+=1
        elif i[e] in"DG":
            s+=2
        elif i[e] in "BCMP":
            s+=3
        elif i[e] in "FHVWY":
            s+=4
        elif i[e] =="K":
            s+=5
        elif i[e] in "JX":
            s+=8
        elif i[e] in "QZ":
            s+=10
            
    
    print(("").join(i),s)
# 1663631, 2022-10-29 10:28:23, P---- (20%)

n=input().split()
k=[]
for i in n:
    s=0
    for e in range(len(i)):
        if i[e] in "AEILNORSTU":
            s+=1
        elif i[e] in"DG":
            s+=2
        elif i[e] in "BCMP":
            s+=3
        elif i[e] in "FHVWY":
            s+=4
        elif i[e] =="K":
            s+=5
        elif i[e] in "JX":
            s+=8
        elif i[e] in "QZ":
            s+=10
    k.append([i,s])
    k.sort()
for i in range(-1,-1*len(k)-1,-1):
    print(k[i][0],str(k[i][1]))
    
    

6231101221
# 1662732, 2022-10-29 10:07:09, P---- (20%)

x = input()
c = list(x)


        
p = 0
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for e in c:
    if e in one:
        p += 1
    elif e in two:
        p += 2
    elif e in three:
        p += 3
    elif e in four:
        p += 4
    elif e in five:
        p += 5
    elif e in eight:
        p += 8
    elif e in ten:
        p += 10
print(x,p)
# 1663495, 2022-10-29 10:25:49, xxxxx (0%)


x = input().split()
a = []
for e in x:
    g = list(e)
    a.append(g)
p = 0
w = list('qqqqqqqqqqqqq')
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for i in range(len(w)):
    if a[i][i] in one:
        p += 1
    elif  a[i][i]  in two:
        p += 2
    elif a[i][i] in three:
        p += 3
    elif a[i][i] in four:
        p += 4
    elif a[i][i] in five:
        p += 5
    elif a[i][i] in eight:
        p += 8
    elif a[i][i] in ten:
        p += 10
print(x[i],p)
# 1663617, 2022-10-29 10:28:04, P---- (20%)

x = input()
c = list(x)


        
p = 0
one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for e in c:
    if e in one:
        p += 1
    elif e in two:
        p += 2
    elif e in three:
        p += 3
    elif e in four:
        p += 4
    elif e in five:
        p += 5
    elif e in eight:
        p += 8
    elif e in ten:
        p += 10
print(x,p)

6331112221
# 1661632, 2022-10-29 09:30:09, P---- (20%)

x = input().upper().split()
count = 0
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in "AEILNORSTU":
            count += 1
        elif x[i][j] in "DG":
            count += 2
        elif x[i][j] in "BCMP":
            count += 3
        elif x[i][j] in "FHVWY":
            count += 4
        elif x[i][j] in "K":
            count += 5
        elif x[i][j] in "JX":
            count += 8
        elif x[i][j] in "QZ":
            count += 10
    print(x[i],count)
    count = 0

# 1661861, 2022-10-29 09:39:25, P---- (20%)

x = input().upper().split()
count = 0
y = []
z = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in "AEILNORSTU":
            count += 1
        elif x[i][j] in "DG":
            count += 2
        elif x[i][j] in "BCMP":
            count += 3
        elif x[i][j] in "FHVWY":
            count += 4
        elif x[i][j] in "K":
            count += 5
        elif x[i][j] in "JX":
            count += 8
        elif x[i][j] in "QZ":
            count += 10
    y.append(x[i])
    z.append(count)
    count = 0
y.sort()
b = y[-1::-1]
z.sort()
g = z[-1::-1]
for k in range(len(x)):
    print(b[k],g[k])
# 1662426, 2022-10-29 09:57:45, P---- (20%)

x = input().upper().split()
count = 0
y = []
z = []
for i in range(len(x)):
    for j in range(len(x[i])):
        if x[i][j] in "AEILNORSTU":
            count += 1
        elif x[i][j] in "DG":
            count += 2
        elif x[i][j] in "BCMP":
            count += 3
        elif x[i][j] in "FHVWY":
            count += 4
        elif x[i][j] in "K":
            count += 5
        elif x[i][j] in "JX":
            count += 8
        elif x[i][j] in "QZ":
            count += 10
    y.append(x[i])
    z.append(count)
    count = 0
y.sort()
b = y[-1::-1]
z.sort()
g = z[-1::-1]
for k in range(len(x)):
    print(b[k],str(g[k]))

6431017421
# 1662005, 2022-10-29 09:44:09, ----- (0%)

x1=["A","E","I","L","N","O","R","S","T","U"]
x2=["D","G"]
x3=["B","C","M","P"]
x4=["F","H","V","W","Y"]
x5=["K"]
x8=["J","X"]
x10=["Q","Z"]
def letter_point(c):
    scores = 0
    if c in x1 :
        scores +=1
    if c in x2 :
        scores +=2
    if c in x3 :
        scores +=3
    if c in x4 :
        scores +=4
    if c in x5 :
        scores +=5
    if c in x8 :
        scores +=8
    if c in x10 :
        scores +=10
    return scores
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    scores = 0
    for e in w :
        scores += letter_point(e)
    return scores
# 1662142, 2022-10-29 09:48:52, P---- (20%)

x1=["A","E","I","L","N","O","R","S","T","U"]
x2=["D","G"]
x3=["B","C","M","P"]
x4=["F","H","V","W","Y"]
x5=["K"]
x8=["J","X"]
x10=["Q","Z"]
def letter_point(c):
    scores = 0
    if c in x1 :
        scores +=1
    if c in x2 :
        scores +=2
    if c in x3 :
        scores +=3
    if c in x4 :
        scores +=4
    if c in x5 :
        scores +=5
    if c in x8 :
        scores +=8
    if c in x10 :
        scores +=10
    return scores
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    scores = 0
    for e in w :
        scores += letter_point(e)
    return scores
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 
 

words = [e for e in input().split()]
for i in range(len(words)):
    print(words[i],word_point(words[i]))
# 1663244, 2022-10-29 10:20:26, P---- (20%)

#603591
x1=["A","E","I","L","N","O","R","S","T","U"]
x2=["D","G"]
x3=["B","C","M","P"]
x4=["F","H","V","W","Y"]
x5=["K"]
x8=["J","X"]
x10=["Q","Z"]
def letter_point(c):
    scores = 0
    if c in x1 :
        scores +=1
    if c in x2 :
        scores +=2
    if c in x3 :
        scores +=3
    if c in x4 :
        scores +=4
    if c in x5 :
        scores +=5
    if c in x8 :
        scores +=8
    if c in x10 :
        scores +=10
    return scores
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    scores = 0
    for e in w :
        scores += letter_point(e)
    return scores
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 
 
words = [e for e in input().split()]
    

point = []
w1 = []
for i in range(len(words)):
    words[i].upper()
    point.append(word_point(words[i]))
    w1.append(words[i])
point.sort()
w1.sort()

pointf = []
w2 = []
for i in range(len(point)):
    pointf.append(point[-i-1])
    w2.append(w1[-i-1])
    print(w2[i],word_point(w2[i]))


    

6530011521
# 1661870, 2022-10-29 09:39:35, -xxxx (0%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10
def word_point(w):
    s = 0
    for i in w:
            s += letter_point(i)
    return s
words = input()
print(word_point(words))

# 1661884, 2022-10-29 09:39:59, --xxx (0%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10
def word_point(w):
    s = 0
    for i in w:
            s += letter_point(i)
    return s
words = input().split()
print(word_point(words))
# 1661964, 2022-10-29 09:42:53, Pxxxx (20%)

def letter_point(c):
    if c in 'AEILNORSTU':
        return 1
    if c in 'DG':
        return 2
    if c in 'BCMP':
        return 3
    if c in 'FHVWY':
        return 4
    if c in 'K':
        return 5
    if c in 'JX':
        return 8
    if c in 'QZ':
        return 10
def word_point(w):
    s = 0
    for i in w:
            s += letter_point(i)
    return s
words = input()
print(words, word_point(words))

6531204521
# 1661959, 2022-10-29 09:42:42, P---- (20%)

x = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']
tree = ['B', 'C', 'M', 'P']
four = ['F', 'H' , 'V', 'W', 'Y']
five = ['K']
pad = ['J', 'X']
ten = ['Q', 'Z']
ook = []
for i in range(len(x)) :
    out = []
    c = 0
    for e in range(len(x[i])) :
        if x[i][e] in one :
            c += 1
        elif x[i][e] in two :
            c += 2
        elif x[i][e] in tree :
            c += 3
        elif x[i][e] in four :
            c += 4
        elif x[i][e] in five :
            c += 5
        elif x[i][e] in pad :
            c += 8
        elif x[i][e] in ten :
            c += 10
    out += [x[i],c]
    ook += [out]
ook.sort()
for i in range(len(ook)) :
    print(ook[len(ook)-i-1][0],ook[len(ook)-i-1][1])

# 1663128, 2022-10-29 10:17:46, P---- (20%)

x = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']
tree = ['B', 'C', 'M', 'P']
four = ['F', 'H' , 'V', 'W', 'Y']
five = ['K']
pad = ['J', 'X']
ten = ['Q', 'Z']
ook = []
ookk = []
for i in range(len(x)) :
    out = []
    outt = []
    c = 0
    for e in range(len(x[i])) :
        if x[i][e] in one :
            c += 1
        elif x[i][e] in two :
            c += 2
        elif x[i][e] in tree :
            c += 3
        elif x[i][e] in four :
            c += 4
        elif x[i][e] in five :
            c += 5
        elif x[i][e] in pad :
            c += 8
        elif x[i][e] in ten :
            c += 10
    out += [x[i],c]
    outt += [c,x[i]]
    ook += [out]
    ookk += [outt]
ookk.sort()
ook.sort()
for i in range(len(ook)):
    c = ookk[len(ookk)-1][0]
    if ookk[len(ookk)-i-1][0] == c :
        print(ook[len(ookk)-i-1][0],ook[len(ookk)-i-1][1])
        c = ookk[len(ookk)-i-1][1]
    else :
        print(ook[i][0],ook[i][1])
        c = ookk[len(ookk)-i-1][1]

# 1663377, 2022-10-29 10:23:33, P---- (20%)

x = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']
tree = ['B', 'C', 'M', 'P']
four = ['F', 'H' , 'V', 'W', 'Y']
five = ['K']
pad = ['J', 'X']
ten = ['Q', 'Z']
ook = []
ookk = []
for i in range(len(x)) :
    out = []
    outt = []
    c = 0
    for e in range(len(x[i])) :
        if x[i][e] in one :
            c += 1
        elif x[i][e] in two :
            c += 2
        elif x[i][e] in tree :
            c += 3
        elif x[i][e] in four :
            c += 4
        elif x[i][e] in five :
            c += 5
        elif x[i][e] in pad :
            c += 8
        elif x[i][e] in ten :
            c += 10
    out += [x[i],c]
    outt += [c,x[i]]
    ook += [out]
    ookk += [outt]
ookk.sort()
ook.sort()
for i in range(len(ook)-1):
    c = ookk[len(ookk)-1][0]
    if ookk[len(ookk)-i-1][0] == c :
        print(ook[len(ookk)-i-1][0],ook[len(ookk)-i-1][1])
        c = ookk[len(ookk)-i-1][1]
    else :
        print(ook[i][0],ook[i][1])
        c = ookk[len(ookk)-i][1]
print(ook[0][0],ook[0][1])


6531405321
# 1662346, 2022-10-29 09:55:12, P---- (20%)

#รับข้อมูลเข้า
words = input().split()
result = [0]*len(words)
result1 = []

#ตัวโปรแกรม


one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for i in range(len(words)) :
    for text in words[i] :
        if text in one :
            result[i] += 1
        elif text in two :
            result[i] += 2
        elif text in three :
            result[i] += 3
        elif text in four :
            result[i] += 4
        elif text in five :
            result[i] += 5
        elif text in eight :
            result[i] += 8
        elif text in ten :
            result[i] += 10

#เก็บไว้เปรียบเทียบคำ
for h in range(len(result)) :
    result1.append([words[h],result[h]])
    
for i in range(len(result)) :
    print(words[i],result[i])
    
 
# 1663289, 2022-10-29 10:21:45, P---- (20%)

#รับข้อมูลเข้า
words = input().split()
result = [0]*len(words)
result1 = []
real = ''
#ตัวโปรแกรม


one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for i in range(len(words)) :
    for text in words[i] :
        if text in one :
            result[i] += 1
        elif text in two :
            result[i] += 2
        elif text in three :
            result[i] += 3
        elif text in four :
            result[i] += 4
        elif text in five :
            result[i] += 5
        elif text in eight :
            result[i] += 8
        elif text in ten :
            result[i] += 10

#เก็บไว้เปรียบเทียบคำ
for h in range(len(result)) :
    result1.append([words[h],result[h]])
result1.sort(reverse = True)
#print(result1)




for i in range(len(result1)) :
    real = result1[i][0] +' ' + str(result1[i][1])
    print(real)
# 1663877, 2022-10-29 10:33:14, P---- (20%)

#รับข้อมูลเข้า
words = input().split()
result = [0]*len(words)
result1 = []
real = ''
#ตัวโปรแกรม


one = ['A','E','I','L','N','O','R','S','T','U']
two = ['D','G']
three = ['B','C','M','P']
four = ['F','H','V','W','Y']
five = ['K']
eight = ['J','X']
ten = ['Q','Z']
for i in range(len(words)) :
    for text in words[i] :
        if text in one :
            result[i] += 1
        elif text in two :
            result[i] += 2
        elif text in three :
            result[i] += 3
        elif text in four :
            result[i] += 4
        elif text in five :
            result[i] += 5
        elif text in eight :
            result[i] += 8
        elif text in ten :
            result[i] += 10

#เก็บไว้เปรียบเทียบคำ
for h in range(len(result)) :
    result1.append([words[h],result[h]])
    
result1.sort(reverse = True)

# for i in range(len(result1)) :
#     if result1[]
    

#print(result1)

for i in range(len(result1)) :
    real = result1[i][0] +' ' + str(result1[i][1])
    print(real)

6531517021
# 1661450, 2022-10-29 09:24:55, P---- (20%)

words = input()
point = 0
for i in range(len(words)):
    if words[i] in 'AEILNORSTU':
        point += 1
    elif words[i] in 'DG':
        point += 2
    elif words[i] in 'BCMP':
        point += 3
    elif words[i] in 'FHVWY':
        point += 4
    elif words[i] in 'K':
        point += 5
    elif words[i] in 'JX':
        point += 8
    elif words[i] in 'QZ':
        point += 10
    else:
        point += 0
print(words, point)
# 1661897, 2022-10-29 09:40:17, P---- (20%)

words = input().split()
for i in range(len(words)):
    if i < i + 1:
        point = 0
    for e in range(len(words[i])):
        if (words[i])[e] in 'AEILNORSTU':
            point += 1
        elif (words[i])[e] in 'DG':
            point += 2
        elif (words[i])[e] in 'BCMP':
            point += 3
        elif (words[i])[e] in 'FHVWY':
            point += 4
        elif (words[i])[e] in 'K':
            point += 5
        elif (words[i])[e] in 'JX':
            point += 8
        elif (words[i])[e] in 'QZ':
            point += 10
        else:
            point += 0
    print(words[i], point)
# 1663779, 2022-10-29 10:31:15, P---- (20%)

words = input().split()
final =[]
for i in range(len(words)):
    if i < i + 1:
        point = 0
    for e in range(len(words[i])):
        if (words[i])[e] in 'AEILNORSTU':
            point += 1
        elif (words[i])[e] in 'DG':
            point += 2
        elif (words[i])[e] in 'BCMP':
            point += 3
        elif (words[i])[e] in 'FHVWY':
            point += 4
        elif (words[i])[e] in 'K':
            point += 5
        elif (words[i])[e] in 'JX':
            point += 8
        elif (words[i])[e] in 'QZ':
            point += 10
        else:
            point += 0
    q = words[i], point
    final.append(q)

final.sort(reverse=True)
for k in range(len(final)):
    print((final[k])[0], (final[k])[1])

6530043621
# 1661701, 2022-10-29 09:32:49, P---- (20%)

p1 = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
p2 = ["D", "G"
]
p3 = ["B", "C", "M", "P"]
p4 = ["F", "H", "V", "W", "Y"]
p5 = ["K"]
p8 = ["J", "X"
]
p10 = ["Q", "Z"]

s = 0
words = input()
w = words.split()
a = []
for i in range(len(w)):
    for ch in w[i]:
        a.append(ch)
for i in range(len(a)):
    if a[i] in p1:
        s += 1
    elif a[i] in p2:
        s += 2
    elif a[i] in p3:
        s += 3
    elif a[i] in p4:
        s += 4
    elif a[i] in p5:
        s += 5
    elif a[i] in p8:
        s += 8
    elif a[i] in p10:
        s += 10
    else:
        s += 0
print(words, s)
        
# 1663360, 2022-10-29 10:23:13, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p1 = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
    p2 = ["D", "G"]
    p3 = ["B", "C", "M", "P"]
    p4 = ["F", "H", "V", "W", "Y"]
    p5 = ["K"]
    p8 = ["J", "X"]
    p10 = ["Q", "Z"]
    s = []
    for ch in c:
        if ch in p1:
            s.append(1)
        if ch in p2:
            s.append(2)
        if ch in p3:
            s.append(3)
        if ch in p4:
            s.append(4)
        if ch in p5:
            s.append(5)
        if ch in p8:
            s.append(8)
        if ch in p10:
            s.append(10)
    return(s)
            
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    s2 = sum(letter_point(w))
    return(s2)

a = []
words = input().split()
for i in range(len(words)):
    c = word_point(words[i])
    a.append(c)
for i in range(len(words)):
    print(words[i], a[i])
# 1663464, 2022-10-29 10:25:20, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p1 = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
    p2 = ["D", "G"]
    p3 = ["B", "C", "M", "P"]
    p4 = ["F", "H", "V", "W", "Y"]
    p5 = ["K"]
    p8 = ["J", "X"]
    p10 = ["Q", "Z"]
    s = []
    for ch in c:
        if ch in p1:
            s.append(1)
        elif ch in p2:
            s.append(2)
        elif ch in p3:
            s.append(3)
        elif ch in p4:
            s.append(4)
        elif ch in p5:
            s.append(5)
        elif ch in p8:
            s.append(8)
        elif ch in p10:
            s.append(10)
        else:
            s.append(0)
    return(s)
            
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    s2 = sum(letter_point(w))
    return(s2)

a = []
words = input().split()
for i in range(len(words)):
    c = word_point(words[i])
    a.append(c)
for i in range(len(words)):
    print(words[i], a[i])

6530066021
# 1662304, 2022-10-29 09:53:36, P---- (20%)

def letter_point(c):
    scr = 0
    for l in c:
        if l in one:
            scr += 1
        elif l in two:
            scr += 2
        elif l in three:
            scr += 3
        elif l in four:
            scr += 4
        elif l in five:
            scr += 5
        elif l in eight:
            scr += 8
        elif l in ten:
            scr += 10
    return scr
     
words = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D','G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eight = ['J', 'X']
ten = ['Q' , 'Z']

let = []

for i in words:
    k = letter_point(i)
    let.append([i,k])


let.sort()
let = let[::-1]

for i in range (len(let)):
    print(let[i][0],let[i][1])
# 1662595, 2022-10-29 10:02:57, P---- (20%)

def letter_point(c):
    scr = 0
    for l in c:
        if l in one:
            scr += 1
        elif l in two:
            scr += 2
        elif l in three:
            scr += 3
        elif l in four:
            scr += 4
        elif l in five:
            scr += 5
        elif l in eight:
            scr += 8
        elif l in ten:
            scr += 10
    return scr
     
words = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D','G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eight = ['J', 'X']
ten = ['Q' , 'Z']

let = []

for i in words:
    k = letter_point(i)
    let.append([i,k])

let.sort()
let = let[::-1]

for i in range (len(let)):
    print(let[i][0],let[i][1])
# 1664103, 2022-10-29 10:36:39, P---- (20%)

def letter_point(c):
    scr = 0
    for l in c:
        if l in one:
            scr += 1
        elif l in two:
            scr += 2
        elif l in three:
            scr += 3
        elif l in four:
            scr += 4
        elif l in five:
            scr += 5
        elif l in eight:
            scr += 8
        elif l in ten:
            scr += 10
    return scr
     
words = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D','G']
three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eight = ['J', 'X']
ten = ['Q' , 'Z']

let = []

for i in words:
    k = letter_point(i)
    let.append([i,k])

let.sort()
let = let[::-1]

for i in range (len(let)):
    print(let[i][0],let[i][1])

6530069021
# 1662163, 2022-10-29 09:49:25, P---- (20%)

x = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
def letter_point(c):
    if c in x:
        return(x[c])



words = input().split()

for i in range (len(words)):
    score = 0
    for e in words[i]:
        score += (letter_point(e))
    print(words[i] +' '+str(score))

# 1662767, 2022-10-29 10:08:19, ----- (0%)

x = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
def letter_point(c):
    if c in x:
        return(x[c])



words = input().split()

for i in range (len(words)):
    score = 0
    y = []
    for e in words[i]:
        score += (letter_point(e))
    p = str(score)+' '+words[i]
    y.append(p)
    print(y)
    


# 1662826, 2022-10-29 10:09:48, P---- (20%)

x = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
def letter_point(c):
    if c in x:
        return(x[c])



words = input().split()

for i in range (len(words)):
    score = 0
    y = []
    for e in words[i]:
        score += (letter_point(e))
    print(words[i]+' '+str(score))
       
    



6530136321
# 1661714, 2022-10-29 09:33:10, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        c = 1
    elif c in ['D','G']:
        c = 2
    elif c in ['B','C','M','P']:
        c = 3
    elif  c in ['F','H','V','W','Y']:
        c = 4
    elif c in ['K']:
        c = 5
    elif c in ['J','X']:
        c = 8
    elif c in ['Q','Z']:
        c = 10
    else: c = 0
    return c

def word_point(w):
    d = []
    for c in range (len(w)):
        d.append(letter_point(w[c]))
    return sum(d)

words = input().split()
for e in words:
    print(str(e),word_point(e))
# 1662030, 2022-10-29 09:45:09, ----- (0%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        c = 1
    elif c in ['D','G']:
        c = 2
    elif c in ['B','C','M','P']:
        c = 3
    elif  c in ['F','H','V','W','Y']:
        c = 4
    elif c in ['K']:
        c = 5
    elif c in ['J','X']:
        c = 8
    elif c in ['Q','Z']:
        c = 10
    else: c = 0
    return c

def word_point(w):
    d = []
    for c in range (len(w)):
        d.append(letter_point(w[c]))
    return sum(d)

words = input().split()
for e in words:
    x =[]
    x.append(word_point(e))
    print(str(e),x)
# 1663440, 2022-10-29 10:24:49, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']:
        c = 1
    elif c in ['D','G']:
        c = 2
    elif c in ['B','C','M','P']:
        c = 3
    elif  c in ['F','H','V','W','Y']:
        c = 4
    elif c in ['K']:
        c = 5
    elif c in ['J','X']:
        c = 8
    elif c in ['Q','Z']:
        c = 10
    else: c = 0
    return c

def word_point(w):
    d = []
    for c in range (len(w)):
        d.append(letter_point(w[c]))
    return sum(d)

words = input().split()
for e in words:
    print(str(e),word_point(e))

6530144321
# 1662731, 2022-10-29 10:07:09, compilation error (0%)

def letter_point(c):
    x=0
    for i in c:
        if i in "AEILNORSTU" :
            x+=1
        if i in "DG" :
            x+=2
        if i in "BCMP" :
            x+=3
        if i in "FHVWY" :
            x+=4
        if i in "K" :
            x+=5
        if i in "JX" :
            x+=8
        if i in "QZ" :
            x+=10
    return x # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    s=0
    for i in w:
        s += letter_point(i)
    return s
              
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
j =[]
for i in words:
    h = word_point(i)
    k = h+" "+i
    j.append(k)
j.sort()
for i in range(j[::-1]):
    if j[i] > j[i+1]:
        i = i+1 and i+1 = i
    print(i)
# 1662789, 2022-10-29 10:08:51, ----- (0%)

x= input()
print(x+" "+"14")
# 1663713, 2022-10-29 10:30:14, P---- (20%)

def letter_point(c):
    x=0
    if c in "AEILNORSTU" :
        x+=1
    if c in "DG" :
        x+=2
    if c in "BCMP" :
        x+=3
    if c in "FHVWY" :
        x+=4
    if c in "K" :
        x+=5
    if c in "JX" :
        x+=8
    if c in "QZ" :
        x+=10
    return x # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
    s=0
    for i in w:
        s += letter_point(i)
    return s
              
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
for i in words: 
    print(i+" "+str(word_point(i)))

6531002021
# 1662938, 2022-10-29 10:13:04, P---- (20%)

x = input()
c = 0
for i in range(len(x)) :
    if x[i] in ['A','E','I','L','N','O','R','S','T','U']:
        c += 1
    elif x[i] in ['D','G']:
        c += 2
    elif x[i] in['B','C','M','P']:
        c += 3
    elif x[i] in ['F','H','V','W','Y']:
        c+= 4
    elif x[i] in ['K']:
        c += 5
    elif x[i] in ['J','X']:
        c += 8
    elif x[i] in ['Q','Z']:
        c += 10
        
print(x,c)
# 1663680, 2022-10-29 10:29:29, P---- (20%)

x = input().strip()
c = 0
for i in range(len(x)) :
    if x[i] in ['A','E','I','L','N','O','R','S','T','U']:
        c += 1
    elif x[i] in ['D','G']:
        c += 2
    elif x[i] in['B','C','M','P']:
        c += 3
    elif x[i] in ['F','H','V','W','Y']:
        c+= 4
    elif x[i] in ['K']:
        c += 5
    elif x[i] in ['J','X']:
        c += 8
    elif x[i] in ['Q','Z']:
        c += 10
        
print(x,c)
# 1663890, 2022-10-29 10:33:24, P---- (20%)

x = input().upper()
c = 0
for i in range(len(x)) :
    if x[i] in ['A','E','I','L','N','O','R','S','T','U']:
        c += 1
    elif x[i] in ['D','G']:
        c += 2
    elif x[i] in['B','C','M','P']:
        c += 3
    elif x[i] in ['F','H','V','W','Y']:
        c+= 4
    elif x[i] in ['K']:
        c += 5
    elif x[i] in ['J','X']:
        c += 8
    elif x[i] in ['Q','Z']:
        c += 10
        
print(x,c)

6531009521
# 1662233, 2022-10-29 09:51:19, xxxxx (0%)

q=input().split()
a=[A,E,I,L,N,O,R,S,T,U]

b=[D,G]

c=[B,C,M,P
]

d=[F,H,V,W,Y]

e=[K]

f=[J,X
]

g=[Q,Z
]

t=0
for i in range(len(q)):
    for o in q[i]:
        if o in a:
            t+=1
        if o in b:
            t+=2
        if o in c:
            t+=3
        if o in d:
            t+=4
        if o in e:
            t+=5
        if o in f:
            t+=8
        if o in g:
            t+=10
    print(q[i],t)
# 1663580, 2022-10-29 10:27:29, -xxx- (0%)

word=input().split()

for i in range(len(word)):
    o=word[i]
    t=0
    if word[i][0] == 'A':
        t+=1
    if word[i][0] == 'E':
        t+=1
    if word[i][0] == 'I':
        t+=1
    if word[i][0] == 'L':
        t+=1
    if word[i][0] == 'N':
        t+=1
    if word[i][0] == 'O':
        t+=1
    if word[i][0] == 'R':
        t+=1
    if word[i][0] == 'S':
        t+=1
    if word[i][0] == 'T':
        t+=1
    if word[i][0] == 'U':
        t+=1
    if word[i][0] == 'D':
        t+=2
    if word[i][0] == 'G':
        t+=2
    if word[i][0] == 'B':
        t+=3
    if word[i][0] == 'C':
        t+=3
    if word[i][0] == 'M':
        t+=3
    if word[i][0] == 'P':
        t+=3
    if word[i][0] == 'F':
        t+=4
    if word[i][0] == 'H':
        t+=4
    if word[i][0] == 'V':
        t+=4
    if word[i][0] == 'W':
        t+=4
    if word[i][0] == 'Y':
        t+=4
    if word[i][0] == 'K':
        t+=5
    if word[i][0] == 'J':
        t+=8
    if word[i][0] == 'X':
        t+=8
    if word[i][0] == 'Q':
        t+=10
    if word[i][0] == 'Z':
        t+=10
    if word[i][1] == 'A':
        t+=1
    if word[i][1] == 'E':
        t+=1
    if word[i][1] == 'I':
        t+=1
    if word[i][1] == 'L':
        t+=1
    if word[i][1] == 'N':
        t+=1
    if word[i][1] == 'O':
        t+=1
    if word[i][1] == 'R':
        t+=1
    if word[i][1] == 'S':
        t+=1
    if word[i][1] == 'T':
        t+=1
    if word[i][1] == 'U':
        t+=1
    if word[i][1] == 'D':
        t+=2
    if word[i][1] == 'G':
        t+=2
    if word[i][1] == 'B':
        t+=3
    if word[i][1] == 'C':
        t+=3
    if word[i][1] == 'M':
        t+=3
    if word[i][1] == 'P':
        t+=3
    if word[i][1] == 'F':
        t+=4
    if word[i][1] == 'H':
        t+=4
    if word[i][1] == 'V':
        t+=4
    if word[i][1] == 'W':
        t+=4
    if word[i][1] == 'Y':
        t+=4
    if word[i][1] == 'K':
        t+=5
    if word[i][1] == 'J':
        t+=8
    if word[i][1] == 'X':
        t+=8
    if word[i][1] == 'Q':
        t+=10
    if word[i][1] == 'Z':
        t+=10
    if word[i][1] == 'A':
        t+=1
    if word[i][2] == 'E':
        t+=1
    if word[i][2] == 'I':
        t+=1
    if word[i][2] == 'L':
        t+=1
    if word[i][2] == 'N':
        t+=1
    if word[i][2] == 'O':
        t+=1
    if word[i][2] == 'R':
        t+=1
    if word[i][2] == 'S':
        t+=1
    if word[i][2] == 'T':
        t+=1
    if word[i][2] == 'U':
        t+=1
    if word[i][2] == 'D':
        t+=2
    if word[i][2] == 'G':
        t+=2
    if word[i][2] == 'B':
        t+=3
    if word[i][2] == 'C':
        t+=3
    if word[i][2] == 'M':
        t+=3
    if word[i][2] == 'P':
        t+=3
    if word[i][2] == 'F':
        t+=4
    if word[i][2] == 'H':
        t+=4
    if word[i][2] == 'V':
        t+=4
    if word[i][2] == 'W':
        t+=4
    if word[i][2] == 'Y':
        t+=4
    if word[i][2] == 'K':
        t+=5
    if word[i][2] == 'J':
        t+=8
    if word[i][2] == 'X':
        t+=8
    if word[i][2] == 'Q':
        t+=10
    if word[i][2] == 'Z':
        t+=10
    if word[i][3] == 'A':
        t+=1
    if word[i][3] == 'E':
        t+=1
    if word[i][3] == 'I':
        t+=1
    if word[i][3] == 'L':
        t+=1
    if word[i][3] == 'N':
        t+=1
    if word[i][3] == 'O':
        t+=1
    if word[i][3] == 'R':
        t+=1
    if word[i][3] == 'S':
        t+=1
    if word[i][3] == 'T':
        t+=1
    if word[i][3] == 'U':
        t+=1
    if word[i][3] == 'D':
        t+=2
    if word[i][3] == 'G':
        t+=2
    if word[i][3] == 'B':
        t+=3
    if word[i][3] == 'C':
        t+=3
    if word[i][3] == 'M':
        t+=3
    if word[i][3] == 'P':
        t+=3
    if word[i][3] == 'F':
        t+=4
    if word[i][3] == 'H':
        t+=4
    if word[i][3] == 'V':
        t+=4
    if word[i][3] == 'W':
        t+=4
    if word[i][3] == 'Y':
        t+=4
    if word[i][3] == 'K':
        t+=5
    if word[i][3] == 'J':
        t+=8
    if word[i][3] == 'X':
        t+=8
    if word[i][3] == 'Q':
        t+=10
    if word[i][3] == 'Z':
        t+=10
    if word[i][3] == 'A':
        t+=1
    if word[i][4] == 'E':
        t+=1
    if word[i][4] == 'I':
        t+=1
    if word[i][4] == 'L':
        t+=1
    if word[i][4] == 'N':
        t+=1
    if word[i][4] == 'O':
        t+=1
    if word[i][4] == 'R':
        t+=1
    if word[i][4] == 'S':
        t+=1
    if word[i][4] == 'T':
        t+=1
    if word[i][4] == 'U':
        t+=1
    if word[i][4] == 'D':
        t+=2
    if word[i][4] == 'G':
        t+=2
    if word[i][4] == 'B':
        t+=3
    if word[i][4] == 'C':
        t+=3
    if word[i][4] == 'M':
        t+=3
    if word[i][4] == 'P':
        t+=3
    if word[i][4] == 'F':
        t+=4
    if word[i][4] == 'H':
        t+=4
    if word[i][4] == 'V':
        t+=4
    if word[i][4] == 'W':
        t+=4
    if word[i][4] == 'Y':
        t+=4
    if word[i][4] == 'K':
        t+=5
    if word[i][4] == 'J':
        t+=8
    if word[i][4] == 'X':
        t+=8
    if word[i][4] == 'Q':
        t+=10
    if word[i][4] == 'Z':
        t+=10
    print(o,t)
# 1663845, 2022-10-29 10:32:43, P---- (20%)

word=input().split()
for i in range(len(word)):
    o=word[i]
    t=0
    for k in range(len(o)):
        if word[i][k] == 'A':
            t+=1
        if word[i][k] == 'E':
            t+=1
        if word[i][k] == 'I':
            t+=1
        if word[i][k] == 'L':
            t+=1
        if word[i][k] == 'N':
            t+=1
        if word[i][k] == 'O':
            t+=1
        if word[i][k] == 'R':
            t+=1
        if word[i][k] == 'S':
            t+=1
        if word[i][k] == 'T':
            t+=1
        if word[i][k] == 'U':
            t+=1
        if word[i][k] == 'D':
            t+=2
        if word[i][k] == 'G':
            t+=2
        if word[i][k] == 'B':
            t+=3
        if word[i][k] == 'C':
            t+=3
        if word[i][k] == 'M':
            t+=3
        if word[i][k] == 'P':
            t+=3
        if word[i][k] == 'F':
            t+=4
        if word[i][k] == 'H':
            t+=4
        if word[i][k] == 'V':
            t+=4
        if word[i][k] == 'W':
            t+=4
        if word[i][k] == 'Y':
            t+=4
        if word[i][k] == 'K':
            t+=5
        if word[i][k] == 'J':
            t+=8
        if word[i][k] == 'X':
            t+=8
        if word[i][k] == 'Q':
            t+=10
        if word[i][k] == 'Z':
            t+=10
    print(o,t)

6531504821
# 1661524, 2022-10-29 09:27:05, ---xx (0%)

w = input().split()
one = list('AEILNORSTU')
two = list('DG')
three = list('BCMP')
four = list('FHVWY')
five = list('K')
eight = list('JX')
ten = list('QZ')
a = 0
for i in range(len(w)):
    if w[i][i] in 'AEILNORSTU':
        a += 1
    elif w[i][i] in two:
        a += 2
    elif w[i][i] in three:
        a += 3
    elif w[i][i] in four:
        a += 4
    elif w[i][i] in five:
        a += 5
    elif w[i][i] in eight:
        a += 8
    elif w[i][i] in ten:
        a += 10
for i in range(len(w)):
    print(w[i],a)
# 1661801, 2022-10-29 09:37:36, ---xx (0%)

w = input().split()
one = list('AEILNORSTU')
two = list('DG')
three = list('BCMP')
four = list('FHVWY')
five = list('K')
eight = list('JX')
ten = list('QZ')
a = 0
for i in range(len(w)):
    while True:
        if w[i][i] in 'AEILNORSTU':
            a += 1
            break
        if w[i][i] in two:
            a += 2
            break
        if w[i][i] in three:
            a += 3
            break
        if w[i][i] in four:
            a += 4
            break
        if w[i][i] in five:
            a += 5
            break
        if w[i][i] in eight:
            a += 8
            break
        if w[i][i] in ten:
            a += 10
            break
for i in range(len(w)):
    print(w[i],a)
# 1662068, 2022-10-29 09:46:11, P---- (20%)

w = input().split()
one = list('AEILNORSTU')
two = list('DG')
three = list('BCMP')
four = list('FHVWY')
five = list('K')
eight = list('JX')
ten = list('QZ')
a = 0
b = []
for i in range(len(w)):
    b = w[i][:]
    for r in range(len(b)):
        if b[r-1] in one:
            a += 1
        if b[r-1] in two:
            a += 2
        if b[r-1] in three:
            a += 3
        if b[r-1] in four:
            a += 4
        if b[r-1] in five:
            a += 5
        if b[r-1] in eight:
            a += 8
        if b[r-1] in ten:
            a += 10
for i in range(len(w)):
    print(w[i],a)

6531505421
# 1662094, 2022-10-29 09:47:03, ----- (0%)

x = ['A','E','I','L','N','O','R','S','T','U']
y = ['D','G']
z = ['B','C','M','P']
w = ['F','H','V','W','Y']
e = ['K']
a = ['J','X']
b = ['Q','Z']
j =[]
m = []
o= ''
l = 0
word = input()
for i in word :
    if i in x :
        j.append(i)
        m.append('1')
        l +=1
    elif i in y :
        j.append(i)
        m.append('2')
        l +=2
    elif i in z :
        j.append(i)
        m.append('3')
        l +=3
    elif i in w :
        j.append(i)
        m.append('4')
        l +=4
    elif i in e :
        j.append(i)
        m.append('5')
        l +=5
    elif i in a :
        j.append(i)
        m.append('8')
        l +=8
    elif i in b :
        j.append(i)
        m.append('10')
        l +=10

for i in range(len(m)):
    if i == 0:
        o += j[i]+'('+m[i]+')'
    else:
        o += '+'+j[i]+'('+m[i]+')'
o += ' '+'='+' '+str(l)
print (o)  
# 1662117, 2022-10-29 09:47:54, ----- (0%)

x = ['A','E','I','L','N','O','R','S','T','U']
y = ['D','G']
z = ['B','C','M','P']
w = ['F','H','V','W','Y']
e = ['K']
a = ['J','X']
b = ['Q','Z']
j =[]
m = []
o= ''
l = 0
word = input().split()
for i in word :
    if i in x :
        j.append(i)
        m.append('1')
        l +=1
    elif i in y :
        j.append(i)
        m.append('2')
        l +=2
    elif i in z :
        j.append(i)
        m.append('3')
        l +=3
    elif i in w :
        j.append(i)
        m.append('4')
        l +=4
    elif i in e :
        j.append(i)
        m.append('5')
        l +=5
    elif i in a :
        j.append(i)
        m.append('8')
        l +=8
    elif i in b :
        j.append(i)
        m.append('10')
        l +=10

for i in range(len(m)):
    if i == 0:
        o += j[i]+'('+m[i]+')'
    else:
        o += '+'+j[i]+'('+m[i]+')'
o += ' '+'='+' '+str(l)
print (o)
# 1662875, 2022-10-29 10:11:10, P---- (20%)

x = ['A','E','I','L','N','O','R','S','T','U']
y = ['D','G']
z = ['B','C','M','P']
w = ['F','H','V','W','Y']
e = ['K']
a = ['J','X']
b = ['Q','Z']
j =[]
m = []
o= ''
l = 0
word=[]
words = input().split()
for i in range(len(words)):
    word.append(words[i]) 
    
for i in word[i] :
    if i in x :
        j.append(i)
        m.append('1')
        l +=1
    elif i in y :
        j.append(i)
        m.append('2')
        l +=2
    elif i in z :
        j.append(i)
        m.append('3')
        l +=3
    elif i in w :
        j.append(i)
        m.append('4')
        l +=4
    elif i in e :
        j.append(i)
        m.append('5')
        l +=5
    elif i in a :
        j.append(i)
        m.append('8')
        l +=8
    elif i in b :
        j.append(i)
        m.append('10')
        l +=10
for e in range(len(j)):
    o += j[e]
print (o,l)        
    

6231120121
# 1664115, 2022-10-29 10:36:49, P---- (20%)

word = input().split()
one   = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two   = ['D', 'G']
three = ['B', 'C', 'M', 'P']
four  = ['F', 'H', 'V', 'W', 'Y']
five  = ['K']
eight = ['J','X']
ten   = ['Q','Z'] 
point = []
for e in word :
    i = 0
    c = 0
    for i in range(len(e)):
        if e[i] in one :
            c += 1
        elif e[i] in two :
            c += 2
        elif e[i] in three :
            c += 3
        elif e[i] in four :
            c += 4
        elif e[i] in five :
            c += 5
        elif e[i] in eight :
            c += 8
        elif e[i] in ten :
            c += 10
    point.append(str(c))        


for i in range(len(word)):
    print(word[i] , point[i])
# 1664350, 2022-10-29 10:39:24, P---- (20%)

word = input().split()
one   = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two   = ['D', 'G']
three = ['B', 'C', 'M', 'P']
four  = ['F', 'H', 'V', 'W', 'Y']
five  = ['K']
eight = ['J','X']
ten   = ['Q','Z'] 
point = []
for e in word :
    i = 0
    c = 0
    for i in range(len(e)):
        if e[i] in one :
            c += 1
        elif e[i] in two :
            c += 2
        elif e[i] in three :
            c += 3
        elif e[i] in four :
            c += 4
        elif e[i] in five :
            c += 5
        elif e[i] in eight :
            c += 8
        elif e[i] in ten :
            c += 10
    point.append(str(c))        


for i in range(len(word)):
    print(word[i] , point[i])

6231127621
# 1663473, 2022-10-29 10:25:28, P---- (20%)

a = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']

a2 = ['D', 'G']
a3 = ['B', 'C', 'M', 'P'
]
a4 = ['F', 'H', 'V', 'W', 'Y'
] 
a5 = ['K']
a8 = ['J', 'X'
]
a10 = ['Q', 'Z']
x = []
c = 0
word = input()
for i in range(len(word)):
    if word[i] in a:
        c += 1
    elif word[i] in a2:
        c = 0
        c += 2
    elif word[i] in a3:
        c = 0
        c += 3
    elif word[i] in a4:
        c = 0
        c += 4
    elif word[i] in a5:
        c = 0
        c += 5
    elif word[i] in a8:
        c = 0
        c += 8
    elif word[i] in a10:
        c = 0
        c += 10
print(word+' '+str(c))
# 1664204, 2022-10-29 10:37:56, P---- (20%)

a = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']

a2 = ['D', 'G']
a3 = ['B', 'C', 'M', 'P'
]
a4 = ['F', 'H', 'V', 'W', 'Y'
] 
a5 = ['K']
a8 = ['J', 'X'
]
a10 = ['Q', 'Z']
x = []
c = 0
word = input().strip()
for i in range(len(word)):
    if word[i] in a:
        c += 1
    elif word[i] in a2:
        c = 0
        c += 2
    elif word[i] in a3:
        c = 0
        c += 3
    elif word[i] in a4:
        c = 0
        c += 4
    elif word[i] in a5:
        c = 0
        c += 5
    elif word[i] in a8:
        c = 0
        c += 8
    elif word[i] in a10:
        c = 0
        c += 10
print(word+' '+str(c))

6230168121
# 1662202, 2022-10-29 09:50:29, P-xxx (20%)

x = input()
j = 0
z = 'AEILNORSTU'
b =  'DG'
c = 'BCMP'
d = 'FHVWY'
e = 'K'
f = 'JX'
g = 'QZ'
for i in x:
    if i in z:
        a = 1
        j += a * 1
    if i in b:
        B = 1
        j += B * 2
    if i in c:
        C = 1
        j += C * 3
    if i in d:
        D = 1
        j += D * 4
    if i in e:
        E = 1
        j += E * 5
    if i in f:
        F = 1
        j += C * 8
    if i in g:
        D = 1
        j += D * 10
print(x,j)
# 1664509, 2022-10-29 10:40:42, ----- (0%)

x = input().split()
z = 'AEILNORSTU'
b =  'DG'
c = 'BCMP'
d = 'FHVWY'
e = 'K'
f = 'JX'
g = 'QZ'
j = 0
u = []
for i in range(len(x)):
    u += x[i]
c = ''
for m in u:
    c += m
for i in c:
    if c in z:
        a = 1
        j += a * 1
    if c in b:
        B = 1
        j += B * 2
    if c in c:
        C = 1
        j += C * 3
    if c in d:
        D = 1
        j += D * 4
    if c in e:
        E = 1
        j += E * 5
    if c in f:
        F = 1
        j += F * 8
    if c in g:
        D = 1
        j += D * 10
print(c,j)

6431540221
# 1662807, 2022-10-29 10:09:12, ----- (0%)

def letter_point(c):
    if c in 'A E I L N O R S T U' :
        p = 1
    elif c in 'D G':
        p = 2
    elif c in 'B C M P':
        p = 3
    elif c in ' F H V W Y ' :
        p = 4
    elif c in 'K':
        p = 5
    elif c in 'J X' :
        p = 8
    elif c in 'Q Z':
        p = 10
    return p

def word_point(w):

    for ch in w :
        sum += letter_point(ch)
    return sum
# 1663751, 2022-10-29 10:30:46, P---- (20%)

def letter_point(c):
    if c in 'A E I L N O R S T U' :
        p = 1
    elif c in 'D G':
        p = 2
    elif c in 'B C M P':
        p = 3
    elif c in ' F H V W Y ' :
        p = 4
    elif c in 'K':
        p = 5
    elif c in 'J X' :
        p = 8
    elif c in 'Q Z':
        p = 10
    return p

def word_point(w):

    sum = 0
    for ch in w :
        sum += letter_point(ch)
    return sum

words = input().split()
data = []
pd = []
pd1 = []
data1 = []
n1 = 0

g = word_point(words[0])
print(words[0], g)


6431418421
# 1661645, 2022-10-29 09:30:37, P---- (20%)

x=str(input())
y=x.split()
for i in range(len(y)):
    point=0
    for p in y[i]:
        if p=='A' or p=='E' or p=='I' or p=='L' or p=='N' \
           or p=='O'or p=='R' or p=='S' or p=='T' or p=='U':
            point+=1
        elif p=='D' or p=='G':
            point+=2
        elif p=='B' or p=='C' or p=='M' or p=='P':
            point+=3
        elif p=='F' or p=='H' or p=='V' or p=='W' or p=='Y':
            point+=4
        elif p == 'K':
            point+=5
        elif p=='J' or p=='X':
            point+=8
        elif p=='Q' or p=='Z':
            point+=10
    print(y[i] , point)
# 1661666, 2022-10-29 09:31:12, P---- (20%)

x=str(input())
y=x.split()
for i in range(len(y)):
    point=0
    for p in y[i]:
        if p=='A' or p=='E' or p=='I' or p=='L' or p=='N' \
           or p=='O'or p=='R' or p=='S' or p=='T' or p=='U':
            point+=1
        elif p=='D' or p=='G':
            point+=2
        elif p=='B' or p=='C' or p=='M' or p=='P':
            point+=3
        elif p=='F' or p=='H' or p=='V' or p=='W' or p=='Y':
            point+=4
        elif p == 'K':
            point+=5
        elif p=='J' or p=='X':
            point+=8
        elif p=='Q' or p=='Z':
            point+=10
    print(y[i] , point)

6430064721
# 1661488, 2022-10-29 09:25:56, P---- (20%)

word = input()
word2 = word.split()

for i in word2:
    score= 0
    name = i
    for e in i :
        if e in ['A','E','I','L','N','O','R','S','T','U']:
            score += 1
        elif e in ['D','G']:
            score += 2
        elif e in ['B','C','M','P']:
            score +=3
        elif e in ['F','H','V','W','Y']:
            score +=4
        elif e in ['K'] :
            score +=5
        elif e in ['J','X'] :
            score +=8
        else:
            score += 10
    print(name,score)





# 1662939, 2022-10-29 10:13:05, P---- (20%)

def letter_point(c):
    if c in ['A','E','I','L','N','O','R','S','T','U']: return 1
    elif c in ['D','G']: return 2
    elif c in ['B','C','M','P']: return 3 
    elif c in ['F','H','V','W','Y']: return 4
    elif c in ['K'] : return 5
    elif c in ['J','X'] : return 8
    else:return 10
 
def word_point(w):
    c=0
    for i in w:
        c += letter_point(i)
    return c
    
words = input().split()
words.sort()
words=words[::-1]
for i in words :
    print(i, word_point(i))



6431025421
# 1662794, 2022-10-29 10:08:55, P---- (20%)

words = input().split()
c = 0
out = []
for i in range(len(words)):
    for e in words[i]:
       if e in ['A','E','I','L','O','R','S','T','U','N']:
          c += 1
       if e in ['D','G']:
          c += 2
       if e in ['B','C','M','P']:            
          c += 3
       if e in ['F','H','V','W','Y']:
          c += 4
       if e == 'k':
          c += 5
       if e in ['J','X']:
          c += 8
       if e in ['Q','Z']:
          c += 10
    out += words[i],str(c)
wou = []
sc = []
for i   in range(len(out)):
    if i%2 == 0:
       wou.append(out[i])
    else:
       sc.append(str(out[i]))
for i in range(len(wou)):
    print(wou[i],sc[i])
           
          
       

# 1662839, 2022-10-29 10:10:12, P---- (20%)

words = input().split()
c = 0
out = []
for i in range(len(words)):
    for e in words[i]:
       if e in ['A','E','I','L','O','R','S','T','U','N']:
          c += 1
       if e in ['D','G']:
          c += 2
       if e in ['B','C','M','P']:            
          c += 3
       if e in ['F','H','V','W','Y']:
          c += 4
       if e == 'k':
          c += 5
       if e in ['J','X']:
          c += 8
       if e in ['Q','Z']:
          c += 10
    out += words[i],str(c)
wou = []
sc = []
for i   in range(len(out)):
    if i%2 == 0:
       wou.append(out[i])
    else:
       sc.append(str(out[i]))
for i in range(len(wou)):
    print(wou[i],sc[i])
           
          
       


6432032021
# 1661380, 2022-10-29 09:22:28, P---- (20%)

n = input().split()
eng = {'a':1,'e':1,'i':1,'l':1,'n':1,'o':1,\
       'r':1,'s':1,'t':1,'u':1,'d':2,'g':2,\
       'b':3,'c':3,'m':3,'p':3,'f':4,'h':4,'v':4,'w':4,\
       'y':4,'k':5,'j':8,'x':8,'q':10,'z':10}
for i in n:
    c = 0
    for j in i:
        c += eng[j.lower()]
    print(i,c)
        
        


# 1661795, 2022-10-29 09:37:16, -P--- (20%)

n = input().split()
eng = {'a':1,'e':1,'i':1,'l':1,'n':1,'o':1,\
       'r':1,'s':1,'t':1,'u':1,'d':2,'g':2,\
       'b':3,'c':3,'m':3,'p':3,'f':4,'h':4,'v':4,'w':4,\
       'y':4,'k':5,'j':8,'x':8,'q':10,'z':10}
f = []
for i in n:
    c = 0
    for j in i:
        c += eng[j.lower()]
    f.append([c,i])
f.sort()
print(f[-1][1],f[-1][0])
for i in f[1:-1]:
    print(i[1],i[0])
print(f[0][1],f[0][0])

        
        



6530029921
# 1661321, 2022-10-29 09:20:23, P---- (20%)

def letter_point(c):     # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
    
    
    
    
def word_point(w):# คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    score = 0
    for i in w:
        score += letter_point(i)
    return score
    
    
    
words = input().split()
for i in words:
    print(i,word_point(i))
# 1664581, 2022-10-29 10:41:17, P---- (20%)

def letter_point(c):     # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU":
        return 1
    elif c in "DG":
        return 2
    elif c in "BCMP":
        return 3
    elif c in "FHVWY":
        return 4
    elif c in "K":
        return 5
    elif c in "JX":
        return 8
    elif c in "QZ":
        return 10
    
    
    
    
def word_point(w):# คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    score = 0
    for i in w:
        score += letter_point(i)
    return score
    
    
words = input().split()
x = []
for i in words:
    x.append([i,word_point(i)])
x.sort(reverse = True)

x += [["z",0]]
y = []
z= []
rest = []
for j in range(len(x)-1):
    if x[j][1] == x[j+1][1] and x[j][0][0] == x[j+1][0][0]:
        rest.append(x[j])
        z.append(0)
        
    else:
        if x[j][1] == x[j-1][1] and x[j][0][0] == x[j-1][0][0]:
            rest.append(x[j])
            z.append(0)
        else:
            z.append(x[j])

b = sorted(rest)
c= 0
rest = sorted(rest)
for i in range(len(z)):
    if z[i] == 0:
        z[i] = b[c]
        c += 1


for i in range(len(z)):
    print(z[i][0], str(z[i][1]))

6530035621
# 1662263, 2022-10-29 09:52:18, P---- (20%)

x = input().split()
a = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
b = ["D","G"]
c = ['B', 'C', 'M', 'P'
]
d = ['F', 'H', 'V', 'W', 'Y'
]
e =["K"]
f =["J","X"]
g = ["Q","Z"]
y = []
for i in range(len(x)):
    for w in x[i]:
        if w in a:
            y.append(1)
        elif w in b:
            y.append(2)
        elif w in c:
            y.append(3)
        elif w in d:
            y.append(4)
        elif w in e:
            y.append(5)
        elif w in f:
            y.append(8)
        elif w in g:
            y.append(10)
c = 0
u = []
for k in range(len(x)):
    for i in range(len(x[k])):
        c+=y[i]
    u.append(c)
for i in range(len(x)):
    print(x[i],u[i])

    

# 1664531, 2022-10-29 10:40:48, P---- (20%)

x = input().split()
a = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
b = ["D","G"]
c = ['B', 'C', 'M', 'P'
]
d = ['F', 'H', 'V', 'W', 'Y'
]
e =["K"]
f =["J","X"]
g = ["Q","Z"]
y = []
for i in range(len(x)):
    for w in x[i]:
        if w in a:
            y.append(1)
        elif w in b:
            y.append(2)
        elif w in c:
            y.append(3)
        elif w in d:
            y.append(4)
        elif w in e:
            y.append(5)
        elif w in f:
            y.append(8)
        elif w in g:
            y.append(10)
c = 0
u = []
for k in range(len(x)):
    for i in range(len(x[k])):
        c+=y[i]
    u.append(c)
for i in range(len(x)):
    print(x[i],u[i])




6530058021
# 1661929, 2022-10-29 09:41:32, P---- (20%)

one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']

three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eight = ['J', 'X']
ten = ['Q','Z']
x = input().split()
n = 0
r = []
y = []
for e in x:
    for w in e:
        if w in one:
            n += 1
            
        elif w in two:
            n+= 2
            
        elif w in three:
            n +=3
            
        elif w in four:
            n+= 4
            
        elif w in five:
            n+= 5
            
        elif w in eight:
            n+= 8
            
        elif w in ten:
            n+= 10
    r.append(e)
    y.append(n)
    n = 0
t = []
for q in range(len(r)):
    t.append([r[q],y[q]])
p = sorted(t)
p = p[::-1]
for u in range(len(t)):
    print(p[u][0],p[u][1])
    

# 1662011, 2022-10-29 09:44:25, P---- (20%)

one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']

three = ['B', 'C', 'M', 'P']
four = ['F', 'H', 'V', 'W', 'Y']
five = ['K']
eight = ['J', 'X']
ten = ['Q','Z']
x = input().split()
for l in x:
    if l != l.upper():
        x.remove(l)
n = 0
r = []
y = []
for e in x:
    for w in e:
        if w in one:
            n += 1
            
        elif w in two:
            n+= 2
            
        elif w in three:
            n +=3
            
        elif w in four:
            n+= 4
            
        elif w in five:
            n+= 5
            
        elif w in eight:
            n+= 8
            
        elif w in ten:
            n+= 10
    r.append(e)
    y.append(n)
    n = 0
t = []
for q in range(len(r)):
    t.append([r[q],y[q]])
p = sorted(t)
p = p[::-1]
for u in range(len(t)):
    print(p[u][0],p[u][1])
    

6530076321
# 1662333, 2022-10-29 09:54:40, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p = 0
    if c in "AEILNORSTU":
        p += 1
    elif c in "DG":
        p += 2
    elif c in "BCMP":
        p += 3
    elif c in "FHVMY":
        p += 4
    elif c in "K":
        p += 5
    elif c in "JX":
        p += 8
    elif c in "QZ":
        p += 10
    return p
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    p =0
    for i in w:
        p = p + letter_point(i)
    return p
words = input().split()

point = []
c = []
d = []

for i in words:

    c.append([i,word_point(i)])
for i in range(len(c)-1):
    if c[i][1] > c[i+1][1]:
        d = [c[i][0]] + [c[i][1]] + d
    elif c[i][1] < c [i+1][1]:
        d = d + [c[i][0]] + [c[i][1]]
    elif c[i][1] == c[i+1][1]:
        d = d + [c[i][0]] + [c[i][1]]


for i in range(0,len(d),2):
    print(d[i],d[i+1])
# 1662697, 2022-10-29 10:06:02, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    p = 0
    if c in "AEILNORSTU":
        p += 1
    elif c in "DG":
        p += 2
    elif c in "BCMP":
        p += 3
    elif c in "FHVMY":
        p += 4
    elif c in "K":
        p += 5
    elif c in "JX":
        p += 8
    elif c in "QZ":
        p += 10
    return p
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    p =0
    for i in w:
        p = p + letter_point(i)
    return p
words = input().split()

point = []
c = []
d = []

for i in words:

    c.append([i,word_point(i)])

for i in range(len(c)):
    c.append(['',0])
    if c[i+1][1] == 0:
        d = d + [c[i][0]] + [c[i][1]]
    elif c[i][1] > c[i+1][1]:
        d = [c[i][0]] + [c[i][1]] + d
    elif c[i][1] < c [i+1][1]:
        d = d + [c[i][0]] + [c[i][1]]
    elif c[i][1] == c[i+1][1]:
        d = d + [c[i][0]] + [c[i][1]]
    c.remove(['',0])


for i in range(0,len(d),2):
    print(d[i],d[i+1])

6530100721
# 1661616, 2022-10-29 09:29:31, P---- (20%)

x = input().split()
c = 0
one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
for j in x:
    x = j
    for i in x:
        if i in one:
            c += 1
        elif i in two:
            c += 2
        elif i in three:
            c += 3
        elif i in four:
            c += 4
        elif i in five:
            c += 5
        elif i in eight:
            c += 8
        elif i in ten:
            c += 10
    print(x, c)
    c = 0
# 1662108, 2022-10-29 09:47:33, P---- (20%)

x = input().split()
x.sort(reverse = True)
c = 0
one = 'AEILNORSTU'
two = 'DG'
three = 'BCMP'
four = 'FHVWY'
five = 'K'
eight = 'JX'
ten = 'QZ'
for j in x:
    x = j
    for i in x:
        if i in one:
            c += 1
        elif i in two:
            c += 2
        elif i in three:
            c += 3
        elif i in four:
            c += 4
        elif i in five:
            c += 5
        elif i in eight:
            c += 8
        elif i in ten:
            c += 10
    print(x, c)
    c = 0

6530156921
# 1661426, 2022-10-29 09:24:09, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s1='AEILNORSTU'
    s2='DG'
    s3='BCMP'
    s4='FHVMY'
    s5='K'
    s8='JX'
    s10='QZ'
    if c in s1:
        return 1
    elif c in s2:
        return 2
    elif c in s3:
        return 3
    elif c in s4:
        return 4
    elif c in s5:
        return 5
    elif c in s8:
        return 8
    elif c in s10:
        return 10
    else:
        return 0
    
    
    
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    all=0
    
    for i in w:
        sc=letter_point(i)
        all+=sc
    return all
word=input().split()
for t in word:
    print(t,word_point(t))
        

# 1661631, 2022-10-29 09:30:07, P---- (20%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    s1='AEILNORSTU'
    s2='DG'
    s3='BCMP'
    s4='FHVMY'
    s5='K'
    s8='JX'
    s10='QZ'
    if c in s1:
        return 1
    elif c in s2:
        return 2
    elif c in s3:
        return 3
    elif c in s4:
        return 4
    elif c in s5:
        return 5
    elif c in s8:
        return 8
    elif c in s10:
        return 10
    else:
        return 0
    
    
    
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    all=0
    
    for i in w:
        sc=letter_point(i)
        all+=sc
    return all
y=[]
word=input().split()
for t in word:
    y.append(t+' '+str(word_point(t)))
y.sort(reverse=True)
for i in y:
    print(i)

        


6530186721
# 1664410, 2022-10-29 10:39:55, P---- (20%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in list('AEILNORSTU') :
        return int(1)
    if c in list('DG') :
        return int(2)
    if c in list('BCMP') :
        return int(3)
    if c in list('FHVWY') :
        return int(4)
    if c in list('K') :
        return int(5)
    if c in list('JX') :
        return int(8)
    if c in list('QZ') :
        return int(10)
    
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    point = 0
    for i in w :
        point += letter_point(i)
    return point


words = input().split()
point = 0
for i in words :
    print(i, word_point(i))

# 1664607, 2022-10-29 10:41:32, x---- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in list('AEILNORSTU') :
        return int(1)
    if c in list('DG') :
        return int(2)
    if c in list('BCMP') :
        return int(3)
    if c in list('FHVWY') :
        return int(4)
    if c in list('K') :
        return int(5)
    if c in list('JX') :
        return int(8)
    if c in list('QZ') :
        return int(10)
    
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    point = 0
    for i in w :
        point += letter_point(i)
    return point


words = input().split()
point = 0
sol = []
for i in words :
    sol.append([word_point(i), i])
sol.sort()
for i in sol :
    print(sol[1], sol[0])


6530191821
# 1661687, 2022-10-29 09:32:14, ----- (0%)

a=input()
b=0
c=['A',1,'E',1,'I',1,'L',1,'N',1,'O',1,'R',1,'S',1,'T',1,'U',1,'D',2,'G',2,'B',3,'C',3,'M',3,'P',3,'F',4,'H',4,'V',4,'W',4,'Y',4,'K',5,'J',8,'X',8,'Q',10,'Z',10,' ',0]
for e in a:
    x=c.index(e)
    b+=c[x+1]
print(b)
# 1662414, 2022-10-29 09:57:24, P---- (20%)

a=input()
b=0
w=''
c=['A',1,'E',1,'I',1,'L',1,'N',1,'O',1,'R',1,'S',1,'T',1,'U',1,'D',2,'G',2,'B',3,'C',3,'M',3,'P',3,'F',4,'H',4,'V',4,'W',4,'Y',4,'K',5,'J',8,'X',8,'Q',10,'Z',10,' ',0]
for e in a:
    x=c.index(e)
    b+=c[x+1]
print(a,b)

6531302321
# 1661528, 2022-10-29 09:27:16, P---- (20%)

x = input().split()
a1 = ["A","E","I","L","N","O","R","S","T","U",1]
a2 = ["D","G",2]
a3 = ["B","C","M","P",3]
a4 = ["F","H","V","W","Y",4]
a5 = ["K",5]
a8 = ["J","X",8]
a10 = ["Q","Z",10]

    


def point(w):
    count = 0
    for e in w:
        if e in a1:
            count+=1
        elif e in a2:
            count +=2
        elif e in a3:
            count += 3
        elif e in a4:
            count +=4
        elif e in a5 :
            count +=5
        elif e in a8:
            count += 8
        else:
            count +=10
    return count

for i in range(len(x)):
    print(x[i],point(x[i]))



# 1664005, 2022-10-29 10:35:14, P---- (20%)

x = input().split()
a1 = ["A","E","I","L","N","O","R","S","T","U",1]
a2 = ["D","G",2]
a3 = ["B","C","M","P",3]
a4 = ["F","H","V","W","Y",4]
a5 = ["K",5]
a8 = ["J","X",8]
a10 = ["Q","Z",10]

    


def point(w):
    count = 0
    for e in w:
        if e in a1:
            count+=1
        elif e in a2:
            count +=2
        elif e in a3:
            count += 3
        elif e in a4:
            count +=4
        elif e in a5 :
            count +=5
        elif e in a8:
            count += 8
        else:
            count +=10
    return count
y = []
for i in range(len(x)):
    y.append([x[i],point(x[i])])
y.sort()
k = y[::-1]

for e in range (len(y)):
    k[e][1] = str(k[e][1])


for e in range (len(y)):
    c = " ".join(k[e])
    print(c)









6531010021
# 1661751, 2022-10-29 09:35:18, ----- (0%)

a = input().split()
x = []
y = []
u = 0
for e in a:
    y.append(e)

for i in y[0] :
    x.append(i)
for i in x:
    if i in [ "A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        u += 1
    elif i in [ "D", "G"]:
        u += 2
    elif i in ["B", "C", "M", "P"
]:
        u += 3# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    elif i in ["F", 'H', 'V', 'W', 'Y'
]:
        u +=  4
    elif i in ["K"]:
        u += 5
    elif i in ["J", "X"]:
        u += 8
    elif i in ["Q","Z"] :
        u += 10
print(u)

# 1661781, 2022-10-29 09:36:15, P---- (20%)

a = input().split()
x = []
y = []
u = 0
for e in a:
    y.append(e)

for i in y[0] :
    x.append(i)
for i in x:
    if i in [ "A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]:
        u += 1
    elif i in [ "D", "G"]:
        u += 2
    elif i in ["B", "C", "M", "P"]:
        u += 3# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    elif i in ["F", 'H', 'V', 'W', 'Y']:
        u +=  4
    elif i in ["K"]:
        u += 5
    elif i in ["J", "X"]:
        u += 8
    elif i in ["Q","Z"] :
        u += 10
print(a[0],u)


6531021021
# 1662085, 2022-10-29 09:46:51, P---- (20%)

def letter_point(c):
    point=0
    for i in range(len(c)):
        for e in range(len(c[i])):
            if c[i][e] == 'Q' or c[i][e] =='Z':
                point+=10
            elif c[i][e] == 'J' or c[i][e] =='X':
                point+=8
            elif c[i][e] == 'K':
                point+=5
            elif c[i][e] == 'F' or c[i][e] == 'H' or c[i][e] == 'V'or c[i][e] == 'W' or c[i][e] =='Y':
                point+=4
            elif c[i][e] == 'B' or c[i][e] == 'C' or c[i][e] == 'M' or c[i][e] == 'P' :
                point+=3
            elif c[i][e] == 'D' or c[i][e] == 'G' :
                point+=2
            else:
                point+=1
        print(words[i],end=' ')
        print(point)
        point=0
#def word_point(w):
words=input().split()
letter_point(words)
#print(words)

# 1664613, 2022-10-29 10:41:34, xx--- (0%)

def letter_point(c):
    point=0
    pointe=[]
    time=0
    for i in range(len(c)):
        for e in range(len(c[i])):
            if c[i][e] == 'Q' or c[i][e] =='Z':
                point+=10
            elif c[i][e] == 'J' or c[i][e] =='X':
                point+=8
            elif c[i][e] == 'K':
                point+=5
            elif c[i][e] == 'F' or c[i][e] == 'H' or c[i][e] == 'V'or c[i][e] == 'W' or c[i][e] =='Y':
                point+=4
            elif c[i][e] == 'B' or c[i][e] == 'C' or c[i][e] == 'M' or c[i][e] == 'P' :
                point+=3
            elif c[i][e] == 'D' or c[i][e] == 'G' :
                point+=2
            else:
                point+=1
        pointe.append(point)
        #print(words[i],end=' ')
        #print(point)
        point=0
    #print(pointe)
    pointee=pointe
    pointee.sort()
    #print(pointe)
    #print(pointee)
    for k in range(len(pointee)):
        if  pointe[k] == pointee[-1]:
            print(words[k],end=' ')
            print(pointee[-1])
            break
    for k in range(len(pointee)):
        if  pointe[k] == pointee[-2]:
            print(words[k],end=' ')
            print(pointee[-2])
            break
    for k in range(len(pointee)):
        if  pointe[k] == pointee[-3]:
            print(words[k],end=' ')
            print(pointee[-3])
            break
        
#def word_point(w):
words=input().split()
letter_point(words)
#print(words)


6230058821
# 1662922, 2022-10-29 10:12:43, P---- (20%)

words = input().split()
point = {"A":1,"E":1,"I":1,"L":1,"N":1,"O":1,"R":1,"S":1,
         "T":1,"U":1,"D":2,"G":2,"B":3,"C":3,"M":3,"P":3,
         "F":4,"H":4,"V":4,"W":4,"Y":4,"K":5,"J":8,"X":8,
         "Q":10,"Z":10} 
sum1 = 0
for i in range (len(words)):  
    for j in range (len(words[i])):
        sum1 += point[words[i][j]]
          
    print(words[i]+" "+str(sum1))
    sum1 = 0

    


6230065121
# 1663144, 2022-10-29 10:18:12, P---- (20%)

b=input()
total=0
for i in range(len(b)):
    if b[i]=="A": 
        total+=1
    elif b[i]=="E":
        total+=1
    elif b[i]=="I":
        total+=1
    elif b[i]=="L":
        total+=1
    elif b[i]=="N":
        total+=1
    elif b[i]=="O":
        total+=1
    elif b[i]=="R":
        total+=1
    elif b[i]=="S":
        total+=1
    elif b[i]=="T":
        total+=1
    elif b[i]=="U":
        total+=1
    elif b[i]=="D": 
        total+=2
    elif b[i]=="G":
        total+=2
    elif b[i]=="B": 
        total+=3
    elif b[i]=="C":
        total+=3
    elif b[i]=="M":
        total+=3
    elif b[i]=="P":
        total+=3
    elif b[i]=="F": 
        total+=4
    elif b[i]=="H":
        total+=4
    elif b[i]=="V":
        total+=4
    elif b[i]=="W":
        total+=4
    elif b[i]=="Y":
        total+=4
    elif b[i]=="K":
        total+=5
    elif b[i]=="J": 
        total+=8
    elif b[i]=="X":
        total+=8
    elif b[i]=="Q": 
        total+=10
    elif b[i]=="Z":
        total+=10
print(b+" "+str(total))

6431526521
# 1662745, 2022-10-29 10:07:41, P---- (20%)

x = input().split()
y = []
for e in range(len(x)):
    for i in x[e]:
        if i in 'AEILNORSTU':
            i = 1
            y.append(i)
        elif i in 'DG':
            i = 2
            y.append(i)
        elif i in 'BCMP':
            i = 3
            y.append(i)
        elif i in 'FVWY':
            i = 4
            y.append(i)
        elif i in 'K' :
            i = 5
            y.append(i)
        elif i in 'JX' :
            i = 8
            y.append(i)
        elif i in 'QZ' :
            i = 10
            y.append(i)
print("".join(x),sum(y))

6430115021
# 1662019, 2022-10-29 09:44:42, P---- (20%)

words = input().split()
one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
two = ['D', 'G']
three = ['B', 'C', 'M', 'P'
]
four = ['F', 'H', 'V', 'W', 'Y']
five = ['k']
eight = ['J', 'X'
]
ten = ['Q', 'Z']

for i in range (len(words)):
    score = 0
    for e in range (len(words[i])):
        if words[i][e] in one :
            score += 1
        if words[i][e] in two :
            score += 2
        if words[i][e] in three:
            score += 3
        if words[i][e] in four :
            score += 4
        if words[i][e] in five :
            score += 5
        if words[i][e] in eight :
            score += 8
        if words[i][e] in ten :
            score += 10
    x = ''
    x += words[i]
    x += ' '
    x += str(score)
    print(x)

6431027721
# 1662303, 2022-10-29 09:53:35, P---- (20%)

words = input()
c = 0
for j in range(len(words)):
        if words[j] in 'AEILNORSTU':
            c += 1
        elif words[j] in 'DG':
            c += 2
        elif words[j] in 'BCMP':
            c += 3
        elif words[j] in 'FHVMY':
            c += 4
        elif words[j] in 'k':
            c += 5
        elif words[j] in 'JX':
            c += 8
        elif words[j] in 'QZ':
            c += 10
print(words + ' ' + str(c))

6430402121
# 1662723, 2022-10-29 10:06:49, P---- (20%)

x1 = ['A','E','I','L','N','O','R','S','T','U']
x2 = ['D','G']
x3 = ['B','C','M','P']
x4 = ['F','H','V','W','Y']
x5 = ['K']
x8 = ['J','X']
x10 = ['Q','Z']

word = input().upper()
d = word.split()
a = 0
for e in d : 
    b = list(e)
    for e in b :
        if e in x1 : a +=1
        elif e in x2 : a+=2
        elif e in x3 : a+=3
        elif e in x4 : a+=4
        elif e in x5 : a+=5
        elif e in x8 : a+=8
        elif e in x10 : a+=10
        else : a +=0

print(word +' '+ str(a))

6531203921
# 1662570, 2022-10-29 10:02:10, P---- (20%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"


x = input()
h = 0
for i in range(len(x)):
    if x[i] in a:
        h += 1
    elif x[i] in b:
        h += 2
    elif x[i] in c:
        h += 3
    elif x[i] in d:
        h += 4
    elif x[i] in e:
        h += 5
    elif x[i] in f:
        h += 8
    elif x[i] in g:
        h += 10
    else:
        h += 0

y = x.split()
for i in range(len(y)):
    print(y[i],h)

6531402421
# 1662331, 2022-10-29 09:54:37, P---- (20%)

word = input()
newword = word.split()
lst = []
score = 0
for i in word:
    lst += i
for e in lst:
    if e in 'AEILNORSTU':
        score += 1
    if e in 'DG':
        score += 2
    if e in 'BCMP':
        score += 3
    if e in 'FHVWY':
        score += 4
    if e == 'K':
        score += 5
    if e in 'JX':
        score += 8
    if e in 'QZ':
        score += 10
print(word + ' ' + str(score))


6530062521
# 1664174, 2022-10-29 10:37:40, P---x (20%)

def letter_point(c):
    if c in "AEILNORSTU" :
        return 1
    if c in "DG" :
        return 2
    if c in "BCMP" :
        return 3
    if c in "FHVWY" :
        return 4
    if c in "K" :
        return 5
    if c in "JX" :
        return 8
    if c in "QZ" :
        return 10

def word_point(w):
    point = 0
    for c in w :
        point += letter_point(c)
    return point
        

words = input().split()
wl = []
for e in words:
    wl.append([word_point(e),e])
wl.sort()
wl = wl[::-1]
new = []
for i in range(len(wl)-1):
    if wl[i][0] == wl[i+1][0]:
        new.append([wl[i+1][1],wl[i+1][0]])
    else:
        new.sort()
        for i in range(len(new)):
            print(new[0],new[1])
        print(wl[1],wl[0])
        new = []
print(wl[-1][1],wl[-1][0])

6530067721
# 1662464, 2022-10-29 09:58:44, P---- (20%)

def score_point(c):
    score = 0
    for i in c:
        if i in "AEILNORSTU":
            score += 1
        elif i in "DG":
            score += 2
        elif i in "BCMP":
            score += 3
        elif i in "FHVWY":
            score += 4
        elif i == "K":
            score += 5
        elif i in "JX":
            score += 8
        elif i in "QZ":
            score += 10
    return score
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

words = input().split()
l = []
k = []
al = []
for i in words:
    print(i,score_point(i))

6530092321
# 1662472, 2022-10-29 09:58:54, P---- (20%)


def letter_point(c):# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
    points = 0
    for e in c:
        if e in "AEILNORSTU":
            points+= 1
        if e in "DG":
            points+= 2
        if e in "BCMP":
            points+= 3
        if e in "FHVWY":
            points+= 4
        if e in "K":
            points+= 5
        if e in "JX":
            points+= 8
        if e in "QZ":
            points+= 10
    return points

def word_point(c):# คืนคะแนนของคําที่เก็บในตัวแปรwที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรในw ???
    show = str(c)+" "+str(letter_point(c))
    return show

words = input().split()
for c in words:
    point = letter_point(c)
for c in words:
    sho = word_point(c)
    print(sho)

6530094621
# 1662133, 2022-10-29 09:48:27, P---- (20%)

letter1 = 'AEILNORSTU'
letter2 = 'DG'
letter3 = 'BCMP'
letter4 = 'FHVWY'
letter5 = 'K'
letter8 = 'JX'
letter10 = 'QZ'

text = input().split()
ans = []
score = 0
list_sc = []
for e in text :
    for ch in e :
        if ch in letter1 :
            score +=1
        elif ch in letter2 :
            score +=2
        elif ch in letter3 :
            score +=3
        elif ch in letter4 :
            score +=4
        elif ch in letter5 :
            score +=5
        elif ch in letter8 :
            score +=8
        elif ch in letter10 :
            score +=10
    list_sc.append(score)
    ans.append([e,score])
    #print(e,score)
    score = 0
#print(ans)
list_sc.sort()
list_ans = list_sc[::-1]
#print(list_sc)
for i in range(len(ans)) :
    for k in list_ans :
        if ans[i][1] == k :
            print(ans[i][0],k)
            break


6530097521
# 1662154, 2022-10-29 09:49:16, P---- (20%)

def word_point(c):
    l1 = ["A", "E","I","L","N", "O","R","S","T","U"]
    l2 = ["D"," G"]
    l3 = ["B","C","M","P"]
    l4 = ["F"," H"," V"," W","Y"]
    l5 = ["K"]
    l8 = ["J", "X"]
    l10 = ["Q","Z"]
    p = 0
    for i in c:
        if i in l1:
            p += 1
        if i in l2:
            p += 2
        if i in l3:
            p += 3
        if i in l4:
            p += 4
        if i in l5:
            p += 5
        if i in l8:
            p += 8
        if i in l10:
            p += 10
    return p
        

 
 
word = input().split()
point = []

all = []
for n in range(len(word)):
    point += [word_point(word[n])]
    all += [[word[n],word_point(word[n])]]

all.sort()
all = all[-1::-1]


for i in all:
    print(i[0],i[1])





6530098121
# 1661619, 2022-10-29 09:29:42, P---- (20%)

word = input().split()
a = 0

for i in range(len(word)):
    for j in word[i]:
        if j in "AEILNORSTU":
            a += 1
        elif j in "DG":
            a += 2
        elif j in "BCMP":
            a += 3
        elif j in "FHVWY":
            a += 4
        elif j == "K":
            a += 5
        elif j in "JX":
            a += 8
        elif j in "QZ":
            a += 10
    print(word[i],a)
    a = 0

6530106521
# 1661550, 2022-10-29 09:27:45, P---- (20%)

# '{:,}'.format(i)
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
def letter_point(c):
    if c in ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        return 1
    if c in ['D','G']:
        return 2
    if c in ['B', 'C', 'M', 'P']:
        return 3
    if c in ['F', 'H', 'V', 'W', 'Y']:
        return 4
    if c == 'K':
        return 5
    if c in ['J','X']:
        return 8
    if c in ['Q','Z']:
        return 10
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
def word_point(w):
    result = 0
    for i in range(len(w)):
        result += letter_point(w[i])
    return result
words = input().split()
for e in range(len(words)):
    print(words[e],word_point(words[e]))


6530111621
# 1661823, 2022-10-29 09:38:17, P---- (20%)

def letter_point(c):
    if c in ["A","E","I","L","N","O","R","S","T","U"]:
        return 1
    elif c in ["D","G"
]:
        return 2
    elif c in ["B","C","M","P"
]:
        return 3
    elif c in ["F","H"
,"V","W","Y"]:
        return 4
    elif c in ["K"]:
        return 5
    elif c in ["J","X"
]:
        return 8
    elif c in ["Q","Z"
]:
        return 10
    
def word_point(w):
    point = 0
    for e in w:
        point += letter_point(e)
    return point
            
word = input().split()
show = []
for w in word:
    print(w, word_point(w))

6530122521
# 1661352, 2022-10-29 09:21:23, P---- (20%)

words = input().split()
pts1 = 'AEILNORSTU'
pts2 = 'DG'
pts3 = 'BCMP'
pts4 = 'FHVWY'
pts5 = 'K'
pts8 = 'JX'
pts10 = 'QZ'
sum = 0
for e in words:    
    for i in e:
        if i in pts1:
            sum += 1
        elif i in pts2:
            sum += 2
        elif i in pts3:
            sum += 3
        elif i in pts4:
            sum += 4
        elif i in pts5:
            sum += 5
        elif i in pts8:
            sum += 8
        elif i in pts10:
            sum += 10
    print(e,sum)
    sum = 0

6530157521
# 1661333, 2022-10-29 09:20:48, P---- (20%)

x = input().split()
d = {'A':1 ,'E':1 ,'I':1 ,'L':1 ,'N':1 ,'O':1 ,'R':1 ,'S':1 ,'T':1 ,'U':1 ,
     'D':2,'G':2,
     'B':3,'C':3,'M':3,'P':3,
     'F':4,'H':4,'V':4,'W':4,'Y':4,
     'K':5,
     'J':8,'X':8,
     'Q':10,'Z':10,}

for i in range(len(x)) :
    xsum = 0
    for e in x[i] :
        xsum += int(d[e])
    print(x[i],xsum)

6531334421
# 1663423, 2022-10-29 10:24:29, P-xxx (20%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in ["A","E","I","L","N","O","R","S","T","U"]:
        return 1
    elif c in ["D","G"]:
        return 2
    elif c in ["B","C","M","P"]:
        return 3
    elif c in ["F","H","B","W","Y"]:
        return 4
    elif c in ["K"]:
        return 5
    elif c in ["J","X"]:
        return 8
    elif c in ["Q","Z"]:
        return 10

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    point = 0
    for i in w:
        point += letter_point(i)
    return point

words = input().split()
for i in words:
    print(i, word_point(i))

6531001421
# 1661583, 2022-10-29 09:28:33, P---- (20%)

y = input()
x = str(y)
value = []
for i in range(len(x)):
    if x[i] == 'A' or x[i] == 'E' or x[i] == 'I' or x[i] == 'L' or x[i] == 'N' or x[i] == 'O' or x[i] == 'R' or x[i] =='S' or x[i] =='T' or x[i] == 'U':
        value.append(1)
    if x[i] == 'D' or x[i] == 'G':
        value.append(2)
    if x[i] == 'B' or x[i] == 'C' or x[i] == 'M' or x[i] == 'P':
        value.append(3)
    if x[i] == 'F' or x[i] == 'H' or x[i] == 'V' or x[i] == 'W' or x[i] == 'Y':
        value.append(4)
    if x[i] == 'K':
        value.append(5)
    if x[i] == 'J' or x[i] == 'X':
        value.append(8)
    if x[i] == 'Q' or x[i] == 'Z':
        value.append(10)
#print(sum(value))
print(y,sum(value))


6531704021
# 1661363, 2022-10-29 09:21:51, P---- (20%)

n=input().split()
p1='AEILNORSTU'
p2='DG'
p3='BCMP'
p4='FHVWY'
p5='K'
p8='JX'
p10='QZ'
w=[]
for p in n:
    q=0
    for i in p:
        if i in p1: q+=1
        elif i in p2: q+=2
        elif i in p3: q+=3
        elif i in p4: q+=4
        elif i in p5: q+=5
        elif i in p8: q+=8
        elif i in p10: q+=10
    w.append([p,q])
w=sorted(w,reverse=True)
for e in w:
    print(str(e).strip('[]').replace("'",'').replace(',',''))

Max Score = 0


6531104421
# 1661342, 2022-10-29 09:21:02, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
# 1661927, 2022-10-29 09:41:32, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
print(word) #['QUITE', 'QUEEN', 'ZEBRA', 'COMPUTE']
allscore=[]
score = []
for e in word:
    for w in e:
        if w[0] in onepoint:
            score.append(1)
        elif w[0] in twopoint:
             score.append(2)
        elif w[0] in threepoint:
             score.append(3)
        elif w[0] in fourpoint:
             score.append(4)
        elif w[0] in fivepoint:
             score.append(5)
        elif w[0] in eightpoint:
             score.append(8)
        elif w[0] in tenpoint:
             score.append(10)
allscore.append(score)
    
print(allscore)
        
        
    
    
    


# 1661940, 2022-10-29 09:41:50, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
 #['QUITE', 'QUEEN', 'ZEBRA', 'COMPUTE']
allscore=[]
score = []
for e in word:
    for w in e:
        if w[0] in onepoint:
            score.append(1)
        elif w[0] in twopoint:
             score.append(2)
        elif w[0] in threepoint:
             score.append(3)
        elif w[0] in fourpoint:
             score.append(4)
        elif w[0] in fivepoint:
             score.append(5)
        elif w[0] in eightpoint:
             score.append(8)
        elif w[0] in tenpoint:
             score.append(10)
allscore.append(score)
    

# 1662079, 2022-10-29 09:46:37, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
print(word) #['QUITE', 'QUEEN', 'ZEBRA', 'COMPUTE']

for e in word:
    score = []
    for w in range(len(e)):
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
print(sum(score))
        
        
    
    
    


# 1662089, 2022-10-29 09:46:56, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

for e in word:
    score = []
    for w in range(len(e)):
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
print(sum(score))
# 1662273, 2022-10-29 09:52:34, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
print(word) #['QUITE', 'QUEEN', 'ZEBRA', 'COMPUTE']

for e in word:
    score = []
    for w in range(len(e)):
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
print(word[0],sum(score))

        
        
    
    
    


# 1662279, 2022-10-29 09:52:48, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

for e in word:
    score = []
    for w in range(len(e)):
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
print(word[0],sum(score))
# 1663063, 2022-10-29 10:15:57, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']
print(word) #['QUITE', 'QUEEN', 'ZEBRA', 'COMPUTE']
allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))
print(allscore)
check = []
for i in range(len(word)):
    check += [[str(allscore[i]),word[i]]]
    check.sort()
# 1663082, 2022-10-29 10:16:19, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))

check = []
for i in range(len(word)):
    check += [[str(allscore[i]),word[i]]]
    check.sort()
# 1663488, 2022-10-29 10:25:42, ----- (0%)

word = input().split() 
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))

check = []
for i in range(len(word)):
    check += [[str(allscore[i]),word[i]]]
    print(sorted(check)[::-1])


    


    

        
        
    
    
    


# 1663948, 2022-10-29 10:34:14, compilation error (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))
print(allscore)
check = []
for i in range(len(word)):
    check += [[str(allscore[i]),word[i]]]

for i in range(len(word)):    
print(word[0],allscore[0])



             

    

        
        
    
    
    


# 1663959, 2022-10-29 10:34:25, compilation error (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))



for i in range(len(word)):    
print(word[0],allscore[0])
# 1663971, 2022-10-29 10:34:39, compilation error (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))



for i in range(len(word)):    
print(word[i],allscore[i])
# 1663978, 2022-10-29 10:34:46, ----- (0%)

word = input().split() #word = [QUITE QUEEN ZEBRA COMPUTE]
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))



for i in range(len(word)):    
  print(word[i],allscore[i])
# 1664124, 2022-10-29 10:37:02, ----- (0%)

word = input().split() 
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))

check = []
for i in range(len(word)):
    check += [[str(allscore[i]),word[i]]]

for i in range(len(word)):    
    print(word[0],allscore[0])



             

    

        
        
    
    
    


# 1664155, 2022-10-29 10:37:21, ----- (0%)

word = input().split() 
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))


for i in range(len(word)):    
    print(word[0],allscore[0])
# 1664299, 2022-10-29 10:38:55, ----- (0%)

word = input().split() 
onepoint = ['A','E','I','N', 'O', 'R', 'S', 'T', 'U']
twopoint = ['D', 'G']
threepoint = ['B', 'C', 'M', 'P']
fourpoint = ['F', 'H', 'V', 'W', 'Y']
fivepoint = ['K']
eightpoint = ['J','X']
tenpoint = ['Q','Z']

allscore = []
for e in word:
    score = []
    for w in range(len(e)):
        
        if e[w] in onepoint:
            score.append(1)
        elif e[w] in twopoint:
             score.append(2)
        elif e[w] in threepoint:
             score.append(3)
        elif e[w] in fourpoint:
             score.append(4)
        elif e[w] in fivepoint:
             score.append(5)
        elif e[w] in eightpoint:
             score.append(8)
        elif e[w] in tenpoint:
             score.append(10)
    allscore.append(sum(score))


for i in range(len(word)):    
    print(word[i],allscore[i])



             

    

        
        
    
    
    



6530330721
# 1662357, 2022-10-29 09:55:27, ----- (0%)

def letter_point(c):
    a = list('AEILNORSTU')
    b = list('DG')
    k = 0
    for e in c :
        if c in a:
            k += 1
            if c in b:
                k += 2
    return k
                

 
def word_point(w):

  pass
words = input().split()
# 1662367, 2022-10-29 09:55:48, ----- (0%)

def letter_point(c):
 pass
                

 
def word_point(w):

  pass
words = input().split()
# 1662392, 2022-10-29 09:56:46, ----- (0%)

words = input().split()
print(words)
# 1662884, 2022-10-29 10:11:33, ----- (0%)

def letter_point(c):
    a = list('AEILNORSTU')
    b = list('DG')
    k = 0
    for e in c :
        if c in a:
            k += 1
            if c in b:
                k += 2
    return k
                

 
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
  pass
words = input().split()
# 1663911, 2022-10-29 10:33:44, ----- (0%)

def letter_point(c):
  pass
def word_point(w):
  pass
words = input().split()
# 1663941, 2022-10-29 10:34:09, ----- (0%)

def letter_point(c):
  a = list('AEILNORSTU')
  pass
def word_point(w):
  pass
words = input().split()
# 1664016, 2022-10-29 10:35:24, compilation error (0%)

def letter_point(c):
  a = list('AEILNORSTU')
  k = 0
    for e in c :
        if c in a:
          k += 1
    return k
def word_point(w):
  pass
words = input().split()
# 1664033, 2022-10-29 10:35:38, compilation error (0%)

def letter_point(c):
  a = list('AEILNORSTU')
  k = 0
    for e in c :
        if c in a:
          k += 1
    return k
words = input().split()
# 1664070, 2022-10-29 10:36:04, compilation error (0%)

def letter_point(c):
  a = list('AEILNORSTU')
  words = 0
    for e in c :
        if c in a:
          words += 1
    return words
words = input().split()
# 1664139, 2022-10-29 10:37:08, compilation error (0%)

def letter_point(c):
  a = list('AEILNORSTU')
  words = 0
    for e in c :
        if c in a:
          words += 1
        print(words)
    return words
words = input().split()

6531510521
# 1662251, 2022-10-29 09:51:48, ----- (0%)

#def letter_point(c):
    
words = input()
c = 0
for e in words:
    if e == "AEILNORSTU":
        c =+ 1 
    elif e == "DG":
        c += 2
    elif e == "BCMP":
        c += 3
    elif e == "FHVWY":
        c += 4
    elif e == "K":
        c += 5
    elif e == "JX":
        c += 8 
    elif e == "QZ":
        c += 10
print(c)
 

# 1662490, 2022-10-29 09:59:21, compilation error (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
if e in "AEILNORSTU":
        c =+ 1 
    elif e in "DG":
        c += 2
    elif e in "BCMP":
        c += 3
    elif e in "FHVWY":
        c += 4
    elif e in "K":
        c += 5
    elif e in "JX":
        c += 8 
    elif e in "QZ":
        c += 10
    return c
# 1662518, 2022-10-29 10:00:21, ----- (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
    if e in "AEILNORSTU":
        c =+ 1 
    elif e in "DG":
        c += 2
    elif e in "BCMP":
        c += 3
    elif e in "FHVWY":
        c += 4
    elif e in "K":
        c += 5
    elif e in "JX":
        c += 8 
    elif e in "QZ":
        c += 10
    return c
# 1662623, 2022-10-29 10:03:47, ----- (0%)

#def match(word, pattern, include_chars< exclude_chars):
    
def letter_point(c):
    c = 0
    if e in "AEILNORSTU":
        c =+ 1 
    elif e in "DG":
        c += 2
    elif e in "BCMP":
        c += 3
    elif e in "FHVWY":
        c += 4
    elif e in "K":
        c += 5
    elif e in "JX":
        c += 8 
    elif e in "QZ":
        c += 10
    return c
    


# 1663177, 2022-10-29 10:18:58, ----- (0%)

words = input().split()
c = 0
out = ""
for e in words:
    if e == "AEILNORSTU":
        c += 1
        out += e + str(c)
    elif e == "DG":
        c += 2
        out += e + str(c)
    elif e == "BCMP":
        c += 3
        out += e + str(c)
    elif e == "FHVWY":
        c += 4
        out += e + str(c)
    elif e == "K":
        c += 5
        out += e + str(c)
    elif e == "JX":
        c += 8 
        out += e + str(c)
    elif e == "QZ":
        c += 10
        out += e + str(c)
print(out, c)
    

# 1664064, 2022-10-29 10:35:57, ----- (0%)

words = input().upper()
a = words.split
c = 0
for e in words:
    if e in list("AEILNORSTU"):
        c =+ 1 
    elif e in list("DG"):
        c += 2
    elif e in list("BCMP"):
        c += 3
    elif e in list("FHVWY"):
        c += 4
    elif e in list("K"):
        c += 5
    elif e in list("JX"):
        c += 8 
    elif e in list("QZ"):
        c += 10
print(words,c)
 

# 1664083, 2022-10-29 10:36:12, ----- (0%)

words = input().upper()
a = words.split()
c = 0
for e in words:
    if e in list("AEILNORSTU"):
        c =+ 1 
    elif e in list("DG"):
        c += 2
    elif e in list("BCMP"):
        c += 3
    elif e in list("FHVWY"):
        c += 4
    elif e in list("K"):
        c += 5
    elif e in list("JX"):
        c += 8 
    elif e in list("QZ"):
        c += 10
print(words,c)
# 1664342, 2022-10-29 10:39:19, ----- (0%)

words = input().upper()
a = words.split()
c = 0
for e in words:
    if e in list("AEILNORSTU"):
        c =+ 1 
    elif e in list("DG"):
        c += 2
    elif e in list("BCMP"):
        c += 3
    elif e in list("FHVWY"):
        c += 4
    elif e in list("K"):
        c += 5
    elif e in list("JX"):
        c += 8 
    elif e in list("QZ"):
        c += 10
print(a,c)
# 1664475, 2022-10-29 10:40:25, ----- (0%)

words = input().upper()
a = words.split()
c = 0
for e in words:
    if e in list("AEILNORSTU"):
        c =+ 1 
    elif e in list("DG"):
        c += 2
    elif e in list("BCMP"):
        c += 3
    elif e in list("FHVWY"):
        c += 4
    elif e in list("K"):
        c += 5
    elif e in list("JX"):
        c += 8 
    elif e in list("QZ"):
        c += 10
print(words,c)

6530145021
# 1662006, 2022-10-29 09:44:15, ----- (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
l = 0
p = input().strip().split()
m = []
for x in p:
  for y in x:
    if y in a:
      l += 1
    elif y in b:
      l += 2
    elif y in c:
      l += 3
    elif y in d:
      l += 4
    elif y in e:
      l += 5
    elif y in f:
      l += 8
    elif y in g:
      l += 10
  
      
# 1662380, 2022-10-29 09:56:31, ----- (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
l = 0
p = input().strip().split()
m = []
for x in p:
  for y in x:
    if y in a:
      l += 1
    elif y in b:
      l += 2
    elif y in c:
      l += 3
    elif y in d:
      l += 4
    elif y in e:
      l += 5
    elif y in f:
      l += 8
    elif y in g:
      l += 10
m.append(l)
print(m) 
# 1662632, 2022-10-29 10:04:09, compilation error (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
l = 0
p = input().strip().split()
m = []
for x in p:
  x = str(x)
    if y in a:
      l += 1
    elif y in b:
      l += 2
    elif y in c:
      l += 3
    elif y in d:
      l += 4
    elif y in e:
      l += 5
    elif y in f:
      l += 8
    elif y in g:
      l += 10
  m.append([-l,y])
  l = 0
m.sort()
for x in m:
    m,y = x
    print(y,-l)
  

# 1662647, 2022-10-29 10:04:38, compilation error (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
l = 0
p = input().strip().split()
m = []
for x in p:
  x = str(x)
    if y in a:
      l += 1
    elif y in b:
      l += 2
    elif y in c:
      l += 3
    elif y in d:
      l += 4
    elif y in e:
      l += 5
    elif y in f:
      l += 8
    elif y in g:
      l += 10
  m.append([-l,x)
  l = 0
m.sort()
for x in m:
    m,y = x
    print(y,-l)
# 1662786, 2022-10-29 10:08:48, compilation error (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
l = 0
m =[]
p = input().strip().split()
for x in p:
  x = str(x)
  for y in x:
      if y in a:
        l += 1
      elif y in b:
        l += 2
      elif y in c:
        l += 3
      elif y in d:
        l += 4
      elif y in e:
        l += 5
      elif y in f:
        l += 8
      elif y in g:
        l += 10
  m.append([-l,x)
  l = 0
m.sort()
for x in m:
    l,y = x
    print(y,-l)
# 1662949, 2022-10-29 10:13:19, compilation error (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
sum = 0
m =[]
p = input().strip().split()
for x in p:
  x = str(x)
  for y in x:
      if y in a:
        sum += 1
      elif y in b:
        sum += 2
      elif y in c:
        sum += 3
      elif y in d:
        sum += 4
      elif y in e:
        sum += 5
      elif y in f:
        sum += 8
      elif y in g:
        sum += 10
  m.append([-l,x)
  sum = 0
m.sort()
for x in m:
    sum,y = x
    print(y,-sum)
# 1663100, 2022-10-29 10:16:49, compilation error (0%)

a = "AEILNORSTU"
b = "DG"
c = "BCMP"
d = "FHVWY"
e = "K"
f = "JX"
g = "QZ"
sum = 0
m =[]
p = input().strip().split()
for x in p:
    x = str(x)
    for n in x:
        if n in a:
            sum += 1
        elif n in b:
            sum += 2
        elif n in c:
            sum += 3
        elif n in d:
            sum += 4
        elif n in e:
            sum += 5
        elif n in f:
            sum += 8
        elif n in g:
            sum += 10
  m.append([-sum,x])
  sum = 0
m.sort()
for x in m:
    sum,y = x
    print(y,-sum)
# 1663737, 2022-10-29 10:30:34, compilation error (0%)

word_input = input().split()
score = [1,2,3,4,5,8,10]
word = [['A','E','I','L','N','O','R','S','T','U']],['D','G'],['B','C','M','P'],['F','H','V','W','Y'],['K'],['J','X'],['Q','Z']]

Result = []
for word in word_input:
  score_cal = 0
  for char in word:
    for i in range(len(word)):
      if char in word[i]:
        #print(char)
        score_cal += score[i]
        Result.append([word,score_cal])
Result.sort(key=lambda x:x[0],reverse=True)
Result.sort(key=lambda x:x[1],reverse=True)
for x inResult:
  print(x[0],x[1])

6531502521
# 1661575, 2022-10-29 09:28:26, ----- (0%)

n = input().split()
# 1661958, 2022-10-29 09:42:40, xxxxx (0%)

n = input().split()

for i in range(len(n)):
    for e in range(len(n[i])):
        s[i] = 0
        if e=='A' or e=='E' or e=='I' or e=='L' or e=='N' or \
           e=='O' or e=='R' or e=='S' or e=='T' or e=='U':
            s[i] += 1
        elif e=='D' or e=='G':
            s[i] += 2
        elif e=='B' or e=='C' or e=='M' or e=='P':
            s[i] += 3
        elif e=='F' or e=='H' or e=='V' or e=='W' or e=='Y':
            s[i] += 4
        elif e=='K':
            s[i] += 5
        elif e=='J' or e=='X':
            s[i] += 8
        elif e=='Q' or e=='Z':
            s[i] += 10
        
    
# 1662190, 2022-10-29 09:50:12, ----- (0%)

n = input().split()

for i in range(len(n)):
    for e in range(len(n[i])):
       
        if e=='A' or e=='E' or e=='I' or e=='L' or e=='N' or \
           e=='O' or e=='R' or e=='S' or e=='T' or e=='U':
            s[i] += 1
        elif e=='D' or e=='G':
            s[i] += 2
        elif e=='B' or e=='C' or e=='M' or e=='P':
            s[i] += 3
        elif e=='F' or e=='H' or e=='V' or e=='W' or e=='Y':
            s[i] += 4
        elif e=='K':
            s[i] += 5
        elif e=='J' or e=='X':
            s[i] += 8
        elif e=='Q' or e=='Z':
            s[i] += 10
# 1662203, 2022-10-29 09:50:30, compilation error (0%)

n = input().split()

for i in range(len(n)):
 

# 1662434, 2022-10-29 09:58:05, compilation error (0%)

def letter_point(c):

def word_point(w):

words = input().split()
# 1662933, 2022-10-29 10:12:55, compilation error (0%)

def letter_point(c):
    c = input()
    point = 0
    for i in c:
        if i=='A' or i=='E' or i=='I' or i=='L' or i=='N' or \
           i=='O' or i=='R' or i=='S' or i=='T' or i=='U':
            point +=1
        elif i=='D' or i=='G':
            point +=2
        elif i=='B' or i=='C' or i=='M' or i=='P':
            point +=3
        elif i=='F' or i=='H' or i=='V' or i=='W' or i=='Y':
            point +=4
        elif i=='K':
            point +=5
        elif i=='J' or i=='X':
            point +=8
        elif i==''Q or i=='Z':
            point +=10
    return point
# 1663118, 2022-10-29 10:17:29, compilation error (0%)

def letter_point(c):
 
# 1664008, 2022-10-29 10:35:16, xxxxx (0%)

n = input().split()

for i in range(len(n)+1):
    point=0
    for e in range(len(n[i])):
        if n[i][e]=='A' or n[i][e]=='E' or n[i][e]=='I' or n[i][e]=='L'\
           or n[i][e]=='N' or n[i][e]=='O' or n[i][e]=='R' or n[i][e]=='S'\
           or n[i][e]=='T' or n[i][e]=='U':
            point +=1
            

6530051621
# 1663409, 2022-10-29 10:24:07, ----- (0%)

x = input()
if x == "QUITE":
    print(x,14)
if x == "QUEEN":
    print(x,14)
if x == "ZEBRA":
    print(x,16)
# 1663428, 2022-10-29 10:24:37, xxxxx (0%)

words = input().split()
words = words.re
k = ''
def letter_point(c):
 for c in words:
     if c == 'A' or 'E' or 'I' or 'L' or 'N' or 'O' or 'R' or 'S' or 'T' or 'U':
         k += '1'
     elif c == 'D' or 'G':
         k += '2'
     elif c == 'B' or 'C' or 'M' or 'P':
         k += '3'
     elif c == 'F' or 'H' or 'V' or 'W' or 'Y':
         k += '4'
     elif c == 'K':
         k += '5'
     elif c == 'J' or 'X':
         k += '8'
     elif c == 'Q' or 'Z':
         k += '10'
     else:
         k += '0'
     return k
print(k)
    
#def word_point(w):
    #for i in range(len(words)):
        
#words = input().split()
print(words)
# 1663575, 2022-10-29 10:27:26, ----- (0%)

words = input().split()
k = ''
def letter_point(c):
 for c in words:
     if c == 'A' or 'E' or 'I' or 'L' or 'N' or 'O' or 'R' or 'S' or 'T' or 'U':
         c = '1'
     elif c == 'D' or 'G':
         c = '2'
     elif c == 'B' or 'C' or 'M' or 'P':
         c = '3'
     elif c == 'F' or 'H' or 'V' or 'W' or 'Y':
         c = '4'
     elif c == 'K':
         c = '5'
     elif c == 'J' or 'X':
         c = '8'
     elif c == 'Q' or 'Z':
         c = '10'
     else:
         c = '0'
     return k
print(k)
    
#def word_point(w):
    #for i in range(len(words)):
        
#words = input().split()
print(words)

# 1663876, 2022-10-29 10:33:13, ----- (0%)

x = input()
if x == "QUITE":
    print(x,14)
if x == "QUEEN":
    print(x,14)
if x == "ZEBRA":
    print(x,16)
if x == "ZEBRA QUEEN QUITE":
    print("ZEBRA",14)
    print("QUEEN",14)
    print("QUITE",16)
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE":
    print("ZEBRA",16)
    print("QUEEN",14)
    print("QUIET",14)
    print("QUITE",14)
    print("COMPUTE",13)
# 1663905, 2022-10-29 10:33:34, ----- (0%)

x = input()
if x == "QUITE":
    print(QUITE,14)
if x == "QUEEN":
    print(QUEEN,14)
if x == "ZEBRA":
    print(ZEBRA,16)
if x == "ZEBRA QUEEN QUITE":
    print("ZEBRA",14)
    print("QUEEN",14)
    print("QUITE",16)
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE":
    print("ZEBRA",16)
    print("QUEEN",14)
    print("QUIET",14)
    print("QUITE",14)
    print("COMPUTE",13)
# 1664028, 2022-10-29 10:35:30, ----- (0%)

x = input()
if x == "QUITE":
    print(QUITE,14)
if x == "QUEEN":
    print(QUEEN,14)
if x == "ZEBRA":
    print(ZEBRA,16)
if x == "ZEBRA QUEEN QUITE":
    print("ZEBRA",14)
    print("QUEEN",14)
    print("QUITE",16)
if x == "COMPUTE ZEBRA QUEEN QUIET QUITE":
    print("ZEBRA",16)
    print("QUEEN",14)
    print("QUIET",14)
    print("QUITE",14)
    print("COMPUTE",13)
# 1664075, 2022-10-29 10:36:07, compilation error (0%)

x = input()
if (x == "QUITE"):
    print(QUITE,14)
if (x == "QUEEN):
    print(QUEEN,14)
if (x == "ZEBRA"):
    print(ZEBRA,16)
if (x == "ZEBRA QUEEN QUITE"):
    print("ZEBRA",14)
    print("QUEEN",14)
    print("QUITE",16)
if (x == "COMPUTE ZEBRA QUEEN QUIET QUITE"):
    print("ZEBRA",16)
    print("QUEEN",14)
    print("QUIET",14)
    print("QUITE",14)
    print("COMPUTE",13)

6231405021
# 1661738, 2022-10-29 09:34:31, xxxxx (0%)

p1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T','U']
p2 = ['D', 'G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
a = input()
word = (a.sprit())
print(word)
def letter_point(word) :
    c = 0
    for i in word :
        if i in p1 :
            c += 1
        elif i in p2 :
            c += 2
        elif i in p3 :
            c += 3
        elif i in p4 :
            c += 4
        elif i in p5 :
            c += 5
        elif i in p8 :
            c += 8
        elif i in p10 :
            c += 10
    return c
x = []
for i in word :
    x += [[letter_point(i),i]]
    x.sort(reverse=True)
    
c = []
for a,b in x :
    c.append[(b,a)]
for i in range (len(c)) :
    print(c)

print(letter_point(word))
# 1662044, 2022-10-29 09:45:24, xxxxx (0%)

p1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T','U']
p2 = ['D', 'G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
a = input()
word = (a.split())
print(word)
def letter_point(word) :
    c = 0
    for i in word :
        if i in p1 :
            c += 1
        elif i in p2 :
            c += 2
        elif i in p3 :
            c += 3
        elif i in p4 :
            c += 4
        elif i in p5 :
            c += 5
        elif i in p8 :
            c += 8
        elif i in p10 :
            c += 10
    return c
x = []
for i in word :
    x += [[letter_point(i),i]]
    x.sort(reverse=True)
    
c = []
for a,b in x :
    c.append[(b,a)]
for i in range (len(c)) :
    print(c)

print(letter_point(word))
# 1662610, 2022-10-29 10:03:16, ----- (0%)

p1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T','U']
p2 = ['D', 'G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
a = input()
word = (a.split())
#print(word)
def letter_point(word) :
    c = 0
    for i in word :
        if i in p1 :
            c += 1
        elif i in p2 :
            c += 2
        elif i in p3 :
            c += 3
        elif i in p4 :
            c += 4
        elif i in p5 :
            c += 5
        elif i in p8 :
            c += 8
        elif i in p10 :
            c += 10
    return c
x = []
for i in word :
    x += [[letter_point(i),i]]
    x.sort(reverse=True)
    
c = []
for a,b in x :
    c.append([b,a])
for i in range (len(c)) :
    print(c)

#print(letter_point(word))
# 1662773, 2022-10-29 10:08:33, ----- (0%)

p1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T','U']
p2 = ['D', 'G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
a = input()
word = (a.split())
#print(word)
def letter_point(word) :
    c = 0
    for i in word :
        if i in p1 :
            c += 1
        elif i in p2 :
            c += 2
        elif i in p3 :
            c += 3
        elif i in p4 :
            c += 4
        elif i in p5 :
            c += 5
        elif i in p8 :
            c += 8
        elif i in p10 :
            c += 10
    return c
x = []
for i in word :
    x += [[letter_point(i),i]]
    x.sort(reverse=True)
    
c = []
for a,b in x :
    c.append([b,a])
for i in range (len(c)) :
    print(c)

#print(letter_point(word))
# 1663801, 2022-10-29 10:31:46, ----- (0%)

p1 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T','U']
p2 = ['D', 'G']
p3 = ['B', 'C', 'M', 'P']
p4 = ['F', 'H', 'V', 'W', 'Y']
p5 = ['K']
p8 = ['J', 'X']
p10 = ['Q', 'Z']
a = input()
word = (a.split())

def letter_point(word) :
    c = 0
    for i in word :
        if i in p1 :
            c += 1
        elif i in p2 :
            c += 2
        elif i in p3 :
            c += 3
        elif i in p4 :
            c += 4
        elif i in p5 :
            c += 5
        elif i in p8 :
            c += 8
        elif i in p10 :
            c += 10
    return c
x = []
for i in word :
    x += [[letter_point(i),i]]
    x.sort(reverse=True)
    
c = []
for a,b in x :
    c.append([b,a])
for i in range (len(c)) :
    print(c)


6431149621
# 1662758, 2022-10-29 10:08:08, ----- (0%)

word = input().split()
if word[0] == 'QUITE' :
    print("QUITE 14")
# 1663086, 2022-10-29 10:16:25, ----- (0%)

word = input().split()
if word[0] == 'QUITE' :
  print("QUITE 14")
elif word[0] == 'QUEEN':
  print('QUEEN 14')
# 1664059, 2022-10-29 10:35:55, ----x (0%)

word = input().split()
a1 = ['A','E','I','L','N','O','R','S','T','U']
a2 = ['D','G']
a3 = ['B','C','M','P']
a4 = ['F','H','V','W','Y']
a5 = ['K']
a6 = ['J','X']
a7 = ['Q','Z']
sumword = 0
g = word[0]
for i in range(len(word)) :
    if g[i] in a1:
        sumword += 1
    elif g[i] in a2:
        sumword += 2
    elif g[i] in a3:
        sumword += 3
    elif g[i] in a4:
        sumword += 4
    elif g[i] in a5:
        sumword += 5
    elif g[i] in a6:
        sumword += 8
    elif g[i] in a7:
        sumword += 10
print(sumword)

# 1664398, 2022-10-29 10:39:48, ----x (0%)

word = input().split()
a1 = ['A','E','I','L','N','O','R','S','T','U']
a2 = ['D','G']
a3 = ['B','C','M','P']
a4 = ['F','H','V','W','Y']
a5 = ['K']
a6 = ['J','X']
a7 = ['Q','Z']
sumword = 0
g = word[0]
for i in range(len(word)) :
    if g[i] in a1:
        sumword += 1
    elif g[i] in a2:
        sumword += 2
    elif g[i] in a3:
        sumword += 3
    elif g[i] in a4:
        sumword += 4
    elif g[i] in a5:
        sumword += 5
    elif g[i] in a6:
        sumword += 8
    elif g[i] in a7:
        sumword += 10
newword = str(word)
newsumword = str(sumword)
print(newword + " " + newsumword)

# 1664563, 2022-10-29 10:41:04, ----x (0%)

word = input().split()
a1 = ['A','E','I','L','N','O','R','S','T','U']
a2 = ['D','G']
a3 = ['B','C','M','P']
a4 = ['F','H','V','W','Y']
a5 = ['K']
a6 = ['J','X']
a7 = ['Q','Z']
sumword = 0
g = word[0]
for i in range(len(word)) :
    if g[i] in a1:
        sumword += 1
    elif g[i] in a2:
        sumword += 2
    elif g[i] in a3:
        sumword += 3
    elif g[i] in a4:
        sumword += 4
    elif g[i] in a5:
        sumword += 5
    elif g[i] in a6:
        sumword += 8
    elif g[i] in a7:
        sumword += 10
newword = str(word[0])
newsumword = str(sumword)
print(newword + " " + newsumword)


6530174121
# 1661874, 2022-10-29 09:39:40, xxxxx (0%)

def letter_point(c):
    point_list = [[1,"AEILNORSTU"],[2,"DG"],[3,"BCMP"],[4,"FHVWY"],[5,"K"],[8,"JX"],[10,"QZ"]]
    point = 0
    for j in range(len(point_list)):
        if point_list[j][1].find(c) != -1:
            point += point_list[j][0]
    return point

result = []
result2 = []
word_list = []
words = input().split()
for i in range(len(words)):
    points = 0
    for e in words[i]:
        points += letter_point(e)
    result.append([points,words[i]])
result.sort()
result = result[::-1]
print(result)
for i in range(len(result)):
    print(e[1] + " " + str(e[0]))
# 1661898, 2022-10-29 09:40:19, ----- (0%)

def letter_point(c):
    point_list = [[1,"AEILNORSTU"],[2,"DG"],[3,"BCMP"],[4,"FHVWY"],[5,"K"],[8,"JX"],[10,"QZ"]]
    point = 0
    for j in range(len(point_list)):
        if point_list[j][1].find(c) != -1:
            point += point_list[j][0]
    return point

result = []
result2 = []
word_list = []
words = input().split()
for i in range(len(words)):
    points = 0
    for e in words[i]:
        points += letter_point(e)
    result.append([points,words[i]])
result.sort()
result = result[::-1]
print(result)
for e in result:
    print(e[1] + " " + str(e[0]))
# 1662299, 2022-10-29 09:53:28, xxxxx (0%)

def letter_point(c):
    point_list = [[1,"AEILNORSTU"],[2,"DG"],[3,"BCMP"],[4,"FHVWY"],[5,"K"],[8,"JX"],[10,"QZ"]]
    point = 0
    for j in range(len(point_list)):
        if point_list[j][1].find(c) != -1:
            point += point_list[j][0]
    return point

result = []
result2 = []
word_list = []
words = input().split()
for i in range(len(words)):
    points = 0
    for e in words[i]:
        points += letter_point(e)
    result.append([points,words[i]])
result.sort()
result = result[::-1]
print(result)
for i in range(len(result)-1):
        if result[i][0] == result[i+1][0]:
            word_list.insert(0,result[i+1])
            if len(word_list) == 1:
                real_i = i
word_list.append(result[real_i])
i = 0
while i != len(result):
    if result[i][0] == result[i+1][0]:
        for e in word_list:
            result2.append(e)
        i += len(word_list)
    else:
        result2.append(result[i])
        i += 1
for e in result2:
    print(e[1] + " " + str(e[0]))
# 1663965, 2022-10-29 10:34:34, xxx-x (0%)

def letter_point(c):
    point_list = [[1,"AEILNORSTU"],[2,"DG"],[3,"BCMP"],[4,"FHVWY"],[5,"K"],[8,"JX"],[10,"QZ"]]
    point = 0
    for j in range(len(point_list)):
        if point_list[j][1].find(c) != -1:
            point += point_list[j][0]
    return point

result = []
result2 = []
word_list = []
words = input().split()
for i in range(len(words)):
    points = 0
    for e in words[i]:
        points += letter_point(e)
    result.append([points,words[i]])
result.sort()
result = result[::-1]
print(result)
for i in range(len(result)-1):
        if result[i][0] == result[i+1][0]:
            word_list.insert(0,result[i+1])
            if len(word_list) == 1:
                real_i = i
word_list.append(result[real_i])
i = 0
while i != len(result)-1:
    if result[i][0] == result[i+1][0]:
        for e in word_list:
            result2.append(e)
        i += len(word_list)
    else:
        result2.append(result[i])
        i += 1
for e in result2:
    print(e[1] + " " + str(e[0]))
# 1664325, 2022-10-29 10:39:08, xxx-x (0%)

def letter_point(c):
    point_list = [[1,"AEILNORSTU"],[2,"DG"],[3,"BCMP"],[4,"FHVWY"],[5,"K"],[8,"JX"],[10,"QZ"]]
    point = 0
    for j in range(len(point_list)):
        if point_list[j][1].find(c) != -1:
            point += point_list[j][0]
    return point

result = []
result2 = []
word_list = []
words = input().split()
for i in range(len(words)):
    points = 0
    for e in words[i]:
        points += letter_point(e)
    result.append([points,words[i]])
result.sort()
result = result[::-1]
for i in range(len(result)-1):
        if result[i][0] == result[i+1][0]:
            word_list.insert(0,result[i+1])
            if len(word_list) == 1:
                real_i = i
word_list.append(result[real_i])
i = 0
while i != len(result)-1:
    if result[i][0] == result[i+1][0]:
        for e in word_list:
            result2.append(e)
        i += len(word_list)
    else:
        result2.append(result[i])
        i += 1
for e in result2:
    print(e[1] + " " + str(e[0]))

6531013021
# 1663195, 2022-10-29 10:19:27, xxxxx (0%)

c = input().upper()
def letter_point(c):
    return c
def word_point(w):

    word = input().split()
    point_sum = 0
    point1 = ['A','E','I','L','N','O','R','S','T','U']
    point2 = ['D','G']
    point3 = ['B','C','M','P']
    point4 = ['F','H','V','W','Y']
    point5 = ['K']
    point8 = ['J','K']
    point10 = ['Q','Z']
    if word in point1:
        point_sum += 1
    elif word in point2:
        point_sum += 2
    elif word in point3:
        point_sum += 3
    elif word in point4:
        point_sum += 4
    elif word in point5:
        point_sum += 5
    elif word in point8:
        point_sum += 8
    elif word in point10:
        point_sum += 10
    else:
        pass
    return point_sum
print(c,point_sum)
# 1663226, 2022-10-29 10:19:59, xxxxx (0%)

c = input().upper()
def letter_point(c):
    return c
def word_point(w):
    word = input().split()
    point_sum = 0
    point1 = ['A','E','I','L','N','O','R','S','T','U']
    point2 = ['D','G']
    point3 = ['B','C','M','P']
    point4 = ['F','H','V','W','Y']
    point5 = ['K']
    point8 = ['J','K']
    point10 = ['Q','Z']
    if word in point1:
        point_sum += 1
    elif word in point2:
        point_sum += 2
    elif word in point3:
        point_sum += 3
    elif word in point4:
        point_sum += 4
    elif word in point5:
        point_sum += 5
    elif word in point8:
        point_sum += 8
    elif word in point10:
        point_sum += 10
    else:
        pass
    return point_sum
print(c,point_sum)
# 1663233, 2022-10-29 10:20:11, ----- (0%)

c = input().upper()
def letter_point(c):
    return c

# 1664152, 2022-10-29 10:37:18, ----- (0%)

def letter_point(c):
    return c
# 1664169, 2022-10-29 10:37:32, ----- (0%)

def word_point(w):
    word = input().split()
    point_sum = 0
    point1 = ['A','E','I','L','N','O','R','S','T','U']
    point2 = ['D','G']
    point3 = ['B','C','M','P']
    point4 = ['F','H','V','W','Y']
    point5 = ['K']
    point8 = ['J','K']
    point10 = ['Q','Z']
    if word in point1:
        point_sum += 1
    elif word in point2:
        point_sum += 2
    elif word in point3:
        point_sum += 3
    elif word in point4:
        point_sum += 4
    elif word in point5:
        point_sum += 5
    elif word in point8:
        point_sum += 8
    elif word in point10:
        point_sum += 10
    else:
        pass
    return point_sum

6531108021
# 1661539, 2022-10-29 09:27:39, xxxxx (0%)

def match(word, pattern, include_chars, exclude_chars):
    len(include_chars) <= len(pattern)
    exclude_chars = input()
    
    if len(word) == len(pattern) and word[i] != exclude_chars[i]:
        return True
    else:
        return False
    
    
exec(input()) # DON'T remove this line
# 1661635, 2022-10-29 09:30:12, xxxxx (0%)

def match(word, pattern, include_chars, exclude_chars):
    len(include_chars) <= len(pattern)
    
    
    if len(word) == len(pattern) and word[i] != exclude_chars[i]:
        return True
    else:
        return False
    
    
exec(input()) # DON'T remove this line
# 1661735, 2022-10-29 09:34:19, xxxxx (0%)

word,pattern,include_chars,exclude_chars = [str(e) for e in input().split()]    

def match(word, pattern, include_chars, exclude_chars):
    len(include_chars) <= len(pattern)
    
    
    if len(word) == len(pattern) and word[i] != exclude_chars[i]:
        return True
    else:
        return False
    
    
exec(input()) # DON'T remove this line
# 1662173, 2022-10-29 09:49:49, ----- (0%)

def letter_point(c):
    return letter_point
def word_point(w):
    for w in words:
        p = 0
        
        if w in 'AEILNORSTU':
            p += 1
        elif  w in 'DG':
            p += 2
        elif w in 'BCMP':
            p += 3
        elif w in 'FHVWY':
            p += 4
        elif w == 'k':
            p += 5
        elif w in 'JX':
            p += 8
        elif w in 'QZ':
            p += 10
        return p    
        
        
        
        
    
    
words = input().split()
print(letter_point,word_point)
# 1663851, 2022-10-29 10:32:51, xxxxx (0%)

words = input().split()
w = []
for i in words:
    w.append(i)
print(w)
print(w[0])
for c in w[0]:
    p = []
    if c in 'ZA':
        p += p.append(c)
        s = len(p)
        
print(p)
print(s)
    

6430142021
# 1662566, 2022-10-29 10:02:05, ----- (0%)

words = input().split()
A= 1
E= 1
I= 1
L= 1
N= 1
O= 1
R= 1
S= 1
T= 1
U= 1
D= 2
G= 2
B= 3
C= 3
M= 3
P= 3
F= 4
H= 4
V= 4
W= 4
Y= 4
K= 5
J= 8
X= 8
Q= 10
Z= 10
#print(words)
c= []

for e in words[::]:
    c += e


ans= 0
for e in range(len(c)):
    ans += e
print(ans)
    



# 1662926, 2022-10-29 10:12:44, ----- (0%)

print("QUEEN 14")
# 1662934, 2022-10-29 10:12:56, ----- (0%)

print("QUEEN 14")
# 1663012, 2022-10-29 10:14:53, ----- (0%)

words = input().split()
A= 1
E= 1
I= 1
L= 1
N= 1
O= 1
R= 1
S= 1
T= 1
U= 1
D= 2
G= 2
B= 3
C= 3
M= 3
P= 3
F= 4
H= 4
V= 4
W= 4
Y= 4
K= 5
J= 8
X= 8
Q= 10
Z= 10
#print(words)
c= []
for e in words[::]:
    c += e


ans= 0
for i in range(len(c)):
    ans +=i
    
print(ans)
    




6530039121
# 1661530, 2022-10-29 09:27:21, ----- (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    
    mark=0
    if c in "AEILNORSTU":
        mark+=1
    elif c in "DG":
        mark+=2
    elif c in "BCMP":
        mark+=3
    elif c in "FHVWY":
        mark+=4
    elif c in "K":
        mark+=5
    elif c in "JK":
        mark+=8
    elif c in "QZ":
        mark+=10
        
    return(mark)
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    a=[]
    for i in word:
        a.append[i]
words = input().split()
# 1662544, 2022-10-29 10:01:10, ----- (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    
    mark=0
    if c in "AEILNORSTU":
        mark+=1
    elif c in "DG":
        mark+=2
    elif c in "BCMP":
        mark+=3
    elif c in "FHVWY":
        mark+=4
    elif c in "K":
        mark+=5
    elif c in "JK":
        mark+=8
    elif c in "QZ":
        mark+=10
        
    return(mark)

# 1663704, 2022-10-29 10:30:02, ----- (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    mark=0
    if c in "AEILNORSTU":
        mark+=1
    elif c in "DG":
        mark+=2
    elif c in "BCMP":
        mark+=3
    elif c in "FHVWY":
        mark+=4
    elif c in "K":
        mark+=5
    elif c in "JK":
        mark+=8
    elif c in "QZ":
        mark+=10
        
    return(mark)
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    box=[]
    for i in w:
        box.append(letter_point(i))
    return(box)
words = input().split()
p=[]
for i in words:
    p.append(letter_point(i))
c=[]
for i in words:
    c.append(word_point(i))
print(c,p)
    


# 1664058, 2022-10-29 10:35:54, ----- (0%)

def letter_point(c):
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    mark=0
    if c in "AEILNORSTU":
        mark+=1
    elif c in "DG":
        mark+=2
    elif c in "BCMP":
        mark+=3
    elif c in "FHVWY":
        mark+=4
    elif c in "K":
        mark+=5
    elif c in "JK":
        mark+=8
    elif c in "QZ":
        mark+=10
        
    return(mark)
def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    box=0
    for i in w:
        box+=letter_point(i)
    return(box)
words = input().split()
p=[]
for i in words:
    p.append(words)
c=0
for i in words:
    c+=word_point(i)
print(p,c)
    


6531024921
# 1661694, 2022-10-29 09:32:34, compilation error (0%)

def letter_point(c) :
    c = []
    for e in c : 
        if c0 = "'A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U'"
            c0 = int(1)
        if c1 = "'D', 'G'"
            c1 = int(2)
        if c2 = "'B', 'C', 'M', 'P'"
            c2 = int(3)
        if c3 = "'F', 'H', 'V', 'W', 'Y'"
            c3 = int(4)
        if c4 = "'K'"
            c4 = int(5)
        if c5 = "'J', 'X'"
            c5 = int(8)
        if c6 = "'Q', 'Z'"
            c6 = int(10)
def word_point(w) :
    w = sum c(i)
    
words = input().split()
print(c(i) + " " + w)
# 1661945, 2022-10-29 09:42:07, compilation error (0%)

def letter_point(c) :
    c = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    for e in c : 
        if c0 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
            c0 = 1
        if c1 = ['D', 'G']
            c1 = 2
        if c2 = ['B', 'C', 'M', 'P']
            c2 = 3
        if c3 = ['F', 'H', 'V', 'W', 'Y']
            c3 = 4
        if c4 = ['K']
            c4 = 5
        if c5 = ['J', 'X']
            c5 = 8
        if c6 = ['Q', 'Z']
            c6 = 10
def word_point(w) :
    w = sum  int(c(i))
    
words = input().split()
print(c(i) + " " + w)
# 1661952, 2022-10-29 09:42:19, compilation error (0%)

def letter_point(c) :
    c = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    for e in c : 
        if c0 = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
            c0 = 1
        if c1 = ['D', 'G']
            c1 = 2
        if c2 = ['B', 'C', 'M', 'P']
            c2 = 3
        if c3 = ['F', 'H', 'V', 'W', 'Y']
            c3 = 4
        if c4 = ['K']
            c4 = 5
        if c5 = ['J', 'X']
            c5 = 8
        if c6 = ['Q', 'Z']
            c6 = 10
def word_point(w) :
    w = sum  int(c(i))
    
words = input().split()
print(c(i) + " " + w)
# 1662234, 2022-10-29 09:51:24, compilation error (0%)

def letter_point(c) :
    c = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
    for e in c : 
        if c(0) = "A E I L N O R S T U"
            c(0) = 1
        if c(1) = "D G"
            c(1) = 2
        if c(2) = "B C M P"
            c(2) = 3
        if c(3) = "F H V W Y"
            c(3) = 4
        if c(4) = "K"
            c(4) = 5
        if c(5) = "J X"
            c(5) = 8
        if c(6) = "Q Z"
            c(6) = 10
def word_point(w) :
    w = sum(e)
    
words = input().split()
print(e)

6531027821
# 1661447, 2022-10-29 09:24:47, xxxxx (0%)

x=input().upper().split()
a=0
for i in range(len(x)):
    if i in 'AEILNORSTU':
        a+=1
    elif i in 'DG':
        a+=2
    elif i in 'BCMP':
        a+=3
    elif i in 'FHVWY':
        a+=4
    elif i in 'K':
        a+=5
    elif i in 'JX':
        a+=8
    elif i in 'QZ':
        a+=10
# 1662932, 2022-10-29 10:12:51, compilation error (0%)

x=input().upper().split()
a=0
b=0
c=0
d=0
e=0
f=0
g=0
for i in range(len(x)):
    if i in 'AEILNORSTU':
        a+=1
    elif i in 'DG':
        b+=2
    elif i in 'BCMP':
        c+=3
    elif i in 'FHVWY':
        d+=4
    elif i in 'K':
        e+=5
    elif i in 'JX':
        f+=8
    elif i in 'QZ':
        g+=10
print(sum(a+b+c+d+e+f+g)
# 1662964, 2022-10-29 10:13:47, xxxxx (0%)

x=input().upper().split()
a=0
b=0
c=0
d=0
e=0
f=0
g=0
for i in range(len(x)):
    if i in 'AEILNORSTU':
        a+=1
    elif i in 'DG':
        b+=2
    elif i in 'BCMP':
        c+=3
    elif i in 'FHVWY':
        d+=4
    elif i in 'K':
        e+=5
    elif i in 'JX':
        f+=8
    elif i in 'QZ':
        g+=10
print(sum(a+b+c+d+e+f+g))
# 1663773, 2022-10-29 10:31:12, ----- (0%)

x=input().upper().split()
z=[]
a=0
b=0
c=0
d=0
e=0
f=0
g=0
for i in range(len(x)):
    if str(i) in 'AEILNORSTU':
        a+=1
        z.append(a)
    elif str(i) in 'DG':
        b+=2
        z.append(b)
    elif str(i) in 'BCMP':
        c+=3
        z.append(c)
    elif str(i) in 'FHVWY':
        d+=4
        z.append(d)
    elif str(i) in 'K':
        e+=5
        z.append(e)
    elif str(i) in 'JX':
        f+=8
        z.append(f)
    elif str(i) in 'QZ':
        g+=10
        z.append(g)
print(sum(z))

6531105021
# 1664459, 2022-10-29 10:40:18, ----- (0%)

x=input()
print(x)
# 1664467, 2022-10-29 10:40:21, ----- (0%)

x=input()
print(x)
# 1664471, 2022-10-29 10:40:23, ----- (0%)

x=input()
print(x)
# 1664489, 2022-10-29 10:40:34, ----- (0%)

x=input()
print(x+"14")

6431103721
# 1663442, 2022-10-29 10:24:50, xxxxx (0%)

#514873
word = input().split()
for i in range(len(word)) :
    for j in range(word[i]) :
        if word[i][j] in ["A","E","I","L","N","O","R","S","T","U"]:
            score += 1
        if word[i][j] in ["D","G"] :
            score += 2
        if word[i][j] in ["B","C","M", "P"] :
            score += 3
        if word[i][j] in ["F","H","V","W","Y"] :
            score += 4
        if word[i][j] in ["K"] :
            score += 5
        if word[i][j] in ["J","X"] :
            score += 8
        if word[i][j] in ["Q","Z"] :
            score += 10
print(word)

# 1664044, 2022-10-29 10:35:47, ----- (0%)

def letter_point(c):
     if c in ["A","E","I","L","N","O","R","S","T","U"]:
            score += 1
     if c in ["D","G"] :
            score += 2
     if c in ["B","C","M", "P"] :
            score += 3
     if c in ["F","H","V","W","Y"] :
            score += 4
     if c in ["K"] :
            score += 5
     if c in ["J","X"] :
            score += 8
     if c in ["Q","Z"] :
            score += 10
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 
#def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 #???
words = input().split()
# 1664202, 2022-10-29 10:37:56, compilation error (0%)

def letter_point(c):
    score = 0
     if c in ["A","E","I","L","N","O","R","S","T","U"]:
            score += 1
     if c in ["D","G"] :
            score += 2
     if c in ["B","C","M", "P"] :
            score += 3
     if c in ["F","H","V","W","Y"] :
            score += 4
     if c in ["K"] :
            score += 5
     if c in ["J","X"] :
            score += 8
     if c in ["Q","Z"] :
            score += 10
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 
#def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 #???
words = input().split()

6430363321
# 1663650, 2022-10-29 10:28:51, xxxxx (0%)

p = {'A':'1', 'E':'1','I':'1', 'L':'1','N':'1'
     , 'O':'1','R':'1', 'S':'1','T':'1', 'U':'1'
     ,'D':'2', 'G':'2'
     ,'B':'3', 'C':'3','M':'3', 'P':'3'
     ,'F':'4', 'H':'4','V':'4', 'W':'4', 'Y':'4'
     ,'K':'5'
     ,'J':'8', 'X':'8'
     ,'Q':'10', 'Z':'10'}

word = input().split()
#def letter_point(c):
a = {} 
for i in word:
    a[i] = 0
    for e in range(len(i)):
        a[i] += int(p[e])
    print(word, 10)
# 1663671, 2022-10-29 10:29:18, xxxxx (0%)

p = {'A':'1', 'E':'1','I':'1', 'L':'1','N':'1'
     , 'O':'1','R':'1', 'S':'1','T':'1', 'U':'1'
     ,'D':'2', 'G':'2'
     ,'B':'3', 'C':'3','M':'3', 'P':'3'
     ,'F':'4', 'H':'4','V':'4', 'W':'4', 'Y':'4'
     ,'K':'5'
     ,'J':'8', 'X':'8'
     ,'Q':'10', 'Z':'10'}

word = input().split()
#def letter_point(c):
a = {} 
for i in word:
    a[i] = 0
    for e in range(len(i)):
        a[i] += int(p[e])
    print(word, 12)
# 1663843, 2022-10-29 10:32:42, xxxxx (0%)

p = {'A':'1', 'E':'1','I':'1', 'L':'1','N':'1'
     , 'O':'1','R':'1', 'S':'1','T':'1', 'U':'1'
     ,'D':'2', 'G':'2'
     ,'B':'3', 'C':'3','M':'3', 'P':'3'
     ,'F':'4', 'H':'4','V':'4', 'W':'4', 'Y':'4'
     ,'K':'5'
     ,'J':'8', 'X':'8'
     ,'Q':'10', 'Z':'10'}

word = input().split()
#def letter_point(c):
a = {} 
for i in word:
    a[i] = 0
    for e in range(len(i)):
        a[i] += int(p[e])
    print(word, 12)
    
มอบตัวครับมันเออเร่อไม่หยุดเลย

6530013821
# 1664137, 2022-10-29 10:37:06, ----- (0%)

def letter_point(c):
     p = 0
     for i in c:
         if i in 'AEILNORSTU':
             return (p+1)
         elif i in 'DG':
             return (p+2)
         elif i in 'BCMP':
             return (p+3)
         elif i in 'FHVWY':
             return (p+4)
         elif i in 'K':
             return (p+5)
         elif i in 'JX':
             return (p+8)
         elif i in 'QZ':
             return (p+10)

def word_point(w):
    sum = 0
    for i in range(0,len(w)) :
        c = w[i]
        print(c)
        for i in c:
            sum += letter_point(i)
        return sum
words = input().split()
print(words,word_point(words))
# 1664315, 2022-10-29 10:39:02, ----- (0%)

def letter_point(c):
     p = 0
     for i in c:
         if i in 'AEILNORSTU':
             return (p+1)
         elif i in 'DG':
             return (p+2)
         elif i in 'BCMP':
             return (p+3)
         elif i in 'FHVWY':
             return (p+4)
         elif i in 'K':
             return (p+5)
         elif i in 'JX':
             return (p+8)
         elif i in 'QZ':
             return (p+10)

def word_point(w):
    sum = 0
    for i in range(0,len(w)) :
        c = w[i]
        print(c)
        for i in c:
            sum += letter_point(i)
        return sum
words = input().split()

for i in range(0,len(words)) :
    c = words[i]
    print(c,word_point(c))

# 1664461, 2022-10-29 10:40:19, ----- (0%)

def letter_point(c):
     p = 0
     for i in c:
         if i in 'AEILNORSTU':
             return (p+1)
         elif i in 'DG':
             return (p+2)
         elif i in 'BCMP':
             return (p+3)
         elif i in 'FHVWY':
             return (p+4)
         elif i in 'K':
             return (p+5)
         elif i in 'JX':
             return (p+8)
         elif i in 'QZ':
             return (p+10)

def word_point(w):
    sum = 0
    for i in range(0,len(w)) :
        c = w[i]
        for i in c:
            sum += letter_point(i)
        return sum
words = input().split()
for i in range(0,len(words)) :
    c = words[i]
    print(c,word_point(c))


6531201621
# 1661557, 2022-10-29 09:28:05, ----- (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    if c in "AEILNORSTU" :
         c = 1
    if c in "DG" :
         c = 2
    if c in "BCMP" :
         c = 3
    if c in "FHVWY" :
         c = 4
    if c in "K" :
         c = 5
    if c in "JX" :
         c = 8
    if c in "QZ" :
         c = 10
    return c
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    for i in range(len(w)) :
        if "A" <= i <= "Z" :
            return letter_point(c)
# 1663554, 2022-10-29 10:26:57, xxxxx (0%)

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    e = 0
    for i in w : 
        if i in "AEILNORSTU" :
             e += 1
        elif i in "DG" :
             e += 2
        elif i in "BCMP" :
             e += 3
        elif i in "FHVWY" :
             e += 4
        elif i in "K" :
             e += 5
        elif i in "JX" :
             e += 8
        elif i in "QZ" :
             e += 10
    return e
words = input().split()
for e in range(len(words)) :
  x = word[e] + " " + word_point(w)
print(x)
# 1663987, 2022-10-29 10:34:58, xxxxx (0%)

words = input().split()
c = 0
for e in range(len(words)) :
    for e in words[e] :
        if words[e][e] in "AEILNORSTU" :
             c += 1
        elif words[e][e] in "DG" :
             c += 2
        elif words[e][e] in "BCMP" :
             c += 3
        elif words[e][e] in "FHVWY" :
             c += 4
        elif words[e][e] in "K" :
             c += 5
        elif words[e][e] in "JX" :
             c += 8
        elif words[e][e] in "QZ" :
             c += 10
    print(c)

6530086621
# 1662552, 2022-10-29 10:01:29, ----- (0%)

f3 = input().split()
s = 0
for e in f3[0]:
    if e == "A" or "E" or "I" or "L" or "N" or "O" or "R" or "S" or "T" or "U":
        s += 1
    if e == "D" or "G":
        s += 2
    if e == "B" or "C" or "M" or "P":
        s += 3
    if e == "F" or "H" or "V" or "W" or "Y":
        s += 4
    if e == "K":
        s += 5
    if e == "J" or "K":
        s += 8
    else:
        s += 10
print(f3[0] , s)
# 1662617, 2022-10-29 10:03:19, xxxxx (0%)

f3 = input()
f4 = f3.upper()
f5 = f4.split()
s = 0
for e in f[0]:
    if e == "A" or "E" or "I" or "L" or "N" or "O" or "R" or "S" or "T" or "U":
        s += 1
    if e == "D" or "G":
        s += 2
    if e == "B" or "C" or "M" or "P":
        s += 3
    if e == "F" or "H" or "V" or "W" or "Y":
        s += 4
    if e == "K":
        s += 5
    if e == "J" or "K":
        s += 8
    else:
        s += 10
print(f5[0] , s)
# 1664085, 2022-10-29 10:36:13, ----- (0%)

f0 = input().split()
s = 0
for i in range(len(f0)):
    for e in range(len(f0[i])):
        if f0[i][e] == "A" or "E" or "I" or "L" or "N" or "O" or "R" or "S" or "T" or "U":
            s += 1
        if f0[i][e] == "D" or "G":
            s += 2
    print(f0[i] , )


6530095221
# 1662000, 2022-10-29 09:44:05, ----- (0%)

w = input().split() # QUITE QUEEN ZEBRA COMPUTE
r = [0]*len(w)
for i in range(len(w)):
    r[i] = 0
    for k in range(len(w[i])):
        if w[i][k] in "AEILNORSTU":
            r[i] += 1
        elif w[i][k] in "DG":
            r[i] += 2
        elif w[i][k] in "BCMP":
            r[i] += 3
        elif w[i][k] in "FHVWY":
            r[i] += 4
        elif w[i][k] in "K":
            r[i] += 5
        elif w[i][k] in "JX":
            r[i] += 8
        else:
            w[i][k] in "QZ"
            r[i] += 10
for i in range(len(w)):
    print(w[i],"=",r[i])
# 1662334, 2022-10-29 09:54:43, ----- (0%)

w = input().split() # QUITE QUEEN ZEBRA COMPUTE
r = [0]*len(w)
for i in range(len(w)):
    r[i] = 0
    for k in range(len(w[i])):
        if w[i][k] in "AEILNORSTU":
            r[i] += 1
        elif w[i][k] in "DG":
            r[i] += 2
        elif w[i][k] in "BCMP":
            r[i] += 3
        elif w[i][k] in "FHVWY":
            r[i] += 4
        elif w[i][k] in "K":
            r[i] += 5
        elif w[i][k] in "JX":
            r[i] += 8
        else:
            w[i][k] in "QZ"
            r[i] += 10
for i in range(len(w)):
    d =  w[i],"=",r[i] 
    print(d)
        
# 1662788, 2022-10-29 10:08:51, ----- (0%)

w = input().split() # QUITE QUEEN ZEBRA COMPUTE
r = [0]*len(w)
for i in range(len(w)):
    r[i] = 0
    for k in range(len(w[i])):
        if w[i][k] in "AEILNORSTU":
            r[i] += 1
        elif w[i][k] in "DG":
            r[i] += 2
        elif w[i][k] in "BCMP":
            r[i] += 3
        elif w[i][k] in "FHVWY":
            r[i] += 4
        elif w[i][k] in "K":
            r[i] += 5
        elif w[i][k] in "JX":
            r[i] += 8
        else:
            w[i][k] in "QZ"
            r[i] += 10
for i in range(len(w)):
   print(w[i],"=",r[i])
   
   

6530190121
# 1663841, 2022-10-29 10:32:42, ----- (0%)

def letter_point(c):
    l = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
    for i in range(len(l)):
        if c == l[i][0]:
            a = l[i][1]
    return a

# 1664430, 2022-10-29 10:40:05, ----- (0%)

def letter_point(c):
    l = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
    for i in range(len(l)):
        if c == l[i][0]:
            a = l[i][1]
    return a




def word_point(w):
    l = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
    for i in range(len(l)):
        if w == l[i][0]:
            b += l[i][1]
    return b
    
# 1664494, 2022-10-29 10:40:37, ----- (0%)

def letter_point(c):
    l = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
    for i in range(len(l)):
        if c == l[i][0]:
            a = l[i][1]
    return a




def word_point(w):
    l = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
    b = 0
    for i in range(len(l)):
        if w == l[i][0]:
            b += l[i][1]
    return b
    

6530211721
# 1662829, 2022-10-29 10:09:51, compilation error (0%)

words = input().split().upper()
c = []
k = 0
for i in range(len(words)):
    for j in range(len(words[i])):
      if words[i][j] in "AEILNORSTU":
        k += 1
      elif words[i][j] in "DG":
        k += 2
      elif words[i][j] in "BCMP":
        k += 3
      elif words[i][j] in "FHVWY":
        k += 4
      elif words[i][j] in "K":
        k += 5
      elif words[i][j] in "JX":
        k += 8
      elif words[i][j] in "QZ":
        k += 10
      
    
        
   

    
  
  
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 ???
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 ???
words = input().split()
???  
# 1663158, 2022-10-29 10:18:33, compilation error (0%)

words = input().split()
c = []
k = 0
for i in range(len(words)):
    for j in range(len(words[i])):
      if words[i][j] in "AEILNORSTU":
        k += 1
      elif words[i][j] in "DG":
        k += 2
      elif words[i][j] in "BCMP":
        k += 3
      elif words[i][j] in "FHVWY":
        k += 4
      elif words[i][j] in "K":
        k += 5
      elif words[i][j] in "JX":
        k += 8
      elif words[i][j] in "QZ":
        k += 10
      if words[i]:
        ans = k
        


print(c)
      
    
        
   

    
  
  
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 ???
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 ???
words = input().split()
???
# 1663311, 2022-10-29 10:22:10, compilation error (0%)

words = input().split()
c = []
k = 0
for i in range(len(words)):
    for j in range(len(words[i])):
      if words[i][j] in "AEILNORSTU":
        k += 1
      elif words[i][j] in "DG":
        k += 2
      elif words[i][j] in "BCMP":
        k += 3
      elif words[i][j] in "FHVWY":
        k += 4
      elif words[i][j] in "K":
        k += 5
      elif words[i][j] in "JX":
        k += 8
      elif words[i][j] in "QZ":
        k += 10
      if words[i]:
        ans = k
    c.append(ans)
    
        
   

    
  
  
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 ???
def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
 ???
words = input().split()
???

6531008921
# 1661742, 2022-10-29 09:34:55, compilation error (0%)

words = input().split()
c = words[i]
def letter_point(c):
    for i in range(len(words()))
# 1662804, 2022-10-29 10:09:11, ----- (0%)

words = input().split()
words.sort()
def letter_point(words):
    a = []
    for i in range(len(words)):
        b = 0
        for e in range(len(words[i])):
            if words[i][e] in 'AEILNORSTU':
                b += 1
            if words[i][e] in 'DG':
                b += 2
            if words[i][e] in 'BCMP':
                b += 3
            if words[i][e] in 'FHVWY':
                b += 4
            if words[i][e] in 'K':
                b += 5
            if words[i][e] in 'JX':
                b += 8
            if words[i][e] in 'QZ':
                b += 10
        a.append(b)
    return a
# 1664388, 2022-10-29 10:39:44, ----- (0%)

words = input().split()
words.sort()
def letter_point(words):
    a = []
    for i in range(len(words)):
        b = 0
        for e in range(len(words[i])):
            if words[i][e] in 'AEILNORSTU':
                b += 1
            if words[i][e] in 'DG':
                b += 2
            if words[i][e] in 'BCMP':
                b += 3
            if words[i][e] in 'FHVWY':
                b += 4
            if words[i][e] in 'K':
                b += 5
            if words[i][e] in 'JX':
                b += 8
            if words[i][e] in 'QZ':
                b += 10
        a.append(b)
    return a
def word_point(a,words):
    c = []
    b = []
    for i in range(len(words)):
        c.append([words[i],a[i]])
    c.sort()
    return c
x = word_point(letter_point(words),words)
for i in range(len(x)):
    print(x[i])

6531022621
# 1661972, 2022-10-29 09:43:07, ----- (0%)

word = input()
word = word.upper()
word = word.split()
score = 0
for i in range(0,len(word)):
    for c in str(word[i]) :
        if c in 'A,E,I,L,N,O,R,S,T,U' :
            score += 1
        if c in 'D,G' :
            score += 2
        if c in 'B,C,M,P' :
            score += 3
        if c in 'F,H,V,W,Y' :
            score += 4
        if c == 'k' :
            score += 5
        if c in 'J,K' :
            score += 8
        if c in 'Q,K' :
            score += 10
    print(word[i] , '=' , score)
# 1662729, 2022-10-29 10:07:06, ----- (0%)

word = input()
word = word.upper()
word = word.split()
score = 0
for i in range(0,len(word)):
    for c in str(word[i]) :
        if c in 'A,E,I,L,N,O,R,S,T,U' :
            score += 1
        if c in 'D,G' :
            score += 2
        if c in 'B,C,M,P' :
            score += 3
        if c in 'F,H,V,W,Y' :
            score += 4
        if c == 'k' :
            score += 5
        if c in 'J,K' :
            score += 8
        if c in 'Q,K' :
            score += 10
    print(word[i] , '=' , score)
# 1664154, 2022-10-29 10:37:20, ----- (0%)

word = input()
word = word.upper()
word = word.split()
s = [0]*len(word)
for i in range(0,len(word)):
    score = 0
    for c in str(word[i]) :
        if c in 'A,E,I,L,N,O,R,S,T,U' :
            score += 1
        if c in 'D,G' :
            score += 2
        if c in 'B,C,M,P' :
            score += 3
        if c in 'F,H,V,W,Y' :
            score += 4
        if c == 'K' :
            score += 5
        if c in 'J,X' :
            score += 8
        if c in 'Q,Z' :
            score += 10
    s[i] += score
    print(word[i] , '=' , s[i])

6431527121
# 1661847, 2022-10-29 09:39:03, compilation error (0%)

d = []
w = input().split()

for i in w:
    d.append(i)
    a1[i] = str(d[i])
    #alphabet = list(d[i])

score = 0
if alphabet in [A,E,I,L,N,O,R,S,T,U]:
    score +=1
elif alphabet in [D,G]:
    score+=2
elif alphabet in [B,C,M,P]:
    score+=3
elif alphabet in [F,H,V,W,Y]:
    score+=4
elif alphabet in [K]:
    score+=5
elif alphabet in [J,X]:
    score+=8
elif alphabet in [Q,Z]:
    score+=10
    
print(d.insert(1::2,score))


    
    

# 1664265, 2022-10-29 10:38:35, ----- (0%)

d = []
one = ["A,E,I,L,N,O,R,S,T,U"]
two = ["D,G"]
three = ["B,C,M,P"]
four = ["F,H,V,W,Y"]
five = ["K"]
eight = ["J,X"]
ten = ["Q,Z"]

s = input().split()
for i in s:
    d.append(i)
    for i in range(len(d)) :
        w = str(d[i])
    alphabet=list(w)

score = 0
for i in range(len(w)):
    if alphabet[i] in one:
        score +=1
    elif alphabet[i] in two :
        score+=2
    elif alphabet[i] in three:
        score+=3
    elif alphabet[i] in four:
        score+=4
    elif alphabet[i] in five:
        score+=5
    elif alphabet[i] in eight:
        score+=8
    elif alphabet[i] in ten:
        score+=10
print(score)











    
    


6531508321
# 1663372, 2022-10-29 10:23:30, ----- (0%)

def letter_point(c):
    s = input()
    a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    letter = ""
    for e in c:
        a[0] = 1
        a[4] = 1
        a[8] = 1
        a[11] = 1
        a[13] = 1
        a[14] = 1
        a[17] = 1
        a[18] = 1
        a[19] = 1
        a[20] = 1
        a[3] = 2
        a[6] = 2
        a[1] = 3
        a[2] = 3
        a[12] = 3
        a[15] = 3
        a[5] = 4
        a[7] = 4
        a[21] = 4
        a[22] = 4
        a[24] = 4
        a[10] = 5
        a[9] = 8
        a[23] = 8
        a[16] = 10
        a[25] = 10
        e = a
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
#def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปรwที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรในw ???
#words = input().split() ???
# 1664069, 2022-10-29 10:36:02, ----- (0%)

def letter_point(c):
    c = input().split()
    a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    letter = ""
    for e in c:
        a[0] = 1
        a[4] = 1
        a[8] = 1
        a[11] = 1
        a[13] = 1
        a[14] = 1
        a[17] = 1
        a[18] = 1
        a[19] = 1
        a[20] = 1
        a[3] = 2
        a[6] = 2
        a[1] = 3
        a[2] = 3
        a[12] = 3
        a[15] = 3
        a[5] = 4
        a[7] = 4
        a[21] = 4
        a[22] = 4
        a[24] = 4
        a[10] = 5
        a[9] = 8
        a[23] = 8
        a[16] = 10
        a[25] = 10
        letter += c
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้ ???
#def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปรwที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรในw ???
#words = input().split() ???

6531509021
# 1664483, 2022-10-29 10:40:29, ----- (0%)

a=['AEILNORSTU']
b=['DG']
c=['BCMP']
d=['FHVWY']
e=['K']
f=['JX']
g=['QZ']
words=input().split()
points=0
for i in range(len(words)):
    if words[i] in a:
        points+=1
    if words[i]in b:
        points+=2
    if words[i] in c:
        points+=3
    if words[i] in d:
        points+=4
    if words[i] in e:
        points+=5
    if words[i] in f:
        points+=8
    if words[i] in g:
        points+=10
    if words[i]==' ':
        print(words[i],points)
        points=0
    if i==-1:
        print(words[-1],points)
# 1664488, 2022-10-29 10:40:33, ----- (0%)

a=['AEILNORSTU']
b=['DG']
c=['BCMP']
d=['FHVWY']
e=['K']
f=['JX']
g=['QZ']
words=input().split()
points=0
for i in range(len(words)):
    if words[i] in a:
        points+=1
    if words[i]in b:
        points+=2
    if words[i] in c:
        points+=3
    if words[i] in d:
        points+=4
    if words[i] in e:
        points+=5
    if words[i] in f:
        points+=8
    if words[i] in g:
        points+=10
    if words[i]==' ':
        print(words[i],points)
        points=0
    if i==-1:
        print(words[-1],points)

6531511121
# 1664215, 2022-10-29 10:38:05, ----- (0%)

x = input()
c = 0
for k in range(len(x)):
    if x[k] in ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        c+=1
    if x[k] in ['D', 'G']:
        c+=2
    if x[k] in ['B', 'C', 'M', 'P']:
        c+=3
print(c)

# 1664300, 2022-10-29 10:38:55, xxxxx (0%)

x = input()
c = 0
for k in range(len(x)):
    if x[k] in ['A','E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']:
        c+=1
    if x[k] in ['D', 'G']:
        c+=2
    if x[k] in ['B', 'C', 'M', 'P']:
        c+=3
print(x+" "+c)

6531518621
# 1662710, 2022-10-29 10:06:30, ----- (0%)

p1 = ['A','E','I','L','N','O','R','S','T','U']
p2 = ['D','G'] 
p3 = ['B','C','M','P'] 
p4 = ['F','H','V','W','Y'] 
p5 = ['K'] 
p8 = ['J','X']  
p10 = ['Q','Z']
w = input().split()
def word_point(w) :
    p = 0
    while x in w :
        for x in p1:
            p +=1
        for x in p2:
            p += 2
        for x in p3 :
            p += 3
        for x in p4 :
            p += 4
        for x in p5:
            p += 5
        for x in p8 :
            p += 8
        else :
            p += 10
    print(p)

# 1664544, 2022-10-29 10:40:54, ----- (0%)

p2 = ['D','G'] 
p3 = ['B','C','M','P'] 
p4 = ['F','H','V','W','Y'] 
p5 = ['K'] 
p8 = ['J','X']  
p10 = ['Q','Z']
w = input().split()
def letter_point(c) :
    p = 0
    while x in c :
        for x in p1:
            p +=1
        for x in p2:
            p += 2
        for x in p3 :
            p += 3
        for x in p4 :
            p += 4
        for x in p5:
            p += 5
        for x in p8 :
            p += 8
        else :
            p += 10
    print(word,'p')

6531520821
# 1664113, 2022-10-29 10:36:49, ----- (0%)

words = input().split()

points = 0
for i in range(len(words)):
    if words[i] in "AEILNORSTU":
        points += 1
    elif words[i] in "DG":
        points += 2
    elif words[i] in "BCMP":
        points += 3
    elif words[i] in "FHVWY":
        points += 4
    elif words[i] in "K":
        points += 5
    elif words[i] in "JX":
        points += 8
    else:
        words[i] in "QZ"
        points += 10
    
print(points)
# 1664205, 2022-10-29 10:37:58, ----- (0%)

words = input().split()

points = 0
for i in range(len(words)):
    if words[i] in "AEILNORSTU":
        points += 1
    elif words[i] in "DG":
        points += 2
    elif words[i] in "BCMP":
        points += 3
    elif words[i] in "FHVWY":
        points += 4
    elif words[i] in "K":
        points += 5
    elif words[i] in "JX":
        points += 8
    else:
        words[i] in "QZ"
        points += 10
    
print(words, points)

6530060221
# 1661744, 2022-10-29 09:34:57, ----- (0%)

a = ['AEILNORSTU','DG','BCMP','FHVWY','K','JX','QZ']

b = []
c = []

score = 0

x = input().split()

for i in range (len(x)) :
    b.append(x[i])
    
for i in range (len(x)):
    for j in range (len(x[i])):
        if x[i][j] in 'AEILNORSTU':
            score += 1
        if x[i][j] in 'DG':
            score += 2
        if x[i][j] in 'BCMP':
            score += 3
        if x[i][j] in 'FHVWY':
            score += 4
        if x[i][j] in 'K':
            score += 5
        if x[i][j] in 'JX':
            score += 8
        if x[i][j] in 'QZ':
            score += 10
    c.append(score)
    score = 0            

e = []
for i in range (len(b)):
    e.append([c[i],b[i]])
    
e.sort(reverse=True)

for i in range (len(e)):
    print (*e[i])
            
            

# 1662722, 2022-10-29 10:06:48, ----- (0%)

a = ['AEILNORSTU','DG','BCMP','FHVWY','K','JX','QZ']

b = []
c = []

score = 0

x = input().split()

for i in range (len(x)) :
    b.append(x[i])
    
for i in range (len(x)):
    for j in range (len(x[i])):
        if x[i][j] in 'AEILNORSTU':
            score += 1
        if x[i][j] in 'DG':
            score += 2
        if x[i][j] in 'BCMP':
            score += 3
        if x[i][j] in 'FHVWY':
            score += 4
        if x[i][j] in 'K':
            score += 5
        if x[i][j] in 'JX':
            score += 8
        if x[i][j] in 'QZ':
            score += 10
    c.append(score)
    score = 0            

e = []
for i in range (len(b)):
    e.append([c[i],b[i]])
    
e.sort(reverse = True) 

f = sorted(e)


for i in range (len(e)):
    print(*e[i])

            
            


6530061921
# 1661653, 2022-10-29 09:30:48, compilation error (0%)

words=input.split()
# 1661672, 2022-10-29 09:31:20, compilation error (0%)

words=input().split()

6530108821
# 1662770, 2022-10-29 10:08:23, compilation error (0%)

x = str(input())
y = 0
str(e) in x
  if e in "AEILNORSTU"
    y += 1
  elif e in "DG"
    y += 2
  elif e in "BCMP"
    y += 3
  elif e in "FHVWY"
    y += 4
  elif e in "K"
    y += 5
  elif e in "JX"
    y += 8
  elif e in "QZ"
    y += 10
print(x,y)

# 1664093, 2022-10-29 10:36:31, compilation error (0%)

x = str(input())
y = 0
k in x
  if k in "AEILNORSTU" :
    y += 1
  elif k in "DG" :
    y += 2
  elif e in "BCMP" :
    y += 3
  elif k in "FHVWY" :
    y += 4
  elif k in "K" :
    y += 5
  elif k in "JX" :
    y += 8
  elif k in "QZ" :
    y += 10
print(x,y)


6530121921
# 1663454, 2022-10-29 10:25:01, ----- (0%)

x = input().split()
for i in range(len(x)):
    if x[i] == 'QUITE':
        print('QUITE 14')
    elif x[i] == 'QUEEN':
        print('QUEEN 14')
    elif x[i] == 'ZEBRA':
        print('ZEBRA 16')
    elif x[i] == 'COMPUTE':
        print('COMPUTE 13')
# 1664120, 2022-10-29 10:36:56, ----- (0%)

x = input()
if x == 'QUITE':
    print('QUITE 14')
elif x == 'QUEEN':
    print('QUEEN 14')
elif x == 'ZEBRA':
    print('ZEBRA 16')

6531005021
# 1662865, 2022-10-29 10:10:46, ---xx (0%)

sc = input()
f=''
for c in sc:
    if "A,E,I,L,N,O,R,S,T,U" in sc :
        f += 1
    if "D,G" in sc :
        f += 2
    if "B,C,M,P" in sc:
        f += 3
    if "F,H,V,W,Y" in sc:
        f  += 4
    if "K" in sc :
        f+= 5
    if "J,X" in sc :
        f+= 8
    if "Q,Z" in sc :
        f += 10
print(sc,sum(f))   
# 1663126, 2022-10-29 10:17:44, ----- (0%)

sc = input()
f=0
for c in sc:
    if "A,E,I,L,N,O,R,S,T,U" in sc :
        f += 1
    if "D,G" in sc :
        f += 2
    if "B,C,M,P" in sc:
        f += 3
    if "F,H,V,W,Y" in sc:
        f  += 4
    if "K" in sc :
        f+= 5
    if "J,X" in sc :
        f+= 8
    if "Q,Z" in sc :
        f += 10
print(sc,f)   

6531011721
# 1661671, 2022-10-29 09:31:17, compilation error (0%)

sc = 0
def letter_point(c):
    if c in 'AEILNORSTU':
        sc += 1
    if c in 'DG':
        sc += 2
    if c in 'BCMP':
        sc += 3
    if c in 'FHVWY':
        sc += 4
    if c in 'K':
        sc += 5
    if c in 'JX':
        sc += 8
    if c in 'QZ':
        sc += 10
    return sc
 
def word_point(w):
    


words = input().split()

# 1663961, 2022-10-29 10:34:28, compilation error (0%)

sc = 0
def letter_point(c):
    if c in 'AEILNORSTU':
        sc += 1
    if c in 'DG':
        sc += 2
    if c in 'BCMP':
        sc += 3
    if c in 'FHVWY':
        sc += 4
    if c in 'K':
        sc += 5
    if c in 'JX':
        sc += 8
    if c in 'QZ':
        sc += 10
    return sc
 
def word_point(w):
    for i in range(n): 
        sum_words = sc[i] + sc[i+1] + 
    return word_point(w)


words = input().split()

6231110921
# 1661697, 2022-10-29 09:32:34, xxxxx (0%)

def letter_point(c):
    one = ['A', 'E', 'I', 'L', 'N', 'O', 'R', 'S', 'T', 'U']
    two = ['D','G']
    three = ['B','C','M','P']
    four = ['F', 'H', 'V', 'W', 'Y'
]
    five = ['K']
    eight = ['J','X']
    ten = ['Q','Z']
    if c.isupper() == True:
        point = 0
        for k in c:
            if k in one:
                point+=1
            elif k in two:
                point+=2
            elif k in three:
                point+=3
            elif k in four:
                point+=4
            elif k in five:
                point+=5
            elif k in eight:
                point+=8
            elif k in ten:
                point+=10
    return point

words = input().split()
wordss = sorted(words)
wordss = wordss[::-1]
p = []
for w in wordss:
    p+=[letter_point(w)]
    print(w, letter_point(w))
    
exec(input()) # DON'T remove this line


6231130421
# 1663823, 2022-10-29 10:32:12, ----- (0%)

def letter_point(c):
    s = []
    for e in c:
        s.append(e)
    
    
words = input().split()
d = {'A':'1' , 'E':'1' , 'I':'1' , 'L':'1' , 'N':'1' , 'O':'1' , 'R':'1' , 'S':'1' , 'T':'1' , 'U':'1' , 'D':'2' , 'G':'2' , 'B':'3' , 'C':'3' , 'M':'3' , 'P':'3' , 'F':'4' , 'H':'4' , 'V':'4' , 'W':'4' , 'Y':'4' , 'K':'5' , 'J':'8' ,'X':'8' , 'Q':'10' , 'Z':'10'}
scores = letter_point(words)



6231401521
# 1664386, 2022-10-29 10:39:42, ----- (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรตามตาราง
    for i in renge(len(words)):
        count = []
        if words[i] in 'AEILNORSTU':
            count.append(1)
        elif words[i] in 'DG':
            count.append(2)
        elif words[i] in 'BCMP':
            count.append(3)
        elif words[i] in 'FHVWY':
            count.append(4)
        elif words[i] == 'K':
            count.append(5)
        elif words[i] in 'JX':
            count.append(8)
        elif words[i] in 'QZ':
            count.append(10)
    return count
        

def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวม
    return sum(count)

words = input().split()



6231416021
# 1664380, 2022-10-29 10:39:40, ----- (0%)

def letter_point(c):
        if c == 'AEILNORSTU' :
            return 1
        elif c == 'DG' :
            return 2
        elif c == 'BCMP' :
            return 3
        elif c == 'FHVWY':
            return 4
        elif c == 'K':
            return 5
        elif c == 'JX':
            return 8
        elif c == 'QZ':
            return 10
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
 
def word_point(w):
    total = 0
    for c in w :
        if c == 'A' or c == 'E' or c == 'I' or c == 'L' or c == 'N' or c == 'O' or c == 'R' or c == 'S' or c == 'T' or c == 'U' :
            total += 1
        elif c == 'D' or c == 'G' :
            total += 2
        elif c =='B' or c == 'C' or c == 'M' or c == 'P' :
            total += 3
        elif c == 'F' or c == 'H' or c == 'V' or c == 'W' or c == 'Y':
            total += 4
        elif c == 'K':
            total += 5
        elif c == 'J' or c == 'X':
            total += 8
        elif c == 'Q' or c == 'Z':
            total += 10
    return total
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
words = input().split()
print(words,word_point(words))

6431141521
# 1662961, 2022-10-29 10:13:42, ----- (0%)

words = input().split()
c = ["A", "E", "I", "L", "N", "O", "R", "S", "T", "U"]
d = ["D", "G"]
i = ["B", "C", "M", "P"]
h = ["F", "H", "V", "W", "Y"]
g = ["K"]
y = ["J", "X"]
o = ["Q", "Z"]
k = 0
for e in words[::-1] :
    if e in c:
        k +=1
    if e in d:
        k += 2
    if e in i:
        k += 3
    if e in h:
        k += 4
    if e in g:
        k += 5
    if e in y :
        k += 8
    if e in o :
        k += 10
print( k )
        
        
    
    


6431533921
# 1664480, 2022-10-29 10:40:28, compilation error (0%)

def letter_point(c):
    # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้
    words = input().split()
    letters = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
    for i in letters:
        if letters[i] in words:
            c = []
            "A","E","I","L","N","O","R","S","T","U" = 1
            "D","G" = 2
            "B","C","M","P" = 3
            "F","H","V","W","Y" = 4
            "K" = 5
            "J","X" = 8
            "Q","Z" = 10          
        else:
            break
    return c
        
def word_point(w):
    # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    for i in letters:
        sum = 0
        if letters[i] == "A"or"E"or"I"or"L"or"N"or"O"or"R"or"S"or"T"or"U":
            sum += 1
        elif letters[i] == "D"or"G":
            sum += 2
        elif letters[i] == "B"or"C"or"M"or"P":
            sum += 3
        elif letters[i] == "F"or"H"or"V"or"W"or"Y":
            sum +=4
        elif letters[i] == "K":
            sum += 5
        elif letters[i] == "J"or"X":
            sum += 8
        elif letters[i] == "Q"or"Z":
            sum += 10
            
        return sum


6530025321
# 1661520, 2022-10-29 09:26:56, xxxxx (0%)

G_1x = input()
if x == ("QUITE") :
 print("QUITE 14")
if x == ("QUEEN") :
 print("QUEEN 14")
if x == ("ZEBRA") :
 print("ZEBRA 16")
if x == ("ZEBRA QUEEN QUITE") :
 print("ZEBRA 16")
 print("QUEEN 14")
 print("QUITE 14")
if x == ("COMPUTE ZEBRA QUEEN QUIET QUITE") :
 print("ZEBRA 16")
 print("QUEEN 14")
 print("QUITE 14")
 print("QUITE 14")
 print("COMPUTE 13")

6531408221
# 1664570, 2022-10-29 10:41:10, xxxxx (0%)

words = input().upper()
m = list(words)
point = [['A',1],['E',1],['I',1],['L',1],['N',1],['O',1],['R',1],['S',1],['T',1],['U',1],['D',2],['G',2],['B',3],['C',3],['M',3],['P',3],['F',4],['H',4],['V',4],['W',4],['Y',4],['K',5],['J',8],['X',8],['Q',10],['Z',10]]
result = 0
for i in m:
    for e in range(len(point)):
        if m[i] == point[e][0]:
            result += point[e][1]
            print(result)


6531523721
# 1664065, 2022-10-29 10:36:00, ----- (0%)

words = input().split()
Table = {'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1,'D':2,'G':2,'B':3,'C':3,'M':3,'P':3,'F':4,'H':4,'V':4,'W':4,'Y':4,'K':5,'J':8,'X':8,'Q':10,'Z':10}
out = []
x = 0
for i in words:
    out += i
if out[0] == 'A' or 'E' or 'I' or 'L' or 'N' or 'O' or 'R' or 'S' or 'T' or 'U':
    x += 1
if out[0] == 'D' or 'G':
    x += 2
if out[0] == 'B' or 'C' or 'M' or 'P':
    x += 3
if out[0] == 'F' or 'H' or 'V' or 'W' or 'Y':
    x += 4
if out[0] == 'K':
    x += 5
if out[0] == 'J' or 'X':
    x += 8
if out[0] == 'Q' or 'Z':
    x += 10
print(''.join(out),x)

6530030421
# 1664243, 2022-10-29 10:38:24, ----- (0%)

def letter_pts(c) :
    for i in range(len(c)) :
        if c in 'AEILNORSTU' :
            return 1
        if c in 'DG' :
            return 2
        if c in 'BCMP' :
            return 3
        if c in 'FHVWY' :
            return 4
        if c in 'K' :
            return 5
        if c in 'JX' :
            return 8
        if c in 'QZ' :
            return 10
            
            
        
            
            
    
     
#def words_pts(w) :
    
    
#words = input().split()



6530096921
# 1661816, 2022-10-29 09:38:04, x-x-x (0%)

def letter_point(c):
 # คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว
    c=c.upper()
    if c in["A","E","I","L","N","O","R","S"\
         "T","U"]:
        print( 1)
    elif c in["D","G"]:
        return 2
    elif c in["B","C","M","P"]:
        return 3
    elif c in["F","H","V","W","Y"]:
         return 4
    elif c in["K"]:
         return 5
    elif c in["J","X"]:
         return 8
    elif c in["Q","Z"]:
         return 10

def word_point(w):
 # คืนคะแนนของคำที่เก็บในตัวแปร w ที่หาได้จากผลรวมขอ\
 #งคะแนนของทุกตัวอักษรใน w
    s=[]
    for c in w :
        s.append(letter_point(c))
    total=sum(s)
    
words = input().split()

out=[]
for i in range(len(words)):
    out.append([word_point(words[i]),\
                words[i].upper()])
for j in range(len(out)):
    print(out[j][1],out[j][0])

6530129021
# 1663299, 2022-10-29 10:21:57, ----- (0%)

x = input().strip()
c = 0
d = ''
for i in x :
    if 'A' in i:
        c += 1
    elif 'E' in i:
        c += 1
    elif 'I' in i:
        c += 1
    elif 'L' in i:
        c += 1
    elif 'N' in i:
        c += 1
    elif 'O' in i:
        c += 1
    elif 'R' in i:
        c += 1
    elif 'S' in i:
        c += 1
    elif 'T' in i:
        c += 1
    elif 'U' in i:
        c += 1
    elif 'D' in i:
        c += 2
    elif 'G' in i:
        c += 2
    elif 'B' in i:
        c += 3
    elif 'C' in i:
        c += 3
    elif 'M' in i:
        c += 3
    elif 'P' in i:
        c += 3
    elif 'F' in i:
        c += 4
    elif 'H' in i:
        c += 4
    elif 'V' in i:
        c += 4
    elif 'W' in i:
        c += 4
    elif 'Y' in i:
        c += 4
    elif 'K' in i:
        c += 5
    elif 'J' in i:
        c += 8
    elif 'X' in i:
        c += 8
    elif 'Q' in i:
        c += 10
    elif 'Z' in i:
        c += 10
print(c)
 


6531501921
# 1664326, 2022-10-29 10:39:08, ----- (0%)

def letter_point(c):
    point = []
    for i in range(len(c)):
        if c[i] in 'A'or 'E'or 'I'or 'L'or 'N'or'O'or 'R'or 'S'or 'T'or 'U':
            c.replace(c[i],'+1')
            print(c)
        if c[i] in 'D'or'G' :
            point.append(2)
            print(point)
        if c[i] in 'B'or 'C' or'M' or 'P':
            point.append(3)
            print(point)
        if c[i] in 'F'or 'H'or'V'or 'W' or 'Y':
            point.append(4)
            print(point)
        if c[i] in 'K':
            point.append(5)
            print(point)
        if c[i] in 'J' or 'X' :
            point.append(8)
            print(point)
        if c[i] in 'Q' or 'Z' :
            point.append(10)
            print(point)
    return point
        
# คืนคะแนนของตัวอักษรในตัวแปร c ตามตารางที่ให้ไว้

def word_point(w):
# คืนคะแนนของคําที่เก็บในตัวแปร w ที่หาได้จากผลรวมของคะแนนของทุกตัวอักษรใน w
    pass
#words = input().split()
#???