PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#LCA0000087. Hai người gặp nhau (Collision)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Hai người gặp nhau (Collision)

Collision

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn towns connected by equally long undirected roads forming a tree. In each query (c,d)(c,d), two travelers leave simultaneously from towns c,dc,d, heading toward each other along the unique shortest route at equal speeds. Determine whether they meet at a town or midway along a road.

Input

First line: n,qn,q. Then n−1n-1 edges ai,bia_i,b_i and qq queries c,dc,d.

Output

Print Town if they meet at a town, otherwise Road, one line per query.

Subtasks

  • Subtask 1 (20 points): 2≤n≤352\le n\le 35; 1≤q≤351\le q\le 35; 1≤ai<bi≤n1\le a_i<b_i\le n; 1≤c<d≤n1\le c<d\le n; edges form a tree vô hướng.

  • Subtask 2 (30 points): 2≤n≤12002\le n\le 1200; 1≤q≤12001\le q\le 1200; 1≤ai<bi≤n1\le a_i<b_i\le n; 1≤c<d≤n1\le c<d\le n; edges form a tree vô hướng.

  • Subtask 3 (50 points): 2≤n≤1000002\le n\le 100000; 1≤q≤1000001\le q\le 100000; 1≤ai<bi≤n1\le a_i<b_i\le n; 1≤c<d≤n1\le c<d\le n; edges form a tree vô hướng.

Examples

Input

5 2
1 2
2 3
3 4
4 5
1 3
1 5

Output

Town
Town

Explanation

Both distances have an even number of edges (22 and 44), so the midpoint is a town.