/ CODES

Symmetric Days

Symmetric Days


Problem


If you write May 5, 2020 in YYYY/MM/DD form, in 7 segment digit system, it looks like this:

2020 05 05 shown in 7 segment digit system

If you bring a mirror and place it in the middle, facing either left or right, the number is going to be still same. In other words, the date is symmetric in y-axis!

Can you find out which dates are symmetric in this way, in the given interval? For convenience, we assume all months have 30 days each. (For example, 2020 February 30 is a valid date.)

Input


The first line of input will be t – the number of test cases.

The following t test cases consists of two lines, each containing:

y1, m1, d1 – the starting date

y2, m2, d2 - the ending date

Constraints: 1 ≤ yj ≤ 9999, 1 ≤ mj ≤ 12, 1 ≤ dj ≤ 30 for all j ∈ {1, 2}

Output


For each test case, the first line contains an integer n – the number of symmetric dates between the starting date and the ending date inclusive.

The following n lines contain the symmetric dates, yi, mi, di (1 ≤ in), sorted in increasing order. The leading zeroes should be printed too.

Note


  • The date is symmetric only if all the segments are preserved after flipping y-axis. For example, 1111 November 11 is NOT symmetric.

Example


Input

3
2020 05 04
2020 05 05
2020 01 01
2020 01 03
2050 02 03
2051 01 07

Output

1
2020 05 05
0
1
2050 02 05