Social Networking Application

No attempts yetTime limit1sMemory limit128 MB

Problem

Since childhood, Sanggeun has shown remarkable talent for computer programming, and he has always wanted to build a social networking website. After three years of carefully studying various services, he now wants to build his own new social networking application.

Users sign up for the application and then add people they know in real life as friends. From this friendship information, a friendship graph can be built.

The most important feature of the application is this: when one user visits another user's page, it shows a path connecting the two people in the friendship graph. If there is no such path, nothing is shown.

As the service grew popular and the number of users increased, this feature became slower and slower. The reason is that, when there is no path between two people, the program spends far too long searching the whole graph trying to find one. So Sanggeun wants to precompute whether a path between two people exists.

You are given the number of users and their friendships. For each given pair of people, determine whether they are connected in the friendship graph (that is, whether a path between them exists).

Input

The input consists of several test cases. The first line of the input contains the number of test cases TT (T1T \ge 1).

The first line of each test case contains the number of users nn (1n1061 \le n \le 10^6). The second line contains the number of friendships kk (1k1051 \le k \le 10^5). Each of the next kk lines contains two integers aa and bb (0a,b<n0 \le a, b < n), meaning that users aa and bb are friends. The next line contains the number of pairs to check mm (1m1051 \le m \le 10^5). Each of the next mm lines contains two integers uu and vv describing a pair to check.

Output

For each test case, first print Scenario i:, where ii is the test case number starting from 11. Then, for each given pair, print 11 if there is a path connecting the two people and 00 otherwise, one per line.

Print one blank line between the outputs of consecutive test cases.