Codeforces Round 607 (Div. 2)


A. Suffix Three
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
Output
FILIPINO
JAPANESE
JAPANESE
KOREAN
FILIPINO
FILIPINO
JAPANESE
JAPANESE
----------------------------------------------------------------------------------------------------
B. Azamon Web Services
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
AZAMON APPLE
AZAMON AAAAAAAAAAALIBABA
APPLE BANANA
Output
AMAZON
---
APPLE
----------------------------------------------------------------------------------------------------
C. Cut and Paste
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
231
7
2323
6
333
24
133321333
Output
25
1438
1101
686531475
----------------------------------------------------------------------------------------------------
D. Beingawesomeism
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7 8
AAPAAAAA
PPPPAAAA
PPPPAAAA
APAAPPPP
APAPPAPP
AAAAPPAP
AAAAPPAA
6 5
AAAAA
AAAAA
AAPAA
AAPAP
AAAPP
AAAPP
4 4
PPPP
PPPP
PPPP
PPPP
3 4
PPPP
PAAP
PPPP
Output
2
1
MORTAL
4
----------------------------------------------------------------------------------------------------
E. Jeremy Bearimy
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3
1 2 3
3 2 4
2 4 3
4 5 6
5 6 5
2
1 2 1
1 3 2
1 4 3
Output
15 33
6 6
----------------------------------------------------------------------------------------------------
F. Miss Punyverse
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
4 3
10 160 70 50
70 111 111 0
1 2
2 3
3 4
2 1
143 420
214 349
2 1
Output
2
0
----------------------------------------------------------------------------------------------------
