26.61%

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

1

0

Ibrahim Nash | 107 |

aristotle | 79 |

Stark_Maverick | 77 |

shankyy | 73 |

Lam Ngoc Pham | 71 |

Lam Ngoc Pham | 476 |

All Is Well | 399 |

Prateek Gole | 385 |

Divvya Sinha | 374 |

Ibrahim Nash | 347 |

akhayrutdinov | 3868 |

sanjay05 | 3366 |

Michael Riegger | 2033 |

Jasleen Kaur 2 | 2012 |

Quandray | 1982 |