跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2939. Industrial Nim

  • ID: 2945
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:提高
  • 上传者:
  • 博弈
  • 数学
  • 提高
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Industrial Nim

题目描述

C. Industrial Nim
time limit per test
2 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

There are n stone quarries in Petrograd.

Each quarry owns mi dumpers (1≤i≤n). It is known that the first dumper of the i-th quarry has xi stones in it, the second dumper has xi+1 stones in it, the third has xi+2, and the mi-th dumper (the last for the i-th quarry) has xi+mi-1 stones in it.

Two oligarchs play a well-known game Nim. Players take turns removing stones from dumpers. On each turn, a player can select any dumper and remove any non-zero amount of stones from it. The player who cannot take a stone loses.

Your task is to find out which oligarch will win, provided that both of them play optimally. The oligarchs asked you not to reveal their names. So, let's call the one who takes the first stone «tolik» and the other one «bolik».

Input

The first line of the input contains one integer number n (1≤n≤105) − the amount of quarries. Then there follow n lines, each of them contains two space-separated integers xi and mi (1≤xi,mi≤1016) − the amount of stones in the first dumper of the i-th quarry and the number of dumpers at the i-th quarry.

Output

Output «tolik» if the oligarch who takes a stone first wins, and «bolik» otherwise.

Examples
Input
2
2 1
3 2
Output
tolik
Input
4
1 1
1 1
1 1
1 1
Output
bolik

题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 2615 题。保留原作者与原赛事署名。