2k team participate playoff tournament the tournament consist 2k 1 game they hold follow team split pair team 1 play team 2 team 3 play team 4 exactly order 2k1 game play phase when team lose game eliminate game result elimination team tie after 2k1 team remain if team remains declare champion 2k2 game play winner game 1 vs 2 play winner game 3 vs 4 winner game 5 vs 6 play winner game 7 vs 8 this process repeat team remainsfor example picture describe chronological order game k 3 let string s consist 2k 1 character describe result game chronological order follow s_i 0 team low index win ith game s_i 1 team great index win ith game s_i result ith game unknown team win game let fs number possible winner tournament describe string s a team possible winner tournament possible replace 1 0 way team championyou give initial state string s you process q query follow form p c replace s_p character c print fs result query