<div class="plm" style="text-align:center;font-size:12pt;color:rgb(34,34,34);clear:both;">
<div class="ptt" id="problem_title" style="font-size:18pt;font-weight:bold;color:#0000FF;">
<span style="color:#008000;">F -</span>Spider Man</div>
<span class="crawlInfo" id="crawlSuccess" style="display:inline;"><strong>Time Limit:</strong><span id="timeLimit">2000</span>MS<strong>Memory Limit:</strong><span id="memoryLimit">262144</span>KB<strong>64bit IO Format:</strong><span id="_64IOFormat">%I64d
& %I64u</span></span>
<div id="problem_opt" style="font-size:12px;"><a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="submit" style="display:inline-block;vertical-align:middle;overflow:visible;font-family:Verdana, Arial, sans-serif;font-size:1em;border:1px solid rgb(211,211,211);color:rgb(85,85,85);"><span class="ui-button-text" style="display:block;">Submit</span></a><a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="http://acm.hust.edu.cn/vjudge/contest/128607#status//F/0" id="problem_status" rel="nofollow" style="display:inline-block;vertical-align:middle;overflow:visible;text-decoration:none;font-family:Verdana, Arial, sans-serif;font-size:1em;border:1px solid rgb(211,211,211);color:rgb(85,85,85);"><span class="ui-button-text" style="display:block;">Status</span></a><a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="http://acm.hust.edu.cn/vjudge/problem/454177" id="problem_practice" rel="nofollow" style="display:inline-block;vertical-align:middle;overflow:visible;text-decoration:none;font-family:Verdana, Arial, sans-serif;font-size:1em;border:1px solid rgb(211,211,211);color:rgb(85,85,85);"><span class="ui-button-text" style="display:block;">Practice</span></a><a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="http://acm.hust.edu.cn/vjudge/problem/454177/origin" id="problem_origin" rel="nofollow" style="display:inline-block;vertical-align:middle;overflow:visible;text-decoration:none;font-family:Verdana, Arial, sans-serif;font-size:1em;border:1px solid rgb(211,211,211);color:rgb(85,85,85);"><span class="ui-button-text" style="display:block;">CodeForces
705B</span></a></div>
</div>
<div style="color:rgb(34,34,34);font-family:Verdana, Arial, sans-serif;font-size:14px;">
<div style="text-align:center;color:#008000;">Appoint description:<select id="desc_index" name="desc_index" style="font-family:Verdana, Arial, sans-serif;font-size:1em;"><option value="0">
System Crawler (Aug 12, 2016 3:03:09 AM)</option></select></div>
<div class="desc_template" id="desc_F_0">
<div class="vj_description">
<p class="pst" style="font-family:Arial, Helvetica, sans-serif;font-size:18pt;font-weight:bold;color:#0000FF;">
Description</p>
<div class="textBG" style="border:2px dotted;font-family:'Times New Roman', Times, serif;font-size:17px;">
<p>Peter Parker wants to play a game with Dr. Octopus. The game is about cycles.<span class="tex-font-style-it">Cycle</span>is a sequence of vertices, such that first one is connected with the second, second is connected with third and so on, while the last
one is connected with the first one again. Cycle may consist of a single isolated vertex.</p>
<p>Initially there are<span class="tex-span" style="font-size:21.25px;"><em>k</em></span>cycles,<span class="tex-span" style="font-size:21.25px;"><em>i</em></span>-th of them consisting of exactly<span class="tex-span" style="font-size:21.25px;"><em>v</em><sub class="lower-index"><em>i</em></sub></span>vertices.
Players play alternatively. Peter goes first. On each turn a player must choose a cycle with at least<span class="tex-span" style="font-size:21.25px;">2</span>vertices (for example,<span class="tex-span" style="font-size:21.25px;"><em>x</em></span>vertices)
among all available cycles and replace it by two cycles with<span class="tex-span" style="font-size:21.25px;"><em>p</em></span>and<span class="tex-span" style="font-size:21.25px;"><em>x</em>-<em>p</em></span>vertices where<span class="tex-span" style="font-size:21.25px;">1≤<em>p</em><<em>x</em></span>is
chosen by the player. The player who cannot make a move loses the game (and his life!).</p>
<p>Peter wants to test some configurations of initial cycle sets before he actually plays with Dr. Octopus. Initially he has an empty set. In the<span class="tex-span" style="font-size:21.25px;"><em>i</em></span>-th test he adds a cycle with<span class="tex-span" style="font-size:21.25px;"><em>a</em><sub class="lower-index"><em>i</em></sub></span>vertices
to the set (this is actually a multiset because it can contain two or more identical cycles). After each test, Peter wants to know that if the players begin the game with the current set of cycles, who wins?</p>
<p>Peter is pretty good at math, but now he asks you to help.</p>
</div>
</div>
<div class="vj_input">
<p class="pst" style="font-family:Arial, Helvetica, sans-serif;font-size:18pt;font-weight:bold;color:#0000FF;">
Input</p>
<div class="textBG" style="border:2px dotted;font-family:'Times New Roman', Times, serif;font-size:17px;">
<div class="input-specification">
<div class="section-title">
<p>The first line of the input contains a single integer<span class="tex-span" style="font-size:21.25px;"><em>n</em></span>(<span class="tex-span" style="font-size:21.25px;">1≤<em>n</em>≤100000</span>)— the number of tests Peter is about to make.</p>
<p>The second line contains |
|