The Number Visited Game

5

1 votes
Mathematics, Medium, Approved, Game Theory, Recruit
Problem

Samu and Vibhu are in a mood to play a game. They saw some numbers written in front of them on a table from 1 to N. At start of game all the numbers are un-visited. Now in each move one of the player selects any number from the remaining un-visited numbers left on the table after previous players turn and makes it visited. Once a number is chosen by any of the player than it can't be chosen by other player as that number is now visited.

Now the first one making three consecutive numbers as visited that means X , X+1 , X+2 is declared as winner of the game. We need to find out who wins if both players play optimally in turns one after the other.

Note :

  • Assume Samu being elder sister starts the game.
  • The three consecutive numbers to be visited need not have to be of the same player.

Input : The first line contains T denoting the number of test cases. Then each of the next T lines contains N which shows that table has numbers from 1 to N.

Output : Output is "Samu" if Samu wins the game and "Vibhu" if Vibhu wins the game (quotes are only for clarification).

Constraints :

1 ≤ T ≤ 100

3 ≤ N ≤ 20000

Time Limit: 2
Memory Limit: 512
Source Limit:
Explanation

We can clearly see that whatever Vibhu do to defeat his elder sister , she is always going to win. Say firstly Samu marked 1 as visited then suppose if Vibhu mark 3 as visited then in next turn Samu can mark 2 as visited and win the game.

Editor Image

?