PivotOJ

Endgame

시간 제한: 1000ms메모리 제한: 1024MB출처: NWERC 2020BOJ 21341

문제

The boardgame Chaos is an exotic variant of Chess, played by two players in alternating turns on an n×nn\times n playing board. All pieces have the same set of nn valid moves which are agreed on ahead of the game.

In a single turn a player can pick exactly one of their pieces and perform one of the following actions:

  • Perform up to two valid moves using the chosen piece, capturing any piece that the chosen piece lands on along the way.
  • Teleport the chosen piece to any cell on the board that is not already occupied by another piece.
  • Leave the chosen piece untouched in its current cell.

Having recently discovered Chaos, Alice and Bob are currently in the endgame of a very exciting match. Each player has a single piece left on the board and there are only two turns left, with Alice going next.

Having analysed the situation, she realises that the only way she can win is to capture Bob's piece in her turn. If that is not possible, Alice may be able to force a tie if she can teleport her piece to a cell that Bob cannot capture in his turn. Otherwise Bob will be able to win by capturing Alice's piece, no matter what she does in her turn. Help Alice determine her optimal outcome.

입력

The input consists of:

  • One line with an integer nn (2n1052 \leq n \leq 10^5), the size of the playing board and the number of valid moves.
  • One line with two integers axa_x and aya_y (1ax,ayn1 \leq a_x, a_y \leq n), the column and row in which Alice's piece is currently located.
  • One line with two integers bxb_x and byb_y (1bx,byn1 \leq b_x, b_y \leq n), the column and row in which Bob's piece is currently located.
  • nn lines, the iith of which contains two integers xix_i and yiy_i (n<xi,yi<n-n < x_i, y_i < n) representing one of the valid moves. This moves the given piece xix_i columns to the right and yiy_i rows up, provided this does not take the piece outside of the board.

Columns are numbered 11 to nn from left to right and rows are numbered 11 to nn from bottom to top. All valid moves are distinct.

출력

If Alice can capture Bob's piece in her turn, output "Alice wins".

If Alice can use her turn to force a tie by teleporting her piece to a cell that Bob cannot capture in his turn output "tie" followed by two integers axa'_x and aya'_y, the location of any such cell. If there are multiple valid solutions, you may output any one of them.

Otherwise, if Bob is able to capture Alice's piece no matter what she does in her turn, output "Bob wins".

예제

예제 1

입력
2
2 1
1 2
1 0
0 -1
출력
Bob wins

예제 2

입력
3
2 3
1 3
-2 1
1 1
1 0
출력
tie 3 1

예제 3

입력
4
1 1
3 4
0 3
2 0
0 -3
-2 0
출력
Alice wins
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.