sumit-and-indian-currency
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Sumit had borrowed money from many of his batch mates and today he has decided to pay them  because he has got lottery today.

The amount of lottery is very large. So to count the money he decided to write the amount in Indian system first.

In the Indian system the rightmost comma is placed after three rightmost digits, and then a comma is placed after every two digits from the right.

He has asked you to write code for that.

Input

First line contains T number of test cases.

Each test case contain the amount . The amount is in string whose maximum length is 10^4.

Output

Print T lines of output each containing the amount in Indian way of writing with commas.

If amount is less than or equal to 3 digits, then do not put any commas.

Constraints

1 ≤ T ≤200

1 ≤ |amount| ≤10^4

SAMPLE INPUT
3
12345
54321
125634

SAMPLE OUTPUT
12,345
54,321
1,25,634


for _ in range(eval(input())):
	Q=input();	A,l,flag,x='',len(Q)-1,0,1;
	while l>=0:
		if flag>0:
			if x==2:
				A+=Q[l];   A+=',';	x=1;
			else:
				A+=Q[l]; x+=1;
		else:
			if x==3:
				flag=1;	x=1;	A+=Q[l]; A+=',';
			else:
				A+=Q[l];	x+=1;	
		l-=1;
	if A[len(A)-1]==',':
		temp=A[:len(A)-1];	print(temp[::-1])
	else:
		print(A[::-1]);


n=int(eval(input()))
while n>0:
	s=input()
	if len(s)<=3:
		print(s)
	else:
		s=s[::-1]
		t=s[:3]
		t=t+','
		c=0
		for i in range(3,len(s)):
			t=t+s[i]
			c=c+1
			if c==2:
				t=t+','
				c=0
		if len(s)%2!=0:
			t=t[:-1]
		print(t[::-1])
	n=n-1


for _ in range(eval(input())):
	numstr = [val for val in input()]
	numstr = numstr[::-1]
	finalstr = ""
	count = 0
	for i in numstr:
		if count ==3 or (count % 2 != 0 and count > 3):
			finalstr += ','
		finalstr += i
		count += 1
	print(finalstr[::-1])