The Chef has been kidnapped by aliens ( they want to utilize his excellent cooking skills :P ) and has been transported to the alien planet "ZX532". Interestingly, "ZX532" uses a different time scale which has Y AlienHours on the face of a clock (instead of the 12 hours that we have).  They also have 'X*Y' AlienMinutes (instead of the 60 that we have).  X is defined as the number of minute divisions between each hour (the earth clock has X=5).
The Chef has been forced to cook a lot of dishes by the aliens. He is short of ingredients and hence needs to go out to the market to get them. However when he returns, he makes an interesting observation. The hands of AlienClock have exactly swapped position from the time he left (the big hand and the little hand have switched)!
Given the times between which The Chef might have left and the times between which The Chef may have returned, you are supposed to find out the actual time when he left.  If there is more than one possibility, print the one that maximizes the amount of time that The Chef is out.Details of the Clock
The AlienClock is circular and has exactly 2 hands : the hour hand and the minute hand. The whole circumference of the AlienClock is divided into Y divisions , each of which is further divided into X subdivisions [ X and Y are both positive integers ]. The clock is not discrete but continuous (the hands move continuously instead of moving at certain intervals such as every second, etc.... ).

-----Input-----
First line of input contains t (1≤ t ≤ 100) - the number of test cases. Each test case contains 2 lines each. The first line contains 2 space separated integers , X and Y (same as those specified in the problem statement; X ≤ 109 and Y ≤ 109 ).
The next line contains 8 space separated integers (a,b,c,d,e,f,g,h; 0 ≤ a ≤ c < Y; 0 ≤ e ≤ g < Y; a ≤ e; 0 ≤ b,d,f,h < X*Y ): specifying the times between which The Chef might have left (a:b => a hours and b minutes TO c:d => c hours and d minutes) and the times between which The Chef may have returned (The Chef returns sometime between e:f and g:h).
The interval at which The Chef re-enters the kitchen will never start prior to the interval at which he first leaves the kitchen to purchase the ingredients.

-----Output-----
The output should contain one line for each test case specifying the time when The Chef left the kitchen. This should be in the form (h:m => h hours and m minutes). h will be an integer, and m should be rounded to 2 decimal places. In case, there is no solution possible, output -1 for that test case.

-----Example-----
Input:
3
5 12
1 0 2 0 4 0 5 0
5 12
3 30 4 0 5 0 6 0
5 12
3 0 4 0 5 0 6 0

Output:
1:20.56
-1
3:26.43

Note: Be careful with precision.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import decimal;\nfrom decimal import *;\n\ndef solve(a, b, min1, min2, min3, min4, x, y):\n\tif a > b:\n\t\treturn [];\n\tsolMin1 = (a/y+b)/(y-1/y);\n\tsolMin2 = (b/y+a)/(y-1/y);\n\tsolMin1 *= (x*y);\n\tsolMin2 *= (x*y);\n\n\tif solMin1 >= min1 and solMin1 <= min2 and solMin2 >= min3 and solMin2 <= min4:\n\t\t# Solution found\n\t\treturn [a, solMin1, b, solMin2];\n\treturn [];\n\ndef integerPart(x):\n\treturn Decimal(str(x).split(".")[0]);\n\ndef fractionalPart(x):\n\tt = str(x).split(".");\n\tif len(t) > 0:\n\t\treturn "." + t[1];\n\treturn 0;\n\ngetcontext().prec = 30;\nfor i in range(eval(input())):\n\t(x,y) = input().split();\n\t(a,b,c,d,e,f,g,h) = input().split();\n\tx=Decimal(x);y=Decimal(y);a=Decimal(a);b=Decimal(b);c=Decimal(c);d=Decimal(d);e=Decimal(e);f=Decimal(f);g=Decimal(g);h=Decimal(h);\n\n\tif a > g or (a == g and b > h):\n\t\tprint("-1");\n\t\tcontinue;\n\n\tsolutionh = Decimal("-1");\n\tsolutionm = Decimal("-1");\n\tdiff = Decimal("-10000000000000000");\n\n\tsolution1 = [];solution2=[];solution3=[];solution4=[];solution5=[];solution6=[];solution7=[];solution8=[];solution9=[];\n\tsolution10 = [];solution11=[];solution12=[];solution13=[];solution14=[];\n\tl1 = 0;\n\tif g == e:\n\t\tl1 = f;\n\tsolution1 = solve(a+0,g+0,b,x*y,l1,h,x,y);\n\tif a < y - 1 and len(solution1) == 0:\n\t\tsolution2 = solve(a+1,g+0,0,x*y,l1,h,x,y);\n\tif g >= 1 and len(solution1) == 0 and len(solution2) == 0:\n\t\tsolution4 = solve(a+0,g-1,b,x*y,0,x*y,x,y);\n\tif g-e >= 2 and c-a>=2 :\n\t\tsolution5 = solve(a+1,g-1,0,x*y,0,x*y,x,y);\n\t\n\tif len(solution1) == 0 and len(solution2) == 0 and len(solution4) == 0:\n\t\tsolution10 = solve(a, e, 0, x*y, 0, x*y, x, y);\n\t\tsolution11 = solve(c, e, 0, x*y, 0, x*y, x, y);\n\t\tsolution12 = solve(c, g, 0, x*y, 0, x*y, x, y);\n\tif a < y - 1 and len(solution1) == 0 and len(solution2) == 0 and len(solution4) == 0 and c - a >= 2:\n\t\tsolution13 = solve(a + 1, e, 0, x*y, 0, x*y, x, y);\n\tif g >= 1 and len(solution1) == 0 and len(solution2) == 0 and len(solution4) == 0 and g - e >= 2:\n\t\tsolution14 = solve(c, g - 1, 0, x*y, 0, x*y, x, y);\n\n\n\tif len(solution1) > 0:\n\t\tif solution1[0] < c or (solution1[0] == c and solution1[1] <= d):\n\t\t\tif solution1[2] > e or (solution1[2] == e and solution1[3] >= f):\n\t\t\t\tt = (solution1[2]-solution1[0])*x*y + (solution1[3]-solution1[1]);\n\t\t\t\tif t > diff:\n\t\t\t\t\tdiff = t;\n\t\t\t\t\tsolutionh = solution1[0];\n\t\t\t\t\tsolutionm = solution1[1];\n\tif len(solution2) > 0:\n\t\tif solution2[0] < c or (solution2[0] == c and solution2[1] <= d):\n\t\t\tif solution2[2] > e or (solution2[2] == e and solution2[3] >= f):\n\t\t\t\tt = (solution2[2]-solution2[0])*x*y + (solution2[3]-solution2[1]);\n\t\t\t\tif t > diff:\n\t\t\t\t\tdiff = t;\n\t\t\t\t\tsolutionh = solution2[0];\n\t\t\t\t\tsolutionm = solution2[1];\n\tif len(solution4) > 0:\n\t\tif solution4[0] < c or (solution4[0] == c and solution4[1] <= d):\n\t\t\tif solution4[2] > e or (solution4[2] == e and solution4[3] >= f):\n\t\t\t\tt = (solution4[2]-solution4[0])*x*y + (solution4[3]-solution4[1]);\n\t\t\t\tif t > diff:\n\t\t\t\t\tdiff = t;\n\t\t\t\t\tsolutionh = solution4[0];\n\t\t\t\t\tsolutionm = solution4[1];\n\tif len(solution5) > 0:\n\t\tif solution5[0] < c or (solution5[0] == c and solution5[1] <= d):\n\t\t\tif solution5[2] > e or (solution5[2] == e and solution5[3] >= f):\n\t\t\t\tt = (solution5[2]-solution5[0])*x*y + (solution5[3]-solution5[1]);\n\t\t\t\tif t > diff:\n\t\t\t\t\tdiff = t;\n\t\t\t\t\tsolutionh = solution5[0];\n\t\t\t\t\tsolutionm = solution5[1];\n\tif len(solution10) > 0:\n\t\tif solution10[0] > a or (solution10[0] == a and solution10[1] >= b):\n\t\t\tif solution10[0] < c or (solution10[0] == c and solution10[1] <= d):\n\t\t\t\tif solution10[2] > e or (solution10[2] == e and solution10[3] >= f):\n\t\t\t\t\tif solution10[2] < g or (solution10[2] == g and solution10[3] <= h):\n\t\t\t\t\t\tt = (solution10[2]-solution10[0])*x*y + (solution10[3]-solution10[1]);\n\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\tsolutionh = solution10[0];\n\t\t\t\t\t\t\tsolutionm = solution10[1];\n\tif len(solution11) > 0:\n\t\tif solution11[0] > a or (solution11[0] == a and solution11[1] >= b):\n\t\t\tif solution11[0] < c or (solution11[0] == c and solution11[1] <= d):\n\t\t\t\tif solution11[2] > e or (solution11[2] == e and solution11[3] >= f):\n\t\t\t\t\tif solution11[2] < g or (solution11[2] == g and solution11[3] <= h):\n\t\t\t\t\t\tt = (solution11[2]-solution11[0])*x*y + (solution11[3]-solution11[1]);\n\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\tsolutionh = solution11[0];\n\t\t\t\t\t\t\tsolutionm = solution11[1];\n\tif len(solution12) > 0:\n\t\tif solution12[0] > a or (solution12[0] == a and solution12[1] >= b):\n\t\t\tif solution12[0] < c or (solution12[0] == c and solution12[1] <= d):\n\t\t\t\tif solution12[2] > e or (solution12[2] == e and solution12[3] >= f):\n\t\t\t\t\tif solution12[2] < g or (solution12[2] == g and solution12[3] <= h):\n\t\t\t\t\t\tt = (solution12[2]-solution12[0])*x*y + (solution12[3]-solution12[1]);\n\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\tsolutionh = solution12[0];\n\t\t\t\t\t\t\tsolutionm = solution12[1];\n\tif len(solution13) > 0:\n\t\tif solution13[0] > a or (solution13[0] == a and solution13[1] >= b):\n\t\t\tif solution13[0] < c or (solution13[0] == c and solution13[1] <= d):\n\t\t\t\tif solution13[2] > e or (solution13[2] == e and solution13[3] >= f):\n\t\t\t\t\tif solution13[2] < g or (solution13[2] == g and solution13[3] <= h):\n\t\t\t\t\t\tt = (solution13[2]-solution13[0])*x*y + (solution13[3]-solution13[1]);\n\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\tsolutionh = solution13[0];\n\t\t\t\t\t\t\tsolutionm = solution13[1];\n\tif len(solution14) > 0:\n\t\tif solution14[0] > a or (solution14[0] == a and solution14[1] >= b):\n\t\t\tif solution14[0] < c or (solution14[0] == c and solution14[1] <= d):\n\t\t\t\tif solution14[2] > e or (solution14[2] == e and solution14[3] >= f):\n\t\t\t\t\tif solution14[2] < g or (solution14[2] == g and solution14[3] <= h):\n\t\t\t\t\t\tt = (solution14[2]-solution14[0])*x*y + (solution14[3]-solution14[1]);\n\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\tsolutionh = solution14[0];\n\t\t\t\t\t\t\tsolutionm = solution14[1];\n\t\n\tlimit1 = (y-1/y)*(f/(x*y))-e/y;\n\tif limit1 <= a + 1:\n\t\tlimit1 = a + 1;\n\tlimit1 = Decimal(str(int(limit1)));\n\tlimit2 = (y-1/y)*(d/(x*y))-c/y;\n\tif limit2 >= g-1:\n\t\tlimit2=g-1;\n\tlimit2 = Decimal(str(int(limit2)));\n\n\tif limit1 >= a + 1 and limit1 <= c-1:\n\t\tsolutionNew = solve(limit1, e, 0, x*y, 0, x*y, x, y);\n\t\tif len(solutionNew) > 0:\n\t\t\tif solutionNew[0] > a or (solutionNew[0] == a and solutionNew[1] >= b):\n\t\t\t\tif solutionNew[0] < c or (solutionNew[0] == c and solutionNew[1] <= d):\n\t\t\t\t\tif solutionNew[2] > e or (solutionNew[2] == e and solutionNew[3] >= f):\n\t\t\t\t\t\tif solutionNew[2] < g or (solutionNew[2] == g and solutionNew[3] <= h):\n\t\t\t\t\t\t\tt = (solutionNew[2]-solutionNew[0])*x*y + (solutionNew[3]-solutionNew[1]);\n\t\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\t\tsolutionh = solutionNew[0];\n\t\t\t\t\t\t\t\tsolutionm = solutionNew[1];\n\tif limit1 + 1 >= a + 1 and limit1 + 1 <= c-1:\n\t\tsolutionNew = solve(limit1 + 1, e, 0, x*y, 0, x*y, x, y);\n\t\tif len(solutionNew) > 0:\n\t\t\tif solutionNew[0] > a or (solutionNew[0] == a and solutionNew[1] >= b):\n\t\t\t\tif solutionNew[0] < c or (solutionNew[0] == c and solutionNew[1] <= d):\n\t\t\t\t\tif solutionNew[2] > e or (solutionNew[2] == e and solutionNew[3] >= f):\n\t\t\t\t\t\tif solutionNew[2] < g or (solutionNew[2] == g and solutionNew[3] <= h):\n\t\t\t\t\t\t\tt = (solutionNew[2]-solutionNew[0])*x*y + (solutionNew[3]-solutionNew[1]);\n\t\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\t\tsolutionh = solutionNew[0];\n\t\t\t\t\t\t\t\tsolutionm = solutionNew[1];\n\tif limit2 >= e + 1 and limit2 <= g-1:\n\t\tsolutionNew = solve(c, limit2, 0, x*y, 0, x*y, x, y);\n\t\tif len(solutionNew) > 0:\n\t\t\tif solutionNew[0] > a or (solutionNew[0] == a and solutionNew[1] >= b):\n\t\t\t\tif solutionNew[0] < c or (solutionNew[0] == c and solutionNew[1] <= d):\n\t\t\t\t\tif solutionNew[2] > e or (solutionNew[2] == e and solutionNew[3] >= f):\n\t\t\t\t\t\tif solutionNew[2] < g or (solutionNew[2] == g and solutionNew[3] <= h):\n\t\t\t\t\t\t\tt = (solutionNew[2]-solutionNew[0])*x*y + (solutionNew[3]-solutionNew[1]);\n\t\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\t\tsolutionh = solutionNew[0];\n\t\t\t\t\t\t\t\tsolutionm = solutionNew[1];\n\tif limit1 - 1 >= e + 1 and limit2 - 1 <= g-1:\n\t\tsolutionNew = solve(c, limit2 - 1, 0, x*y, 0, x*y, x, y);\n\t\tif len(solutionNew) > 0:\n\t\t\tif solutionNew[0] > a or (solutionNew[0] == a and solutionNew[1] >= b):\n\t\t\t\tif solutionNew[0] < c or (solutionNew[0] == c and solutionNew[1] <= d):\n\t\t\t\t\tif solutionNew[2] > e or (solutionNew[2] == e and solutionNew[3] >= f):\n\t\t\t\t\t\tif solutionNew[2] < g or (solutionNew[2] == g and solutionNew[3] <= h):\n\t\t\t\t\t\t\tt = (solutionNew[2]-solutionNew[0])*x*y + (solutionNew[3]-solutionNew[1]);\n\t\t\t\t\t\t\tif t > diff:\n\t\t\t\t\t\t\t\tdiff = t;\n\t\t\t\t\t\t\t\tsolutionh = solutionNew[0];\n\t\t\t\t\t\t\t\tsolutionm = solutionNew[1];\n\n\tif solutionh == -1 or diff < 0:\n\t\tprint("-1");\n\telse:\n\t\ttz = solutionm;\n\t\tsolutionm *= 100;\n\t\ttry:\n\t\t\tr1 = integerPart(solutionm);\n\t\t\tr1 = str(r1);\n\t\t\tr1 = Decimal(r1);\n\t\t\tr2 = solutionm - r1;\n\t\t\tif r2 >= Decimal(".5"):\n\t\t\t\tr1 += Decimal("1");\n\t\t\tt1 = (r1 - r1%100)/100;\n\t\t\tt2 = r1%100;\n\t\t\tt1 = int(t1);\n\t\t\tif t2 == 0:\n\t\t\t\tt2 = "00";\n\t\t\telif t2 < 10:\n\t\t\t\tt2 = "0" + str(t2);\n\t\t\telse:\n\t\t\t\tt2 = str(t2);\n\t\texcept:\n\t\t\texit(0);\n\t\t#print str(solutionh)+":%.2f"%(solutionm);\n\t\tprint(str(solutionh)+":%d.%s"%(t1, t2));\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 31917