P9874 [HackerEarth] binomial theorem
普及
题目描述

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

输入格式

见题面

输出格式

见题面

样例输入
3 1 10 2 5 4 30 SAMPLE
样例输出
x^10 5 x^4 y 4060 x^27 y^3