BETA

#### Submissions: 1105 Accuracy: 26.61%

Check if date is valid

Given a date, the task is to check if it is valid or not. It may be assumed that the given date is in range from 01/01/1800 to 31/12/9999 and any date not within this range will also be considered invalid.

Examples :

```Input : d = 10, m = 12, y = 2000
Output : 1
The given date 10/12/2000 is valid

Input  : d = 30, m = 2, y = 2000
Output : 0
The given date 30/2/2000 is invalid. The
February month cannot have 30 as day.

```

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains 3 space separated integers d, m, y denoting the day, month and the year respectively.

Output:
For each test case in a new line print 1 if the date is a valid date else print 0.

Constraints:
1<=T<=100
1<=d, m, y<=10000

Example:
Input:

2
10 12 2000
30 2 2000
Output:
1
0

#### ** For More Input/Output Examples Use 'Expected Output' option **

##### It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result: