Problem: Description

You are tasked to determine the kth term of the binomial expansion of the expression (x + y)^n.

Input Format

The input starts with an integer M > 0, followed by M pairs of integers k, n, where 1 ≤ k ≤ n+1 and 0 < n < 1000.

Output Format

For every pair of integers k, n, output the correct kth term of the binomial expansion of (x+y)^n. If the coefficient is 1, the coefficient should not be printed. If the power of x is 0, the variable x should not be printed. If the power of y is 0, the variable y should not be printed. If the power of x is 1, the power of variable x should not be printed. If the power of y is 1, the power of variable y should not be printed. In general, the format of each output is c x^a y^b, where c is the coefficient, a is the power of x and b is the power of y.

SAMPLE INPUT
3
1 10
2 5
4 30

SAMPLE OUTPUT
x^10
5 x^4 y
4060 x^27 y^3

Solution (in PYTHON):

Solution:
import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

t = int(raw_input())
while t>0:
	a = raw_input().split(' ')
	a = [int(x) for x in a]
	c = nCr(a[1],a[0]-1)
	x = a[1]-a[0]+1
	y = a[0]-1
	
	if(c!=1):
		print c,

	if(x!=0):
		print "x^%d"%x,

	if(y==1):
		print "y"
	elif(y==0):
		print ""
	else:
		print "y^%d"%y
		
	t=t-1