// 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=1e6+5;
const int INF=1e18;
const int MOD=1e9+7;
int par[sz],s[sz];
map<int,int> mp;
int findpar(int u)
{
if(u==par[u])
return u;
par[u]=findpar(par[u]);
mp[par[u]]=max(mp[par[u]],mp[u]);
return par[u];
}
void unite(int u,int v)
{
u=findpar(u);
v=findpar(v);
if(s[u]<s[v])
swap(u,v);
s[u]+=s[v];
par[v]=u;
mp[u]=max(mp[u],mp[v]);
}
void solve()
{
int n,m,k;
cin>>n>>m>>k;
for(int i=1;i<=m;i++)
{
par[i]=i;
s[i]=1;
}
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++)
{
int a=equals[i].first,b=equals[i].second;
if(findpar(a)!=findpar(b))
unite(a,b);
}
for(int i=1;i<=m;i++)
{
if(mp[findpar(i)]==0)
cout<<'?'<<endl;
else
cout<<'K'<<mp[findpar(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 time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |