Submission #1317256

#TimeUsernameProblemLanguageResultExecution timeMemory
1317256huseynahmadli2010KOVANICE (COI15_kovanice)C++20
0 / 100
568 ms589824 KiB
// Uh, is this okay? At this distance, you've got nothing but weak spots!

// Too slow, too slow

/*
 
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠴⠚⠋⠉⠉⠈⠉⠐⠒⢵⡑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠖⢋⠅⠀⠀⠀⠀⣀⣠⠀⠀⠀⠀⠀⢹⡾⢔⠦⠯⢭⣵⠦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⡀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠁⠠⠈⠀⠀⠀⣠⡲⠟⠁⠀⠀⠀⡠⡀⠑⢤⠧⠀⠀⠀⠀⠈⠙⠦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⠶⠶⠒⠛⠛⠛⠛⠋⠛⠛⠛
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠊⣁⡤⠂⠀⣠⠀⠀⡠⠞⠁⠀⠀⡀⠀⠀⠀⠙⠺⣦⣀⠳⡎⠠⠖⠠⢄⠀⠀⠀⠙⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⠾⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢔⣩⣶⡿⠋⠀⢀⠜⠀⢠⠊⠀⠀⠀⢠⠞⠁⡀⠀⠀⠀⠀⠘⢿⡅⠀⠀⠀⢀⠈⠱⣤⡀⠀⠐⣽⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠋⡩⠊⠀⠀⢀⠎⠀⡴⠁⠀⠀⠀⠰⠁⡠⠊⠀⠀⣠⠄⠀⢦⣬⡓⠀⠀⠀⠀⠑⠄⠀⠛⠄⠀⠀⠫⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠋⠀⢀⠞⠁⠀⠀⢀⠎⢀⠄⠀⠀⠀⠀⠀⢀⢜⠁⠀⡠⠚⠀⢀⠄⡄⢯⢚⠄⠀⠀⢠⠀⠈⢟⡄⠈⡄⠀⠀⠘⣧⡑⠤⣀⠀⡀⠀⠀⠀⠀⢀⣴⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡔⠁⠀⠀⡰⠋⠀⠀⠀⢀⡎⠀⡌⠀⠀⠀⠀⠀⣼⡫⠃⡠⠊⠀⠀⢠⠋⣼⣟⣶⣛⣤⢦⡀⠀⠑⡄⠀⠻⡄⡘⡄⠀⠀⠸⣿⡍⠊⠉⠁⠀⠀⠀⣠⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣔⡏⠀⠀⠀⡜⠁⡀⠀⠀⢠⢺⠀⣸⠀⠀⠀⠀⠐⢸⠟⢀⠜⠀⠀⢀⢄⢃⡼⠉⠈⠉⠉⠛⠋⠹⣆⢄⠸⡀⠀⠰⡁⠘⡄⠐⡄⢹⣾⡄⠀⠀⠀⠀⢠⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⡸⠀⠀⢀⡜⢀⡾⠁⠀⢠⢃⠆⢀⡿⠀⠀⠀⠀⢀⠇⣠⠟⠁⠀⠠⢃⠎⡼⠁⠀⠀⠀⠀⠀⠀⠀⠹⣮⢂⣿⠀⠀⢱⢡⢱⠀⠰⡆⡟⣇⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⢧⠀⢀⡎⠠⡿⠁⠀⢠⢃⠎⠀⣸⠃⠀⠀⠀⠀⡸⠰⠋⠀⠀⡰⢡⡞⣼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣏⢿⡇⠀⠀⡇⢇⢣⠀⠸⢸⢸⠀⠀⠀⢠⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡎⠁⠀⡞⢀⣾⠁⠀⢀⠃⡼⠀⠀⡟⠀⠀⠀⢀⠆⡴⠁⢀⠔⠊⣠⣻⡳⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣎⣧⢸⠀⢹⡜⡌⠆⠀⣿⠀⠇⠀⠀⣸⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⢠⣾⣿⠀⠀⠎⡸⡏⠀⠰⠁⠀⠀⠀⣸⢠⠃⣠⠏⢀⣼⡵⡽⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠐⠒⠂⢿⣼⠈⡄⢸⡿⣵⡸⡄⣿⡀⠀⠀⠀⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⡞⢸⡇⠀⠀⢠⣾⡇⠀⢸⠀⠀⠀⠀⡇⢸⢪⡜⢡⣾⢫⠊⠀⠀⠀⠀⠀⠀⠀⢠⣶⠋⠁⠀⠀⠀⠀⠀⣿⠀⠃⠀⣷⡏⢱⢱⡏⢳⡄⠀⠀⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣷⠃⢸⡇⢀⠇⢎⡟⠀⠀⡆⠀⠀⠀⠀⡇⡼⠊⣴⣿⠗⠁⠀⠀⠀⠀⠀⠀⢀⣴⠟⠑⠂⠉⠁⠁⠒⠢⠄⢻⡆⠆⠀⣿⡸⢸⣀⢿⠀⠉⠁⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⢸⡇⡜⡀⣾⢰⠀⠀⡇⢀⠀⠀⢈⠁⣧⠼⠛⠋⠛⠻⡷⣄⠀⠀⠀⠀⠘⠡⢀⣀⠤⣤⣶⣶⣶⢶⣾⡟⡇⡇⠀⣸⣷⣫⠟⣘⢦⠀⠀⠀⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⢇⢡⣻⢷⢸⠀⠀⡇⠘⠀⠀⢸⠀⣧⣤⣤⣤⣠⠤⠼⣈⢢⠀⠀⠀⠠⣎⢵⣾⣿⣿⡻⣿⠇⣼⡿⠀⡇⡇⠀⢼⢣⢿⡀⢿⣿⠷⡄⠀⠀⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢸⢸⡇⢸⣘⡄⠀⡇⠀⡄⠀⠀⠁⡟⠻⣿⣟⣿⣿⢷⠇⠀⠀⠀⠀⠀⠉⠛⠁⢨⠿⠾⠁⠚⠉⠀⢀⢧⡟⠀⣾⡟⣎⣇⢻⡍⢢⡀⠀⠀⠀⠀⠉⠛⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠳⡄⠻⡇⢀⣿⠀⢧⠀⠀⡌⣷⡦⠽⠶⠖⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡸⡟⠀⣏⢹⡌⢿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢛⣿⡿⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⢸⢻⡄⢸⡀⠀⢷⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣷⢃⡇⡼⣣⡗⣽⢣⡿⣿⠖⠴⠃⠀⠀⠀⠀⢀⣤⣶⡿⡿⠿⠟⠿⢷⣶⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠃⢧⡸⣧⡀⢸⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠁⣼⣿⢯⣽⡻⡼⣳⣽⢾⡝⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠛⠻⠷⠶⠶⢶⣤⣶⣴⣦⣴
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⢉⣷⣄⣳⠉⠁⠀⠀⠀⠀⠀⠀⠢⡀⠀⣠⡦⠀⠀⠀⠀⠀⠀⠠⠊⠀⣰⣿⣿⡱⢾⣿⢷⣭⣺⢻⣯⣄⣀⠀⢀⣠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣄⣀⡼⢋⣾⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠁⠀⠀⠀⠀⣠⡶⠂⠀⠀⣴⣿⣎⣿⢹⡿⣽⢿⣾⣟⢿⡾⣯⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢦⢴⣱⡯⢸⣯⢿⣦⣄⠀⠀⠓⠦⠄⣤⡤⠴⠒⠒⣲⡶⠛⠁⠀⠀⢀⣼⣿⣿⣽⣧⡿⣽⣻⣏⣿⢿⣗⠛⠾⠒⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⠿⠿⠿⠿⢿⣿⠿⠿⠛⠛⠒⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⣩⠟⢠⣾⢹⣿⣿⣯⣷⣄⡀⠀⠀⠀⠉⠉⠉⠁⠀⠀⠀⠀⠀⣠⡿⣟⣿⣿⠝⠀⣿⡿⣷⢾⣹⣟⣿⣷⡀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠚⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣞⡢⢜⡿⠛⣷⣹⣿⣿⣷⣾⠟⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⣠⡞⣯⣇⣿⣿⣇⢀⣀⣝⣿⣿⣿⣷⣿⣾⣿⣿⣶⣴⣶⣶⢾⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣟⣿⣿⣿⢣⡿⣿⣦⣀⠀⠀⢀⣠⣾⡏⣱⣿⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⡤⠖⢲⢄⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢧⢽⣿⣷⡿⣼⣠⣽⡏⣿⢻⠟⡽⢰⣿⣷⢿⣿⣿⡿⣿⣿⡿⣿⣿⣿⣿⡍⠉⢉⠉⠉⠉⠈⠻⣿⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠁⠈⢉⡵⣫⠾⣁⢞⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⣿⢿⠻⣿⢧⣷⠏⣸⣸⣗⡟⠉⠀⣼⡿⢿⣿⣾⣿⡿⠿⠟⠛⠛⠉⠉⠉⣧⡀⠀⠀⠀⠘⣟⢿⣿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⡞⢩⠖⠁⠀⢀⡜⠀⠀⢠⡤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⣠⠞⢹⡛⢷⣼⣟⣻⣿⣏⡁⠀⠀⠀⢰⣿⠤⠜⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣄⣀⠀⠀⠘⠀⠛⣿⠈⠙⠛⠶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡜⢠⠃⠀⠀⢀⡞⠀⠀⢠⠏⠧⢼⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠁⠀⠀⣇⠀⠙⢟⢿⣯⣹⣿⡆⠀⢰⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣴⣶⣿⣿⣷⣶⣒⣲⣄⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡵⠁⠀⠀⢀⡞⠀⠀⠀⡞⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣰⠆⠀⠀⠀⠀⠀⠀⣱⡀⠀⢀⣿⠀⠀⠿⠁⠈⠉⠀⠀⢀⡿⠀⠀⠀⠀⠀⠀⣀⣠⣤⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣧⠀⠀⡰⢹⠁⠀⠀⢸⠁⠀⠀⡾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠷⠒⠿⠃⠀⢀⣤⡀⣤⣠⣾⣿⣧⣀⡎⢹⡄⠀⠀⠀⠀⠀⠀⢠⣾⡇⠀⣀⢠⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣿⠀⠀⠃⠸⡄⠀⠀⡏⠀⠀⡞⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣠⡽⠃⠀⠰⣿⣯⣿⣿⣿⣿⣿⡿⢿⠃⠀⠁⠀⠀⠀⠀⠀⡴⣫⣾⣶⣿⣇⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣤⣤⣤⣤⣄⣀⣀
⠻⡆⠀⠀⠀⡇⠀⡸⠀⠀⠀⢹⠀⠀⠀⢀⡤⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⡀⠸⣿⣿⣧⣴⣶⣾⣿⣿⣿⣿⣿⣿⡿⠋⢐⣼⣿⣶⣄⠀⠀⣀⣤⣾⣿⣿⣿⣿⣿⣿⣆⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠠⡇⠀⠀⠀⢸⣤⠃⠀⠀⠀⣸⠀⢠⠞⢩⣯⠟⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣾⣿⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⢴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠭⢀⣀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠂⢃⠀⠀⢀⣀⠚⠀⠀⠀⢀⣯⠞⠁⢠⢳⠎⠀⠀⠀⠀⠀⠀⠀⣰⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⢁⣠⣴⣾⣄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠋⣉⣵⣾⢿⣿⡄⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟
⡉⠈⢢⠀⡜⠋⠐⣦⠀⠀⡾⣽⠀⠀⣎⡎⠀⠀⠀⠀⣴⠂⠀⢀⣿⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⣀⣤⣾⡿⣯⣟⡿⣽⣷⡄⠈⠻⢿⣿⣿⠟⠛⠉⢀⣤⣶⣻⣟⡿⣽⣻⢾⣽⡄⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠁⢠
⢮⣉⡐⢣⠃⠀⠀⠛⠀⡞⠀⠸⢷⡠⡿⠀⠀⠀⠀⠘⣻⡆⠀⢨⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⢁⣠⣶⡿⢿⣽⣳⣟⡷⣯⣟⡿⣽⡿⣷⣔⡠⠊⢀⣠⣴⣾⣿⣻⣞⣷⣻⣽⢷⣻⣟⡾⣿⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⢀⣴⣿
⡄⣒⠤⠭⢗⣒⡀⠀⠠⠇⠀⠀⠈⢷⡇⠀⠀⠀⠀⠀⠋⠁⣠⣿⣿⣿⣿⣿⣿⣿⡿⠋⢁⣤⣾⣟⡿⣝⣿⣻⣞⡷⣯⢟⡷⣯⣟⣷⣿⣿⣿⢿⣿⣿⣻⢯⣷⣻⣵⣻⣞⢷⣯⣿⢿⣽⡷⣟⣷⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⣰⣿⣿⣿
⢿⣄⠈⠁⢚⣒⠠⠤⠼⠂⠀⠀⠀⢸⠃⠀⠀⠀⠀⢠⣤⣷⣿⣿⣿⣿⣿⣿⣿⠋⢀⣴⡿⣿⣹⡾⣽⣻⣞⡷⣯⢿⡽⣯⣟⡷⣿⣽⣾⡟⣾⢯⣷⣯⡿⣟⣟⢿⣳⣿⣿⣿⡷⣿⢯⣿⣽⡿⣽⣧⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⢀⣾⣿⣿⠿⢿
⢸⠻⣧⣘⠣⠤⠛⣛⣣⠤⢠⡀⠀⡜⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⣠⣿⣿⣻⣟⣧⣿⣧⡿⣼⢿⣻⣟⡿⣧⣟⡿⣧⢿⣼⡻⣟⡿⢧⣟⣿⣿⣿⡼⣿⣟⣿⣧⡻⢿⣻⣿⣼⣿⡿⣿⣄⠀⢿⣿⣿⣿⣿⡿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⣼⣿⣿⣿⣿⣿
⢸⠀⠐⠪⠒⠽⠥⠶⠖⠤⠓⠀⢸⡄⠀⠀⣀⣀⣼⣿⣿⣿⣿⣿⣿⣿⡟⢡⣾⣿⢻⣼⣿⣾⣿⣿⣿⡿⣽⣫⡷⣯⢿⣳⣯⡿⣯⣟⡾⣽⢯⡿⣟⣯⣿⣿⡿⣿⡷⢿⣿⣹⣷⣯⣿⣳⣯⣷⣻⣯⢿⣆⠈⢻⣿⡿⠋⠀⠀⠀⠈⠉⠛⠛⠛⠛⠛⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⣸⣿⣿⡿⠟⠛⠻
⢸⠀⠀⠀⠀⠀⠀⠀⠠⢄⠀⠀⢸⠃⠀⣾⣟⣽⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣳⢯⣿⣟⣿⣯⣿⣽⡷⣯⢿⡽⣯⢿⡽⣟⣾⣿⣏⣿⠇⣿⣿⣿⣿⣿⢯⣷⣻⣞⡷⣿⣻⢿⣧⣠⠋⠀⠐⢉⣭⣀⣀⣀⣀⣀⣀⣤⠶⠤⢌⣁⡑⠋⠙⠭⡿⢿⣿⣿⣿⣯⣤⣤⣿⣿⣿⣀⣀⣀⣀
⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠦⢠⠋⠀⠀⣽⠇⠀⠉⠻⣿⣿⣿⣿⣿⣿⢿⣳⡿⣿⣿⣿⣿⣿⣿⣿⣿⢯⣟⣿⣳⣿⣿⢿⣟⡧⣿⣟⣯⣟⡷⣯⢿⣯⣟⣿⣿⣿⢸⣿⣿⣯⣿⣾⡻⣞⡷⣯⣟⣯⡿⣿⡏⠀⠀⢀⡴⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠦⠤⠈⠉⠩⠵⡽⣷⣶⡷⠾⣿⣿⣿⣤⡀⠀⢠⣄⣫
⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⢀⣠⣿⣿⣷⣦⡀⠀⠀⠻⣿⣿⣿⣿⣻⡽⣟⡷⣯⢿⣹⢯⣟⡿⣽⣟⣿⣿⣿⣿⢿⣿⢓⣿⣿⣟⡾⣽⣻⣽⡿⣽⣞⡿⣯⣿⡾⢿⣻⣟⡷⣫⢿⣽⣻⣯⡿⣽⢿⣽⢇⡤⠚⠁⠀⠐⠉⣉⣀⠤⠤⠤⢤⣤⠤⠒⠉⠉⠉⢒⡒⡤⢤⣶⣿⣿⡻⠶⣷⣦⢿⣿⡟⢿⣿⣛⣿
⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡗⠛⠛⠻⢿⣿⣿⣿⣦⡀⠀⠘⢿⣿⣿⣷⣻⢯⡿⣽⣻⣏⡿⣽⣻⣽⣻⣾⠟⣠⡙⠿⡿⡾⠿⠗⢿⣟⡷⣯⢷⣟⣯⢿⣽⣷⣍⣵⣿⡻⣞⣽⢯⡿⣞⣷⣯⢿⣟⣿⣿⠋⠀⠀⣀⣤⣶⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⠋⠥⠠⠤⠥⠿⣿⣻⠿⣿⣿⣏⠓⠈⠻⢿⠿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⡄⠀⢸⣿⣿⣿⣽⣯⣟⡿⣵⣯⣿⣽⣿⣾⣿⣿⣸⣿⣿⣿⣿⣿⣿⡿⣸⣯⡿⣽⣻⢾⣻⣽⢾⣳⡿⣽⢾⡽⣽⣞⣿⣽⢿⡾⣟⣯⣿⠋⡡⢇⣴⣾⣿⠟⠁⠀⠐⢉⣩⣤⣤⣤⡴⠤⠤⣤⠴⠋⠁⠀⠀⣠⣴⠆⠀⠈⠉⠛⠉⠉⠉⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⡄⣾⣿⣿⢠⣬⡙⣾⣽⡟⢳⣿⢾⣻⣿⣯⣟⣿⣿⠏⡌⣷⣿⡿⣿⣟⣯⡿⣽⢯⡿⣽⣞⡿⣽⣻⡽⣾⣽⣳⣟⣿⣾⣿⣿⣿⣿⣿⣬⣶⡿⣿⡾⠃⠀⠀⣀⣴⣿⣿⣿⡿⡯⠔⠒⠉⠀⠀⠀⠀⠀⠚⡑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣴
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡌⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣷⡇⣾⡿⢃⣿⡿⠁⢸⣟⡟⢁⣤⡌⣻⣿⡿⠀⢰⣿⣯⣿⢯⠟⣾⡽⣯⠿⠽⢷⣛⣾⠷⢯⣻⣽⣾⣿⣻⣟⡷⣿⣞⣷⣯⣿⣻⣽⡿⠟⡲⠀⣠⣾⣿⣿⣿⣿⡿⠋⢁⡠⢄⣀⠠⠤⠒⠒⠉⠉⠉⠉⠉⠉⠉⠙⠛⠓⠛⠛⠋⠉⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡿⢹⡿⣿⢠⣤⡔⣿⡿⢁⡇⣻⣯⡇⠻⣿⣷⢿⣻⡇⢀⣿⣟⣾⣽⠋⠀⣯⣿⡇⣸⣶⡆⢹⡟⢠⣶⡄⢹⣾⢯⣷⢯⣟⣷⣻⡷⣯⣷⣿⢿⣷⡮⠤⢊⣿⣿⣿⣿⡿⡿⠁⠀⢁⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠁⢸⣿⡇⣼⣿⠇⣿⢃⣚⡃⣟⣿⣿⣦⠘⢯⣿⣽⠀⣸⣿⣞⣯⠇⣼⠀⡿⣾⠀⢿⡿⢃⣼⠇⣾⣿⡇⢸⣯⣟⣾⣟⡿⣾⡵⣿⣽⣾⣯⠿⠛⠁⢠⣿⣿⣿⣿⠟⣹⢤⠀⣰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀⠀⣰⡇⠀⢸⣿⣧⣭⣥⣾⣃⣾⡽⡇⣿⡀⣿⣿⠃⣼⣿⡟⢀⣿⣟⣾⠏⣐⣛⠀⣟⡏⢰⣶⠰⣟⡿⢰⣿⣽⠃⣿⣳⣟⣾⢯⣟⣯⡿⣷⠝⠉⢀⣠⣴⣶⣿⣿⣿⣿⠋⣴⡥⢊⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢧⠀⠀⠀⠀⠀⣀⢴⣿⡇⠀⣺⣿⢯⣿⡿⣽⢯⣷⣻⣷⡿⣷⢦⣴⣾⣿⣿⡇⣼⣿⣳⡏⣰⡿⣿⠀⣯⠁⣟⣾⠐⣿⠃⣼⣷⠃⣼⣿⣻⢾⣽⣟⢾⡳⠟⠁⣠⣶⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣎⠔⠄⠰⠪⠛⣩⣿⣿⠃⠀⣿⣿⡿⢯⣟⣷⣻⣞⣷⡿⣝⣯⣻⣝⣾⣳⣿⣰⣿⣳⣯⣟⡿⣝⣯⣻⡟⣾⣛⢾⢦⡿⣤⣥⡴⣿⣛⣾⣽⣻⢾⡽⠋⢀⣠⣾⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
 
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int sz=2e3+5;

const int INF=1e18;

const int MOD=1e9+7;

vector<int> graph[sz];

map<int,int> mp;

bool visited[sz];

void dfs(int v,int par=-1)
{
    visited[v]=true;
    
    for(int to : graph[v])
    {
        if(to==par)
            continue;
        
        dfs(to,v);
        
        if(mp[v]!=0)
            mp[to]=mp[v];
        else
            mp[v]=mp[to];
    }
}

void solve()
{
    int n,m,k;
    
    cin>>n>>m>>k;
    
    vector<pair<int,int>> equals;
    
    for(int i=0;i<k;i++)
    {
        string s;
        
        cin>>s;
        
        int a,b,ind=0;
        
        string sub1="",sub2="";
        
        for(int j=0;j<s.size();j++)
        {
            if(s[j]=='>' || s[j]=='<' || s[j]=='=')
            {
                ind=j;
                
                break;
            }
            
            sub1+=s[j];
        }
        
        a=stoi(sub1);
        
        for(int j=ind+1;j<s.size();j++)
            sub2+=s[j];
        
        b=stoi(sub2);
        
        if(s[ind]=='=')
            equals.push_back({a,b});
        
        else if(s[ind]=='<')
        {
            mp[a]=1;
            
            mp[b]=2;
        }
        
        else
        {
            mp[a]=2;
            
            mp[b]=1;
        }
    }
    
    for(int i=0;i<equals.size();i++)
    {
        graph[equals[i].first].push_back(equals[i].second);
        
        graph[equals[i].second].push_back(equals[i].first);
    }
    
    for(int i=1;i<=m;i++)
        if(!visited[i])
            dfs(i);
    
    for(int i=1;i<=m;i++)
    {
        if(mp[i]==0)
            cout<<'?'<<endl;
        else
            cout<<'K'<<mp[i]<<endl;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
    
    //cin>>t;
    
    while(t--)
    {
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...