Alice and Bob created $N$ and $M$ recipes, respectively ($N, M \ge 1$), and submitted them to Chef for evaluation. Each recipe is represented by a string containing only lowercase English letters. Let's denote Alice's recipes by $A_1, A_2, \ldots, A_N$ and Bob's recipes by $B_1, B_2, \ldots, B_M$.
Accidentally, Chef mixed up those recipes ― now, he has $L = N+M$ recipes in a sequence $S_1, S_2, \ldots, S_L$. Thankfully, the recipes created by Alice and Bob are distinguishable from each other. It is well-known that for each recipe $s$ created by Alice, the following property holds, and for each recipe created by Bob, it does not hold: For each $1 \le l < r \le |s|$, the substring $s_l, s_{l+1}, \ldots, s_r$ contains at least as many vowels as consonants. The letters 'a', 'e', 'i', 'o', 'u' are vowels, while the other letters are consonants.
The score of a candidate who made $K$ recipes is calculated as the product of $\frac{x_c}{fx_c^K}$ for all letters $c$ that occur in at least one of these recipes; here, $x_c$ is the number of recipes which contain the letter $c$ and $fx_c$ is the total number of occurrences of this letter in all $K$ recipes.
Let's denote the scores of Alice and Bob by $sc_A$ and $sc_B$ respectively. Chef wants to know their ratio $sc_A/sc_B$. We know that Chef is a legendary cook, but he is not very good at calculating, so he is asking you to find that number.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $L$.
- $L$ lines follow. For each valid $i$, the $i$-th of these lines contains a single string $S_i$.

-----Output-----
For each test case, if the ratio of scores exceeds $10^7$, print a single line containing the string "Infinity" (without quotes); otherwise, print a single line containing one real number $sc_A/sc_B$.
Your answer will be considered correct if its absolute or relative error does not exceed $10^{-6}$. It is guaranteed that $sc_A/sc_B$ does not lie in the range $10^7 \pm 10$.

-----Constraints-----
- $1 \le T \le 10^5$
- $2 \le L \le 10^5$
- $2 \le |S_i| \le 10^5$ for each valid $i$
- for each valid $i$, $S_i$ contains only lowercase English letters
- the sum of $|S_1| + |S_2| + \ldots + |S_L|$ over all test cases does not exceed $10^7$

-----Subtasks-----
Subtask #1 (25 points):
- $L \le 10$
- $|S_i| \le 10$ for each valid $i$
Subtask #2 (75 points): original constraints

-----Example Input-----
2
4
aba
abc
bab
aac
3
aba
baab
abc

-----Example Output-----
1.1250000
0.0277778

-----Explanation-----
Example case 1: The recipes "aba" and "aac" are created by Alice, while the recipes "abc" and "bab" are created by Bob. The scores are:
- $sc_A = \frac{x_a}{fx_a^N} \cdot \frac{x_b}{fx_b^N} \cdot \frac{x_c}{fx_c^N} = \frac{2}{4^2} \cdot \frac{1}{1^2} \cdot \frac{1}{1^2} = \frac{1}{8}$
- $sc_B = \frac{x_a}{fx_a^M} \cdot \frac{x_b}{fx_b^M} \cdot \frac{x_c}{fx_c^M} = \frac{2}{2^2} \cdot \frac{2}{3^2} \cdot \frac{1}{1^2} = \frac{1}{9}$
- $\frac{sc_A}{sc_B} = \frac{1/8}{1/9} = 1.125$

Starter code:

Solutions:
# v = ["a","e","i","o","u"]
# for _ in range(int(input())):
#   n = int(input())
#   a,b = [],[]
#   for i in range(n):
#       s = input()
#       isa = True
#       for j in range(1,len(s) - 1):
#           if(s[j] in v):
#               if(s[j - 1] not in v and s[j + 1] not in v):
#                   isa = False
#           else:
#               if(s[j - 1] not in v or s[j + 1] not in v):
#                   isa = False
#           if(not isa):
#               break
#       if(s[0] not in v and s[1] not in v):
#           isa = False
#       if(s[-1] not in v and s[-2] not in v):
#           isa = False
#       if(isa):
#           a.append(s)
#       else:
#           b.append(s)
#   dicta,dictb = {},{}
#   for i in a:
#       freq = {}
#       for j in i:
#           if(j in freq):
#               freq[j] += 1
#           else:
#               freq[j] = 1
#       for j in freq:
#           if(j not in dicta):
#               dicta[j] = (1,freq[j])
#           else:
#               dicta[j] = (dicta[j][0] + 1,dicta[j][1] + freq[j])
#   for i in b:
#       freq = {}
#       for j in i:
#           if(j in freq):
#               freq[j] += 1
#           else:
#               freq[j] = 1
#       for j in freq:
#           if(j not in dictb):
#               dictb[j] = (1,freq[j])
#           else:
#               dictb[j] = (dictb[j][0] + 1,dictb[j][1] + freq[j])
#   ans = 1
#   for i in dicta:
#       ans *= dicta[i][0]
#   for i in dictb:
#       ans /= dictb[i][0]
#   x,y = 1,1
#   for i in dictb:
#       x *= dictb[i][1]
#   for i in dicta:
#       y *= dicta[i][1]
#   alice,bob = len(a),len(b)
#   for i in range(bob):
#       while(alice > 0 and ans > 10**7):
#           ans /= y
#           alice -= 1
#       ans *= x
#       if(ans > 10**7 and alice == 0):
#           break
#   while(alice > 0):
#       ans /= y
#       if(ans < 1 and alice > 100):
#           ans = 0
#           break
#       alice -= 1
#   if(ans > 10**7):
#       print("Infinity")
#   else:
#       print(ans)
# #partailly correct [75 pts]
#sys.stdin.readline() and sys.stdout.write() are faster I/O methods than input()     and print()
from sys import stdin
z=['a','i','e','o','u']
t=int(stdin.readline())
while(t>0):
 t-=1
 n=int(stdin.readline())
 alice=[]
 bob=[]
 for j in range(n):
  s=str(stdin.readline().strip("\n"))
  # print(s)
  isalice=True
  for i in range(1,len(s)-1):
   if(s[i] in z):
    if(s[i-1] not in z and s[i+1] not in z):
     isalice=False
   else:
    if(s[i-1] not in z or s[i+1] not in z):
     isalice=False
   if(not isalice):
    break
  if(s[0] not in z and s[1] not in z):
   isalice=False
  if(s[-1] not in z and s[-2] not in z):
   isalice=False
  if(isalice):
   alice.append(s)
  else:
   bob.append(s)
 ali={}
 bo={}
 for i in alice:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in ali:
    ali[j]=(1,d[j])
   else:
    ali[j]=(ali[j][0]+1,ali[j][1]+d[j])
 for i in bob:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in bo:
    bo[j]=(1,d[j])
   else:

    bo[j]=(bo[j][0]+1,bo[j][1]+d[j])
 ans=1
 for i in ali:
  ans*=ali[i][0]
 for i in bo:
  ans=ans/bo[i][0]
 x=1
 y=1

 for i in bo:
  x=x*bo[i][1]
 for i in ali:
  y=y*ali[i][1]
 # print(x,y)
 alice=len(alice)
 bob=len(bob)
 for i in range(bob):
  while(alice>0 and ans>10000000):
   ans=ans/y
   alice-=1
  ans*=x
  if(ans>10000000 and alice==0):
   break
 while(alice>0):
  ans=ans/y
  if(ans<1 and alice>100):
   ans=0
   break
  alice-=1
 if(ans>10000000):
  print("Infinity")
 else:
  print(ans)
#AC


# v = ["a","e","i","o","u"]
# for _ in range(int(input())):
#   n = int(input())
#   a,b = [],[]
#   for i in range(n):
#       s = input()
#       isa = True
#       for j in range(1,len(s) - 1):
#           if(s[j] in v):
#               if(s[j - 1] not in v and s[j + 1] not in v):
#                   isa = False
#           else:
#               if(s[j - 1] not in v or s[j + 1] not in v):
#                   isa = False
#           if(not isa):
#               break
#       if(s[0] not in v and s[1] not in v):
#           isa = False
#       if(s[-1] not in v and s[-2] not in v):
#           isa = False
#       if(isa):
#           a.append(s)
#       else:
#           b.append(s)
#   dicta,dictb = {},{}
#   for i in a:
#       freq = {}
#       for j in i:
#           if(j in freq):
#               freq[j] += 1
#           else:
#               freq[j] = 1
#       for j in freq:
#           if(j not in dicta):
#               dicta[j] = (1,freq[j])
#           else:
#               dicta[j] = (dicta[j][0] + 1,dicta[j][1] + freq[j])
#   for i in b:
#       freq = {}
#       for j in i:
#           if(j in freq):
#               freq[j] += 1
#           else:
#               freq[j] = 1
#       for j in freq:
#           if(j not in dictb):
#               dictb[j] = (1,freq[j])
#           else:
#               dictb[j] = (dictb[j][0] + 1,dictb[j][1] + freq[j])
#   ans = 1
#   for i in dicta:
#       ans *= dicta[i][0]
#   for i in dictb:
#       ans /= dictb[i][0]
#   x,y = 1,1
#   for i in dictb:
#       x *= dictb[i][1]
#   for i in dicta:
#       y *= dicta[i][1]
#   alice,bob = len(a),len(b)
#   for i in range(bob):
#       while(alice > 0 and ans > 10**7):
#           ans /= y
#           alice -= 1
#       ans *= x
#       if(ans > 10**7 and alice == 0):
#           break
#   while(alice > 0):
#       ans /= y
#       if(ans < 1 and alice > 100):
#           ans = 0
#           break
#       alice -= 1
#   if(ans > 10**7):
#       print("Infinity")
#   else:
#       print(ans)
# #partailly correct [75 pts]
#sys.stdin.readline() and sys.stdout.write() are faster I/O methods than input()     and print()
from sys import stdin
z=['a','i','e','o','u']
t=int(stdin.readline())
while(t>0):
 t-=1
 n=int(stdin.readline())
 alice=[]
 bob=[]
 for j in range(n):
  s=str(stdin.readline().strip("\n"))
  # print(s)
  isalice=True
  for i in range(1,len(s)-1):
   if(s[i] in z):
    if(s[i-1] not in z and s[i+1] not in z):
     isalice=False
   else:
    if(s[i-1] not in z or s[i+1] not in z):
     isalice=False
   if(not isalice):
    break
  if(s[0] not in z and s[1] not in z):
   isalice=False
  if(s[-1] not in z and s[-2] not in z):
   isalice=False
  if(isalice):
   alice.append(s)
  else:
   bob.append(s)
 ali={}
 bo={}
 for i in alice:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in ali:
    ali[j]=(1,d[j])
   else:
    ali[j]=(ali[j][0]+1,ali[j][1]+d[j])
 for i in bob:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in bo:
    bo[j]=(1,d[j])
   else:

    bo[j]=(bo[j][0]+1,bo[j][1]+d[j])
 ans=1
 for i in ali:
  ans*=ali[i][0]
 for i in bo:
  ans=ans/bo[i][0]
 x=1
 y=1

 for i in bo:
  x=x*bo[i][1]
 for i in ali:
  y=y*ali[i][1]
 # print(x,y)
 alice=len(alice)
 bob=len(bob)
 for i in range(bob):
  while(alice>0 and ans>10000000):
   ans=ans/y
   alice-=1
  ans*=x
  if(ans>10000000 and alice==0):
   break
 while(alice>0):
  ans=ans/y
  if(ans<1 and alice>100):
   ans=0
   break
  alice-=1
 if(ans>10000000):
  print("Infinity")
 else:
  print(ans)
#AC


v = ["a","e","i","o","u"]
for _ in range(int(input())):
 n = int(input())
 a,b = [],[]
 for i in range(n):
  s = input()
  isa = True
  for j in range(1,len(s) - 1):
   if(s[j] in v):
    if(s[j - 1] not in v and s[j + 1] not in v):
     isa = False
   else:
    if(s[j - 1] not in v or s[j + 1] not in v):
     isa = False
   if(not isa):
    break
  if(s[0] not in v and s[1] not in v):
   isa = False
  if(s[-1] not in v and s[-2] not in v):
   isa = False
  if(isa):
   a.append(s)
  else:
   b.append(s)
 dicta,dictb = {},{}
 for i in a:
  freq = {}
  for j in i:
   if(j in freq):
    freq[j] += 1
   else:
    freq[j] = 1
  for j in freq:
   if(j not in dicta):
    dicta[j] = (1,freq[j])
   else:
    dicta[j] = (dicta[j][0] + 1,dicta[j][1] + freq[j])
 for i in b:
  freq = {}
  for j in i:
   if(j in freq):
    freq[j] += 1
   else:
    freq[j] = 1
  for j in freq:
   if(j not in dictb):
    dictb[j] = (1,freq[j])
   else:
    dictb[j] = (dictb[j][0] + 1,dictb[j][1] + freq[j])
 ans = 1
 for i in dicta:
  ans *= dicta[i][0]
 for i in dictb:
  ans /= dictb[i][0]
 x,y = 1,1
 for i in dictb:
  x *= dictb[i][1]
 for i in dicta:
  y *= dicta[i][1]
 alice,bob = len(a),len(b)
 for i in range(bob):
  while(alice > 0 and ans > 10**7):
   ans /= y
   alice -= 1
  ans *= x
  if(ans > 10**7 and alice == 0):
   break
 while(alice > 0):
  ans /= y
  if(ans < 1 and alice > 100):
   ans = 0
   break
  alice -= 1
 if(ans > 10**7):
  print("Infinity")
 else:
  print(ans)
#partailly correct [75 pts]


from sys import stdin
z=['a','i','e','o','u']
t=int(stdin.readline())
while(t>0):
 t-=1
 n=int(stdin.readline())
 alice=[]
 bob=[]
 for j in range(n):
  s=str(stdin.readline().strip("\n"))
  # print(s)
  isalice=True
  for i in range(1,len(s)-1):
   if(s[i] in z):
    if(s[i-1] not in z and s[i+1] not in z):
     isalice=False
   else:
    if(s[i-1] not in z or s[i+1] not in z):
     isalice=False
   if(not isalice):
    break
  if(s[0] not in z and s[1] not in z):
   isalice=False
  if(s[-1] not in z and s[-2] not in z):
   isalice=False
  if(isalice):
   alice.append(s)
  else:
   bob.append(s)
 ali={}
 bo={}
 for i in alice:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in ali:
    ali[j]=(1,d[j])
   else:
    ali[j]=(ali[j][0]+1,ali[j][1]+d[j])
 for i in bob:
  d={}
  for j in i:
   if(j in d):
    d[j]+=1
   else:
    d[j]=1
  for j in d:
   if j not in bo:
    bo[j]=(1,d[j])
   else:

    bo[j]=(bo[j][0]+1,bo[j][1]+d[j])
 ans=1
 for i in ali:
  ans*=ali[i][0]
 for i in bo:
  ans=ans/bo[i][0]
 x=1
 y=1

 for i in bo:
  x=x*bo[i][1]
 for i in ali:
  y=y*ali[i][1]
 # print(x,y)
 alice=len(alice)
 bob=len(bob)
 for i in range(bob):
  while(alice>0 and ans>10000000):
   ans=ans/y
   alice-=1
  ans*=x
  if(ans>10000000 and alice==0):
   break
 while(alice>0):
  ans=ans/y
  if(ans<1 and alice>100):
   ans=0
   break
  alice-=1
 if(ans>10000000):
  print("Infinity")
 else:
  print(ans)

def printf(a):
 print(a)

def enter_int():
 a = int(input())
 return a

def enter_str():
 a = input()
 return a 

v = ["a","e","i","o","u"]
for _ in range(enter_int()):
 n = enter_int()
 a,b = [],[]
 for i in range(n):
  s = enter_str()
  isa = True
  for j in range(1,len(s) - 1):
   if(s[j] in v):
    if(s[j - 1] not in v and s[j + 1] not in v):
     isa = False
   else:
    if(s[j - 1] not in v or s[j + 1] not in v):
     isa = False
   if(not isa):
    break
  if(s[0] not in v and s[1] not in v):
   isa = False
  if(s[-1] not in v and s[-2] not in v):
   isa = False
  if(isa):
   a.append(s)
  else:
   b.append(s)
 dicta,dictb = {},{}
 for i in a:
  freq = {}
  for j in i:
   if(j in freq):
    freq[j] += 1
   else:
    freq[j] = 1
  for j in freq:
   if(j not in dicta):
    dicta[j] = (1,freq[j])
   else:
    dicta[j] = (dicta[j][0] + 1,dicta[j][1] + freq[j])
 for i in b:
  freq = {}
  for j in i:
   if(j in freq):
    freq[j] += 1
   else:
    freq[j] = 1
  for j in freq:
   if(j not in dictb):
    dictb[j] = (1,freq[j])
   else:
    dictb[j] = (dictb[j][0] + 1,dictb[j][1] + freq[j])
 ans = 1
 for i in dicta:
  ans *= dicta[i][0]
 for i in dictb:
  ans /= dictb[i][0]
 x,y = 1,1
 for i in dictb:
  x *= dictb[i][1]
 for i in dicta:
  y *= dicta[i][1]
 alice,bob = len(a),len(b)
 for i in range(bob):
  while(alice > 0 and ans > 10**7):
   ans /= y
   alice -= 1
  ans *= x
  if(ans > 10**7 and alice == 0):
   break
 while(alice > 0):
  ans /= y
  if(ans < 1 and alice > 100):
   ans = 0
   break
  alice -= 1
 if(ans > 10**7):
  printf("Infinity")
 else:
  printf(ans)

import math
def score(df):
 res,fx,li2,x = {} ,1,{},1
 for val in df:
  for key in val:
   if key not in res:res[key]=1
   else:res[key]+=1
 for val in res.values():fx=fx*val 
 for val in res:
  li2[val]=0
  for i in df:
   if val in i:li2[val]+=1 
 for val in li2: x *= li2[val]
 return [x,fx]
def prog(li,al,bo):
 for cur in li:
  prev,f = -1,0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:prev = j
  if f==1:bo.append(cur)
  else:al.append(cur) 
 sca,scb = score(al),score(bo)
 ans1 = math.log10(sca[0])+len(bo)*math.log10(scb[1])
 ans2 = math.log10(scb[0])+len(al)*(math.log10(sca[1]))
 return (ans1-ans2 ) 
for i in range(int(input())):
 li,x =[],int(input())
 for i in range(x):li.append(input())
 final =prog(li,[],[])
 print("Infinity") if final >7.0 else print(pow(10,final))

# cook your dish here
import math
import decimal
decimal.getcontext().prec = 1000

t=int(input())

for _ in range(t):

 l=int(input())
 alice=[]
 bob=[]
 alice_all=""
 bob_all=""
 vowels=['a','e','i','o','u']
 for i in range(l):
  temp=input()
  consonant_index=-1
  for j in range(len(temp)):
   if temp[j] in vowels:
    continue
   else:
    if consonant_index==-1:
     consonant_index=j
    else:
     if j-consonant_index<=2:
      bob.append(temp)
      bob_all=bob_all+temp
      break
     else:
      consonant_index=j
  else:
   alice.append(temp)
   alice_all=alice_all+temp

 if l<=10:
  n=len(alice)
  m=len(bob)

  score_A,score_B=1,1
  x_a,x_b=1,1
  fx_a,fx_b=1,1
  for i in range(97,123):
   char=chr(i)
   if char in alice_all:
    rec_a=[x for x in alice if char in x]
    x_a*=len(rec_a)
    fx_a=fx_a * alice_all.count(char)
    

   if char in bob_all:
    rec_b=[x for x in bob if char in x]
    x_b*=len(rec_b)
    fx_b=fx_b * bob_all.count(char)

  fx_a=math.pow(fx_a,n)
  fx_b=math.pow(fx_b,m) 
  score_A=x_a/fx_a
  score_B=x_b/fx_b
  ans=score_A/score_B
  if ans>10000000:
   print("Infinity")
  else:
   print("{0:.9f}".format(ans))
 else:

  n=decimal.Decimal(len(alice))
  m=decimal.Decimal(len(bob))

  score_A=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  score_B=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  x_a=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  x_b=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  denom_a=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  denom_b=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  fx_a=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  fx_b=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  ans=decimal.Decimal(1).quantize(decimal.Decimal('0.0000000001'))
  charInA=''.join(sorted(set(alice_all)))
  charInB=''.join(sorted(set(bob_all)))
  ctx=decimal.getcontext().copy()
  ctx.Emax=decimal.MAX_EMAX
  ctx.Emin=decimal.MIN_EMIN
  ctx.prec=100


  for i in charInA:
   rec_a=[x for x in alice if i in x]
   if len(rec_a)>0:
    x_a=ctx.multiply(x_a,len(rec_a))
    fx_a=ctx.multiply(fx_a,alice_all.count(i))

  for i in charInB:
   rec_b=[x for x in bob if i in x]
   if len(rec_b)>0:
    x_b=ctx.multiply(x_b,len(rec_b))
    fx_b=ctx.multiply(fx_b,bob_all.count(i))
  
  denom_a=ctx.power(fx_a,n)
  denom_b=ctx.power(fx_b,m)
  score_A=ctx.divide(x_a,denom_a)
  score_B=ctx.divide(x_b,denom_b)
  
  ans=ctx.divide(score_A,score_B)

  if ans>10000000:
   print("Infinity")
  else:
   print("{0:.9f}".format(ans))

#RAJ JAIN

import decimal
decimal.getcontext().prec = 16
decimal.getcontext().Emin = -1000000000
decimal.getcontext().Emax = 1000000000

def vowel(x):
 return x in 'aeiou'

def is_alice(s):
 if not vowel(s[0]) and not vowel(s[1]):
  return False

 for i in range(2, len(s)):
  if not vowel(s[i]) and (not vowel(s[i - 1]) or not vowel(s[i - 2])):
   return False

 return True

def fast_exp(x, p):
 x = decimal.Decimal(x)
 ans = decimal.Decimal(1)
 while p > 0:
  if p & 1:
   ans *= x
  x *= x
  p >>= 1
 return ans

def get_score(strings):
 k = len(strings)
 xc = [0] * 26
 fxc = [0] * 26

 for s in strings:
  f = [0] * 26
  for x in s:
   f[ord(x) - 97] += 1

  for i in range(26):
   if f[i] > 0:
    xc[i] += 1
    fxc[i] += f[i]

 pxc, pfxc = 1, 1
 for i in range(26):
  if xc[i] > 0:
   pxc *= xc[i]
   pfxc *= fxc[i]

 return decimal.Decimal(pxc) / fast_exp(pfxc, k)
 
for _ in range(int(input())):
 alice, bob = [], []
 for _ in range(int(input())):
  inp = input()
  if is_alice(inp):
   alice.append(inp)
  else:
   bob.append(inp)

 alice_score = get_score(alice)
 bob_score = get_score(bob)

 ratio = alice_score / bob_score
 if ratio > 10000000.0:
  print('Infinity')
 else:
  print(ratio)


import math
from math import log10

def score(df):
#     a=""
 n=len(df)
 
 #calulation of fxc
#     for val in df:
#         a=a+val     
  
 
 res = {} 
 for val in df:
  for key in val:
   if key not in res:
    res[key]=1
   else:
    res[key]+=1
     
 
#     print(res)
 fx=1
 for val in res.values():
  fx=fx*val
  
 li2={}
 #calculation of xc
 for val in res:
  li2[val]=0
  for i in df:
   if val in i:
    li2[val]+=1
 
 x=1
 for val in li2:
  
  x=x*li2[val]
#     print(x,fx,"x","fc")
 return [x,fx]


def prog(li):
 al=[]
 bo=[]
 for cur in li:
  prev = -1
  f = 0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:
     prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:
      prev = j
  if f==1:
   bo.append(cur)
  else:
   al.append(cur)
   
#     print(al)
#     print(bo)
 sca=score(al)
 scb=score(bo)
#     print(sca,scb,"dd")
 ans1 = log10(sca[0])+len(bo)*log10(scb[1])
 ans2 = log10(scb[0])+len(al)*(log10(sca[1]))
 ans1 = ans1-ans2
#     print(ans1)
 
 return ans1
 
  
    
    
t = int(input())
for i in range(0,t):
 li=[]
 x= int(input())
 for i in range(0,x):
  e=input()
  li.append(e)
 final =prog(li)
 if final >7.0:
  print("Infinity")
 else:
  print(pow(10,final))

from math import log10
import math
for _ in range(int(input())):
 n = int(input())
 alice = []
 bob = []
 words = []
 for i in range(n):
  words.append(input())
 for cur in words:
  prev = -1
  f = 0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:
     prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:
      prev = j
  if f==1:
   bob.append(cur)
  else:
   alice.append(cur)
  
#     print(alice)
#     print(bob)
 # Alice 
 n1 = len(alice)
 freq_a = {}
 for i in alice:
  for j in i:
   if j not in freq_a:
    freq_a[j] = 1
   else:
    freq_a[j]+=1
 num_a = {}
 for i in freq_a:
  num_a[i] = 0
  for j in alice:
   if i in j:
    num_a[i]+=1
#     print(freq_a)
#     print(num_a)
 num1 = 1
 den1 = 1
 for i in num_a:
  num1 = (num1*num_a[i])
  den1 = den1*freq_a[i]
 
 
 # Bob alphabets
 n2 = len(bob)
 freq_b = {}
 for i in bob:
  for j in i:
   if j not in freq_b:
    freq_b[j] = 1
   else:
    freq_b[j]+=1
 num_b = {}
 for i in freq_b:
  num_b[i] = 0
  for j in bob:
   if i in j:
    num_b[i]+=1
 num2 = 1
 den2 = 1
 for i in num_b:
  num2 = (num2*num_b[i])
  den2 = den2*freq_b[i]
 # # if n<=10:
 #     if n2>=n1:
 #         ans = pow(den2/den1,n1)*pow(den2,n2-n1)
 #     else:
 #         ans = pow(den2/den1,n2)*pow(den1,-(n1-n2))
 #     t = num1/num2
 #     ans = ans*t
 #     if ans>10000000.0:
 #         print("Infinity")
 #     else:
 #         print(ans)
 # else:
 ans1 = log10(num1)+n2*log10(den2)
 ans2 = log10(num2)+n1*(log10(den1))
 ans1 = ans1-ans2
 if ans1 > 7.0:
  print("Infinity")
 else:
  print(pow(10,ans1))

from math import log10
import math
for _ in range(int(input())):
 n = int(input())
 alice = []
 bob = []
 words = []
 for i in range(n):
  words.append(input())
 for cur in words:
  prev = -1
  f = 0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:
     prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:
      prev = j
  if f==1:
   bob.append(cur)
  else:
   alice.append(cur)
  
#     print(alice)
#     print(bob)
 # Alice 
 n1 = len(alice)
 freq_a = {}
 for i in alice:
  for j in i:
   if j not in freq_a:
    freq_a[j] = 1
   else:
    freq_a[j]+=1
 num_a = {}
 for i in freq_a:
  num_a[i] = 0
  for j in alice:
   if i in j:
    num_a[i]+=1
#     print(freq_a)
#     print(num_a)
 num1 = 1
 den1 = 1
 for i in num_a:
  num1 = (num1*num_a[i])
  den1 = den1*freq_a[i]
 
 
 # Bob alphabets
 n2 = len(bob)
 freq_b = {}
 for i in bob:
  for j in i:
   if j not in freq_b:
    freq_b[j] = 1
   else:
    freq_b[j]+=1
 num_b = {}
 for i in freq_b:
  num_b[i] = 0
  for j in bob:
   if i in j:
    num_b[i]+=1
 num2 = 1
 den2 = 1
 for i in num_b:
  num2 = (num2*num_b[i])
  den2 = den2*freq_b[i]
 if n<=10:
  if n2>=n1:
   ans = pow(den2/den1,n1)*pow(den2,n2-n1)
  else:
   ans = pow(den2/den1,n2)*pow(den1,-(n1-n2))
  t = num1/num2
  ans = ans*t
  if ans>10000000.0:
   print("Infinity")
  else:
   print(ans)
 else:
  ans1 = log10(num1)+n2*log10(den2)
  ans2 = log10(num2)+n1*(log10(den1))
  ans1 = ans1-ans2
  if ans1 > 7.0:
   print("Infinity")
  else:
   print(pow(10,ans1))

from math import log10
import math
for _ in range(int(input())):
 n = int(input())
 alice = []
 bob = []
 words = []
 for i in range(n):
  words.append(input())
 for cur in words:
  prev = -1
  f = 0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:
     prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:
      prev = j
  if f==1:
   bob.append(cur)
  else:
   alice.append(cur)
  
#     print(alice)
#     print(bob)
 # Alice 
 n1 = len(alice)
 freq_a = {}
 for i in alice:
  for j in i:
   if j not in freq_a:
    freq_a[j] = 1
   else:
    freq_a[j]+=1
 num_a = {}
 for i in freq_a:
  num_a[i] = 0
  for j in alice:
   if i in j:
    num_a[i]+=1
#     print(freq_a)
#     print(num_a)
 num1 = 1
 den1 = 1
 for i in num_a:
  num1 = (num1*num_a[i])
  den1 = den1*freq_a[i]
 
 
 # Bob alphabets
 n2 = len(bob)
 freq_b = {}
 for i in bob:
  for j in i:
   if j not in freq_b:
    freq_b[j] = 1
   else:
    freq_b[j]+=1
 num_b = {}
 for i in freq_b:
  num_b[i] = 0
  for j in bob:
   if i in j:
    num_b[i]+=1
 num2 = 1
 den2 = 1
 for i in num_b:
  num2 = (num2*num_b[i])
  den2 = den2*freq_b[i]
 if n<=10:
#         if n2>=n1:
#             ans = pow(den2/den1,n1)*pow(den2,n2-n1)
#         else:
#             ans = pow(den2/den1,n2)*pow(den1,-(n1-n2))
#         t = num1/num2
#         ans = ans*t
#         if ans>10000000.0:
#             print("Infinity")
#         else:
#             print(ans)
#     else:
  ans1 = log10(num1)+n2*log10(den2)
  ans2 = log10(num2)+n1*(log10(den1))
  ans1 = ans1-ans2
  if ans1 > 7.0:
   print("Infinity")
  else:
   print(pow(10,ans1))

from math import log10
import math
for _ in range(int(input())):
 n = int(input())
 alice = []
 bob = []
 words = []
 for i in range(n):
  words.append(input())
 for cur in words:
  prev = -1
  f = 0
  for j in range(len(cur)):
   if cur[j] not in ['a','e','i','o','u']:
    if prev==-1:
     prev = j
    else:
     if abs(prev-j)==2 or abs(prev-j)==1:
      f = 1
      break
     else:
      prev = j
  if f==1:
   bob.append(cur)
  else:
   alice.append(cur)
  
 # Alice 
 n1 = len(alice)
 freq_a = {}
 for i in alice:
  for j in i:
   if j not in freq_a:
    freq_a[j] = 1
   else:
    freq_a[j]+=1
 num_a = {}
 for i in freq_a:
  num_a[i] = 0
  for j in alice:
   if i in j:
    num_a[i]+=1
 num1 = 1
 den1 = 1
 for i in num_a:
  num1 = (num1*num_a[i])
  den1 = den1*freq_a[i]
 
 
 # Bob alphabets
 n2 = len(bob)
 freq_b = {}
 for i in bob:
  for j in i:
   if j not in freq_b:
    freq_b[j] = 1
   else:
    freq_b[j]+=1
 num_b = {}
 for i in freq_b:
  num_b[i] = 0
  for j in bob:
   if i in j:
    num_b[i]+=1
 num2 = 1
 den2 = 1
 for i in num_b:
  num2 = (num2*num_b[i])
  den2 = den2*freq_b[i]
 if n<=10:
  if n2>=n1:
   ans = pow(den2/den1,n1)*pow(den2,n2-n1)
  else:
   ans = pow(den2/den1,n2)*pow(den1,-(n1-n2))
  t = num1/num2
  ans = ans*t
  if ans>10000000.0:
   print("Infinity")
  else:
   print(ans)
 else:
  ans1 = log10(num1)+n2*log10(den2)
  ans2 = log10(num2)+n1*(log10(den1))
  ans1 = ans1-ans2
  if ans1 > 7.0:
   print("Infinity")
  else:
   print(pow(10,ans1))

import math
def score(a):
 count = {}
 recipes = {}
 for i in range(len(a)):
  x = a[i]
  for j in range(len(x)):
   if x[j] in count:
    count[x[j]] += 1
   else:
    count[x[j]] = 1
  for ch in set(x):
   if ch in recipes:
    recipes[ch] += 1
   else:
    recipes[ch] = 1
 num, den = 0, 0
 for key in recipes:
  # print(key, '{}/{}**{}'.format(recipes[key], count[key], len(a)))
  num += math.log(recipes[key])
  den += len(a) * math.log(count[key])
  # prod *= recipes[key] / (count[key] ** len(a))
 return math.exp(num - den)
t = int(input())
for _ in range(t):
 l = int(input())
 alice = []
 bob = []
 vowels = set('aeiou')
 for i in range(l):
  s = input()
  count = 2
  for j in range(len(s)):
   if s[j] in vowels:
    count += 1
   else:
    if count <= 1:
     bob.append(s)
     break
    count = 0
  else:
   alice.append(s)
 # print(alice, bob)
 s1 = score(alice)
 s2 = score(bob)
 # print(len(alice), len(bob))
 # print(sA, sB)
 if s2 == 0 or math.exp(math.log(s1) - math.log(s2)) > 10**7:
  print('Infinity')
 else:
  print(math.exp(math.log(s1) - math.log(s2)))


import time
vowels = 'aeiou'
start_time = time.time()
def main():
 import math as m
 ryt = m.log(10**7, 2)
 lyt = m.log(0.0000009, 2)
 t = int(input())
 v = {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
 for qwer in range(t):
  l = int(input())
  a = []
  b = []
  for wer in range(l):
   s = input()
   n = len(s)
   c1 = 0
   for i in range(n):
    if s[i] not in v:
     if i+1 < n:
      if s[i+1] not in v:
       c1 = 1
       break
     if i+2 < n:
      if s[i+2] not in v:
       c1 = 1
       break
   if c1 == 1:
    b.append(s)
   else:
    a.append(s)
  # for _ in range(l):
  #     flag = False
  #     s = input()
  #     for i in range(len(s)-2):
  #         if s[i] not in vowels:
  #             if s[i+1] not in vowels or s[i+2] not in vowels:
  #                 flag = True
  #                 break
  #         else:
  #             if s[i+1] not in vowels and s[i+2] not in vowels:
  #                 flag = True 
  #                 break
  #     if flag:
  #         b.append(s)
  #     else:
  #         a.append(s)
  xa = {}
  fxa = {}
  xb = {}
  fxb = {}
  ka = len(a)
  kb = len(b)
  for i in range(ka):
   d = {}
   for j in range(len(a[i])):
    if a[i][j] in d:
     d[a[i][j]] += 1
    else:
     d[a[i][j]] = 1
   for u in d:
    if u in xa:
     xa[u] += 1
     fxa[u] += d[u]
    else:
     xa[u] = 1
     fxa[u] = d[u]
  for i1 in range(kb):
   d = {}
   for j1 in range(len(b[i1])):
    if b[i1][j1] in d:
     d[b[i1][j1]] += 1
    else:
     d[b[i1][j1]] = 1
   for u1 in d:
    if u1 in xb:
     xb[u1] += 1
     fxb[u1] += d[u1]
    else:
     xb[u1] = 1
     fxb[u1] = d[u1]
  ans = 0
  for y in xa:
   ans += m.log(xa[y], 2)-ka*(m.log(fxa[y], 2))
  for r in xb:
   ans += kb*(m.log(fxb[r], 2))-m.log(xb[r], 2)
  if ans > ryt:
   print("Infinity")
  elif ans < lyt:
   print(0)
  else:
   print(2**ans)


main()
# print(time.time()-start_time)


import time
import math
import random
import string

def log2(x):
 return math.log(x, 2)

MAX = log2(1e7)
MIN = log2(1e-7)

start_time = time.time()

vowels = 'aeiou'
v = {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
abets = string.ascii_lowercase

tcs = int(input())

for test in range(tcs):
 l = int(input())
 a = []
 b = []
 # for _ in range(l):
 #     flag = False
 #     s = input()
 #     for i in range(len(s)-2):
 #         if s[i] not in vowels:
 #             if s[i+1] not in vowels or s[i+2] not in vowels:
 #                 flag = True
 #                 break
 #         else:
 #             if s[i+1] not in vowels and s[i+2] not in vowels:
 #                 flag = True 
 #                 break
 #     if flag:
 #         b.append(s)
 #     else:
 #         a.append(s)
 for wer in range(l):
  s = input()
  n = len(s)
  c1 = 0
  for i in range(n):
   if s[i] not in v:
    if i+1 < n:
     if s[i+1] not in v:
      c1 = 1
      break
    if i+2 < n:
     if s[i+2] not in v:
      c1 = 1
      break
  if c1 == 1:
   b.append(s)
  else:
   a.append(s)
 alen = len(a)
 blen = len(b)
 # ################ Alice ##############
 achar_dict = {}
 atotal_dict = {}
 for recipe in a:
  d = {}
  for ch in recipe:
   d[ch] = 1
   if atotal_dict.get(ch):
    atotal_dict[ch] += 1
   else:
    atotal_dict[ch] = 1
  for ch in d:
   if achar_dict.get(ch):
    achar_dict[ch] += 1
   else:
    achar_dict[ch] = 1
 ################ Bob ##############
 bchar_dict = {}
 btotal_dict = {}
 for recipe in b:
  d = {}
  for ch in recipe:
   d[ch] = 1
   if btotal_dict.get(ch):
    btotal_dict[ch] += 1
   else:
    btotal_dict[ch] = 1
  for ch in d:
   if bchar_dict.get(ch):
    bchar_dict[ch] += 1
   else:
    bchar_dict[ch] = 1
 ################## Calculation ##################
 result = 0
 for i in achar_dict:
  result += log2(achar_dict[i]) - alen*log2(atotal_dict[i])
  
 for i in bchar_dict:
  result += blen*log2(btotal_dict[i]) - log2(bchar_dict[i])

 if result > MAX:
  print('Infinity')
 elif result < MIN:
  print(0)
 else:
  print(2**result)
  # print('%.7f' % 10**result)

# print(time.time() - start_time)


import time
import math
import random
import string

def log2(x):
 return math.log(x, 2)

MAX = log2(1e7)
MIN = log2(1e-7)

start_time = time.time()

vowels = 'aeiou'
v = {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
abets = string.ascii_lowercase

tcs = int(input())

for test in range(tcs):
 l = int(input())
 a = []
 b = []
 for _ in range(l):
  flag = False
  s = input()
  for i in range(len(s)-2):
   if s[i] not in vowels:
    if s[i+1] not in vowels or s[i+2] not in vowels:
     flag = True
     break
   else:
    if s[i+1] not in vowels and s[i+2] not in vowels:
     flag = True 
     break
  if flag:
   b.append(s)
  else:
   a.append(s)
 # for wer in range(l):
 #     s = input()
 #     n = len(s)
 #     c1 = 0
 #     for i in range(n):
 #         if s[i] not in v:
 #             if i+1 < n:
 #                 if s[i+1] not in v:
 #                     c1 = 1
 #                     break
 #             if i+2 < n:
 #                 if s[i+2] not in v:
 #                     c1 = 1
 #                     break
 #     if c1 == 1:
 #         b.append(s)
 #     else:
 #         a.append(s)
 alen = len(a)
 blen = len(b)
 # ################ Alice ##############
 achar_dict = {}
 atotal_dict = {}
 for recipe in a:
  d = {}
  for ch in recipe:
   d[ch] = 1
   if atotal_dict.get(ch):
    atotal_dict[ch] += 1
   else:
    atotal_dict[ch] = 1
  for ch in d:
   if achar_dict.get(ch):
    achar_dict[ch] += 1
   else:
    achar_dict[ch] = 1
 ################ Bob ##############
 bchar_dict = {}
 btotal_dict = {}
 for recipe in b:
  d = {}
  for ch in recipe:
   d[ch] = 1
   if btotal_dict.get(ch):
    btotal_dict[ch] += 1
   else:
    btotal_dict[ch] = 1
  for ch in d:
   if bchar_dict.get(ch):
    bchar_dict[ch] += 1
   else:
    bchar_dict[ch] = 1
 ################## Calculation ##################
 result = 0
 for i in achar_dict:
  result += log2(achar_dict[i]) - alen*log2(atotal_dict[i])
  
 for i in bchar_dict:
  result += blen*log2(btotal_dict[i]) - log2(bchar_dict[i])

 if result > MAX:
  print('Infinity')
 elif result < MIN:
  print(0)
 else:
  print(2**result)
  # print('%.7f' % 10**result)

# print(time.time() - start_time)