QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 512 MB 总分: 100

#81. Pyramid Decoration

统计

There are $L\times(L+1)\times(L+2)/6$ stones. Snuke stacked these stones like a tetrahedron (a 3D object that consists of four triangular faces). The position of a stone is represented by a tuple of integers $(i,j,k)$ ($1\le k\le j\le i\le L$). When $i<L$, the stone at $(i,j,k)$ is stacked on top of three stones at $(i+1,j,k)$, $(i+1,j+1,k)$, and $(i+1,j+1,k+1)$.

Snuke colors these stones in the following way. First, he colors all stones in the bottommost layer. For each $i$ ($1\le i\le N$), he colors the stone at $(L,A_i,B_i)$ black, and colors the other stones on the bottommost layer white. Then, he colors the other stones from bottom to top. He colors the stone at $(i,j,k)$ black if the number of black stones below it ($(i+1,j,k)$, $(i+1,j+1,k)$, and $(i+1,j+1,k+1)$) is either zero or two. Otherwise he paints this stone white.

Determine the color of the topmost stone.

Input

$$ L\ N\\ A_1\ B_1\\ \vdots\\ A_N\ B_N $$

  • $2\le L\le 10^9$
  • $0\le N\le\min(1000,L\times(L+1)/2)$
  • $1\le B_i\le A_i\le L$
  • The tuples $(A_i,B_i)$ are pairwise distinct.

Output

Print “Tori” if the topmost stone is black. Otherwise print “Yayoi”.

Examples

Input 1

2 2
2 1
1 1

Output 1

Tori

Input 2

3 0

Output 2

Yayoi

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.