|
@@ -140,11 +140,63 @@ def sort_1():
|
|
|
print(*fone_book[i])
|
|
|
else:
|
|
|
print('Неизвестный номер')
|
|
|
-
|
|
|
|
|
|
# sort_1()
|
|
|
-
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
def sort_2():
|
|
|
-
|
|
|
+ birthday_book = {}
|
|
|
+ req_list = []
|
|
|
+ rec_cnt = int(input())
|
|
|
+ for i in range(rec_cnt):
|
|
|
+ record = input().split()
|
|
|
+
|
|
|
+ if record[2] not in birthday_book.keys():
|
|
|
+ birthday_book[record[2]] = [[record[0], record[1]]]
|
|
|
+ else:
|
|
|
+ tmp = birthday_book[record[2]]
|
|
|
+ tmp.append([record[0], record[1]])
|
|
|
+ birthday_book[record[2]] = tmp
|
|
|
+
|
|
|
+ req_cnt = int(input())
|
|
|
+ for i in range(req_cnt):
|
|
|
+ req_list.append(input())
|
|
|
+
|
|
|
+ for i in req_list:
|
|
|
+ if i in birthday_book.keys():
|
|
|
+ for j in birthday_book.get(i):
|
|
|
+ print(j[0], end=' ')
|
|
|
+ print()
|
|
|
+ else:
|
|
|
+ print('Нет данных')
|
|
|
+
|
|
|
+sort_2()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+birthday_book = {}
|
|
|
+req_list = []
|
|
|
+rec_cnt = int(input())
|
|
|
+for i in range(rec_cnt):
|
|
|
+ record = input().split()
|
|
|
+
|
|
|
+ if record[2] not in birthday_book.keys():
|
|
|
+ birthday_book[record[2]] = [[record[0], record[1]]]
|
|
|
+ else:
|
|
|
+ tmp = birthday_book[record[2]]
|
|
|
+ tmp.append([record[0], record[1]])
|
|
|
+ tmp.sort()
|
|
|
+ birthday_book[record[2]] = tmp
|
|
|
+
|
|
|
+req_cnt = int(input())
|
|
|
+for i in range(req_cnt):
|
|
|
+ req_list.append(input())
|
|
|
|
|
|
+for i in req_list:
|
|
|
+ if i in birthday_book.keys():
|
|
|
+ for j in birthday_book.get(i):
|
|
|
+ print(j[0], end=' ')
|
|
|
+ print()
|
|
|
+ else:
|
|
|
+ print('Нет данных')
|