In my town ,there live a coder named Chef . He is a cool programmer . One day , he participate in a programming contest ,the contest give him only one problem . If he can’t solve the problem ,the problem setter will kill him . But the round allow you to help Chef. Can you save the life of Chef from problem setter ? :p
You are given two point of a straightline in X and Y axis and they are A(x1 , y1) and B(x2 ,y2) . Problem setter will give you another point C(x3 , y3) . If C exist in AB straightline ,then print “YES” . Otherwise ,print “NO” in first line and print the minimum distance from C to AB straightline in second line .
Please , save the life of Chef .
Note : It is not possible that A and B point is similar .

-----Input:-----
The first line of the input contains a single integer t (1≤t≤100) — the number of test cases .
Each test case starts with four integers( x1, y1 , x2 , y2 ) in first line .
Next line contains a single number q ,the number of queries . Each query contains two integers ( x3 ,y3 )

-----Output:-----
Print , q number of “YES” or “NO” (as it mentioned above) in each test case .For every test case , print “Test case : i ” ( 1<= i <=T )

-----Constraints-----
-1000 <=  x1 , y1 , x2 , y2 , x3 , y3 <= 1000

-----Sample Input:-----
2
3  5  6  5
2
4  5
6  8
3  4  7  10
1
7  4

-----Sample Output:-----
Test case : 1
YES
NO
3.000000
Test case : 2
NO
3.328201

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from math import sqrt
for i in range(int(input())):
	(x1, y1, x2, y2) = list(map(float, input().split()))
	m = (y2 - y1) / (x2 - x1)
	c = y2 - m * x2
	print('Test case : ', i + 1)
	q = int(input())
	for i in range(q):
		(x3, y3) = list(map(float, input().split()))
		if y3 - m * x3 - c == 0:
			print('YES')
		else:
			d = abs(y3 - m * x3 - c) / sqrt(1 + m * m)
			print('NO')
			print('%.6f' % d)


from sys import stdin
from math import ceil, gcd

def func():
	return
t = int(stdin.readline())
for _ in range(t):
	(x1, y1, x2, y2) = list(map(int, stdin.readline().split()))
	print('Test case : {}'.format(_ + 1))
	for i in range(int(stdin.readline())):
		(x, y) = list(map(int, stdin.readline().split()))
		if x1 == x2:
			if x == x1:
				print('YES')
			else:
				print('NO')
				d = abs(x - x1)
				d = str(d) + '.000000'
				print(d)
		else:
			m = (y2 - y1) / (x2 - x1)
			c = y1 - m * x1
			if y == m * x + c:
				print('YES')
			else:
				print('NO')
				d = abs(y - m * x - c) / (1 + m ** 2) ** 0.5
				d = str(round(d, 6))
				for i in range(len(d)):
					if d[i] == '.':
						pos = i
						break
				if len(d) - pos - 1 == 6:
					print(d)
				else:
					d += '0' * (7 - len(d) + pos)
					print(d)


from math import sqrt

def distance():
	m = (y2 - y1) / (x2 - x1)
	dis = (q - m * p + m * x1 - y1) / sqrt(m * m + 1)
	return abs(dis)
for _ in range(int(input())):
	print('Test case :', _ + 1)
	(x1, y1, x2, y2) = map(int, input().split())
	Q = int(input())
	for query in range(Q):
		(p, q) = map(int, input().split())
		if x1 == x2:
			if p == x1:
				print('YES')
			else:
				print('NO')
				print('{0:.6f}'.format(abs(x1 - p)))
		elif x1 == p:
			print('NO')
			print('{0:.6f}'.format(distance()))
		elif (y1 - y2) / (x1 - x2) == (y1 - q) / (x1 - p):
			print('YES')
		else:
			print('NO')
			print('{0:.6f}'.format(distance()))