SP377 TAXI - Taxi

Description

Besides the well known unbelievable lordly major town's history there also current problems in this town. But to understand these problems you should know some facts from the unbelievable lordly major town's history. Once upon a time the population of the unbelievable lordly major town grew so much that the citizens were in need of building new houses. As it was not allowed to erect houses outside the city wall they decided to found a new little town directly beside the main town. We will refer to this second town as the new unbelievable lordly major town. In the new unbelievable lordly major town all streets were built as straight lines intersecting at right angles at fixed distances (see picture below). ![Road map](https://cdn.luogu.com.cn/upload/vjudge_pic/SP377/b2ff1127d000f802743b53297fb4fb34c8cd490c.png) Knowing this we can leave the town's history and can focus on nowadays problems. One of these problems is directly connected to the "somnolent naggy festival" (SONAFE). Despite its name it's one of the town's most popular events and nearly everybody wants to get a ticket. To give everyone the same chance of getting one of the few tickets the place and time of the advance sale are kept secret until some minutes before the ticket counter opens. Once the opening of the ticket counter is disclosed (by radio to give everyone a fair chance) everyone interested in getting some tickets tries to get to the counter immediately. One of the most profiting citizens of this ticket selling procedure is the new unbelievable lordly major town's taxi service owner. At the time of the radio announcement all over the town people ring up the taxi central and ask for a ride. The problem for the taxi central is that a lot of people ask for a ride at the same time and that the taxis have to pick up the people very quickly. Your task is to help the taxi central finding out how many passengers can be transported to the ticket counter. You have to adhere to following constraints: - each taxi can only take one passenger - passengers always wait at intersections of roads - at the time of the radio broadcast all taxis also wait at intersections - the taxi has to reach the passenger within a given time limit (otherwise he will be too late to get a ticket)

Input Format

The first line contains the number of testcases k (k

Output Format

For each testcase output the maximal number of persons that visit the party.