Today, Chef decided to cook some delicious meals from the ingredients in his kitchen. There are $N$ ingredients, represented by strings $S_1, S_2, \ldots, S_N$. Chef took all the ingredients, put them into a cauldron and mixed them up.
In the cauldron, the letters of the strings representing the ingredients completely mixed, so each letter appears in the cauldron as many times as it appeared in all the strings in total; now, any number of times, Chef can take one letter out of the cauldron (if this letter appears in the cauldron multiple times, it can be taken out that many times) and use it in a meal. A complete meal is the string "codechef". Help Chef find the maximum number of complete meals he can make!

-----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 $N$.
- $N$ lines follow. For each $i$ ($1 \le i \le N$), the $i$-th of these lines contains a single string $S_i$.

-----Output-----
For each test case, print a single line containing one integer — the maximum number of complete meals Chef can create.

-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $|S_1| + |S_2| + \ldots + |S_N| \le 1,000$
- each string contains only lowercase English letters

-----Example Input-----
3
6
cplusplus
oscar
deck
fee
hat
near
5
code
hacker
chef
chaby
dumbofe
5
codechef
chefcode
fehcedoc
cceeohfd
codechef

-----Example Output-----
1
2
5

-----Explanation-----
Example case 1: After mixing, the cauldron contains the letter 'c' 3 times, the letter 'e' 4 times, and each of the letters 'o', 'd', 'h' and 'f' once. Clearly, this is only enough for one "codechef" meal.
Example case 2: After mixing, the cauldron contains the letter 'c' 4 times, 'o' 2 times, 'd' 2 times, 'e' 4 times, 'h' 3 times and 'f' 2 times, which is enough to make 2 meals.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
t=int(input())
while t>0:
 n=int(input())
 li=[]
 c,o,d,e,h,f=0,0,0,0,0,0
 for i in range(0,n):
  s=input()
  
  for i in range(len(s)):
   if s[i]=='c':
    c=c+1
   elif s[i]=='o':
    o=o+1
   elif s[i]=='d':
    d=d+1
   elif s[i]=='e':
    e=e+1
   elif s[i]=='h':
    h=h+1
   elif s[i]=='f':
    f=f+1
 e=e//2
 c=c//2
 print(min(c,o,d,e,h,f)) 
 t-=1

# cook your dish here
t=int(input())
while t>0:
 n=int(input())
 li=[]
 c,o,d,e,h,f=0,0,0,0,0,0
 for i in range(0,n):
  s=input()
  
  for i in range(len(s)):
   if s[i]=='c':
    c=c+1
   elif s[i]=='o':
    o=o+1
   elif s[i]=='d':
    d=d+1
   elif s[i]=='e':
    e=e+1
   elif s[i]=='h':
    h=h+1
   elif s[i]=='f':
    f=f+1
 e=e//2
 c=c//2
 li=[c,o,d,e,h,f]
 print(min(li))
 t=t-1

t=int(input())
for i in range(t):
 n=int(input())
 l=[]
 for k in range(n):
  s=input()
  l.append(s)
 s=''.join(l)
 f="odhf"
 m=[]
 for j in f:
  m.append(s.count(j))
 m.append(s.count('c')//2)
 m.append(s.count('e')//2)
 print(min(m)) 

t=int(input())
for i in range(t):
 n=int(input())
 l=[]
 for k in range(n):
  s=input()
  l.append(s)
 s=''.join(l)
 f="odhf"
 m=[]
 for j in f:
  m.append(s.count(j))
 m.append(s.count('c')//2)
 m.append(s.count('e')//2)
 print(min(m)) 

t=int(input())
for i in range(t):
 n=int(input())
 l=[]
 for k in range(n):
  s=input()
  l.append(s)
 s=''.join(l)
 f="odhf"
 m=[]
 for j in f:
  m.append(s.count(j))
 m.append(s.count('c')//2)
 m.append(s.count('e')//2)
 print(min(m)) 


n=int(input())
for i in range(n):
  n1=int(input())
  c,o,d,e,h,f=0,0,0,0,0,0
  for j in range(n1):
    
    s=input()
    for k in range(len(s)):
      if s[k]=="c":
        c+=1
      elif s[k]=="o":
        o+=1
      elif s[k]=="d":
        d+=1
      elif s[k]=="e":
        e+=1
      elif s[k]=="h":
        h+=1
      elif s[k]=="f":
        f+=1
  
  c/=2
  e/=2
  
  print(int(min(c,o,d,e,h,f)))


for i in range(int(input())):
 n = int(input())
 l = []
 c= 0
 o= 0
 d= 0
 e= 0
 h= 0
 f= 0
 for i in range(n):
  s = input()
  for i in range(len(s)):
   if(s[i] == "c"):
    c = c+1
   elif(s[i]== "o"):
    o = o+1
   elif(s[i] == "d"):
    d = d+1
   elif(s[i] == "e"):
    e = e+1
   elif(s[i] == "h"):
    h = h+1
   elif(s[i] == "f"):
    f = f+1
 c = c//2
 e = e//2
 l = [c,o,d,e,h,f]
 print(min(l))

for t in range(int(input())):
 n=int(input())
 c=0
 e=0
 d=0
 o=0
 h=0
 f=0
 for i in range(n):
  s=input()
  c=c+s.count('c')
  e=e+s.count('e')
  d+=s.count('d')
  o+=s.count('o')
  h+=s.count('h')
  f+=s.count('f')
 c=c//2
 e=e//2
 print(min(c,e,d,o,h,f))


for t in range(int(input())):
 n=int(input())
 c=0
 e=0
 d=0
 o=0
 h=0
 f=0
 for i in range(n):
  s=input()
  c=c+s.count('c')
  e=e+s.count('e')
  d+=s.count('d')
  o+=s.count('o')
  h+=s.count('h')
  f+=s.count('f')
 c=c//2
 e=e//2
 print(min(c,e,d,o,h,f))


# cook your dish here
for i in range(int(input())):
 n = int(input())
 l = []
 c= 0
 o= 0
 d= 0
 e= 0
 h= 0
 f= 0
 for i in range(n):
  s = input()
  for i in range(len(s)):
   if(s[i] == "c"):
    c = c+1
   elif(s[i]== "o"):
    o = o+1
   elif(s[i] == "d"):
    d = d+1
   elif(s[i] == "e"):
    e = e+1
   elif(s[i] == "h"):
    h = h+1
   elif(s[i] == "f"):
    f = f+1
 c = c//2
 e = e//2
 l = [c,o,d,e,h,f]
 print(min(l))
   


# cook your dish here
for i in range(int(input())):
 n = int(input())
 l = []
 c= 0
 o= 0
 d= 0
 e= 0
 h= 0
 f= 0
 for i in range(n):
  s = input()
  for i in range(len(s)):
   if(s[i] == "c"):
    c = c+1
   elif(s[i]== "o"):
    o = o+1
   elif(s[i] == "d"):
    d = d+1
   elif(s[i] == "e"):
    e = e+1
   elif(s[i] == "h"):
    h = h+1
   elif(s[i] == "f"):
    f = f+1
 c = c//2
 e = e//2
 l = [c,o,d,e,h,f]
 print(min(l))
   


for _ in range(int(input())):
 n = int(input())
 l = []
 for i in range(n):
  s = input()
  a = list(s)
  l = l+a 
 m = ["o","d","h","f"]
 n = []
 x = l.count("c")
 n.append(x//2)
 y = l.count("e")
 n.append(y//2)
 for j in range(4):
  a = l.count(m[j])
  n.append(a)
 print(min(n)) 

for _ in range(int(input())):
 n=int(input())
 a=''
 for i in range(n):
  s=input()
  a=a+s
 c=0
 o=0
 d=0
 e=0
 h=0
 f=0
 for i in a:
  if i=='c':
   c+=1
  elif i == 'o':
   o += 1
  elif i == 'd':
   d += 1
  elif i == 'e':
   e += 1
  elif i == 'h':
   h += 1
  elif i == 'f':
   f += 1
 c=c//2
 e=e//2
 print(min(c,o,d,e,h,f))

# cook your dish here
t=int(input())
while t>0:
 n=int(input())
 s=''
 while n>0:
  s+=input()
  n-=1
 c=s.count('c')
 c=c//2
 o=s.count('o')
 d=s.count('d')
 e=s.count('e')
 e=e//2
 h=s.count('h')
 f=s.count('f')
 m=min(c,o,d,e,h,f)
 print(m)
 t-=1

for _ in range(int(input())):
 N = int(input())
 s = ''
 for i in range(N):
  s += input()
 c = []
 for i in list('codehf'):
  c.append(s.count(i))
 c[0] /= 2
 c[3] /= 2
 print(int(min(c)))

t=int(input())
for i in range(t):
 n=int(input())
 list1=[]
 for i in range(n):
  s=input()
  for i in range(len(s)):
   list1.append(s[i])
 t1=0
 t2=0
 t3=0
 t4=0
 t5=0
 t6=0
 t1=list1.count("c")//2
 t2=list1.count("o")//1
 t3=list1.count("d")//1
 t4=list1.count("e")//2
 t5=list1.count("h")//1
 t6=list1.count("f")//1
 print(min(t1,t2,t3,t4,t5,t6))


# cook your dish here
from collections import defaultdict
t = int(input())
for _ in range(t):
 n = int(input())
 d = defaultdict(int)
 for i in range(n):
  s = input()
  for k in s:
   if k in "codechef":
    d[k] = d[k] + 1
 d['c'] = d['c']//2
 d['e'] = d['e']//2
 g = list(d.values())
 if len(g)==6:
  print(min(g))
 else:
  print(0)


for _ in range(int(input())):
 n = int(input())
 a = []
 d = [0]*(26)
 for i in range(n):
  for k in input():
   d[ord(k)-ord('a')] += 1
 a.append(d[2]//2)
 a.append(d[14])
 a.append(d[3])
 a.append(d[4]//2)
 a.append(d[7])
 a.append(d[5])
 print(min(a))

# cook your dish here
t = int(input())
for _ in range(t):
 n = int(input())
 list1 = []
 l = []
 for i in range(n):
  x = input()
  list1.extend(list(x))
 for i in ('codehf'):
  l.append(list1.count(i))
 l[0] = l[0]/2
 l[3] = l[3]/2
 print(int(min(l)))



# cook your dish here
 
for _ in range(int(input())):
 N = int(input())
 s = ''
 for i in range(N):
  s += input()
 c = []
 for i in list('codehf'):
  c.append(s.count(i))
 c[0] /= 2
 c[3] /= 2
 print(int(min(c)))

# cook your dish here
 
for _ in range(int(input())):
 N = int(input())
 s = ''
 for i in range(N):
  s += input()
 c = []
 for i in list('codehf'):
  c.append(s.count(i))
 c[0] /= 2
 c[3] /= 2
 print(int(min(c)))

# cook your dish here
t=int(input())
for i in range(t):
 n=int(input())
 x=""
 lst=[]
 for j in range(n):
  x+=input()
 lst.append(x.count("c")//2)
 lst.append(x.count("e")//2)
 lst.append(x.count("d"))
 lst.append(x.count("o"))
 lst.append(x.count("h"))
 lst.append(x.count("f"))
 print(min(lst))
   


for _ in range(int(input())):
 n = int(input())
 x = ""
 lst = []
 c = ['c','o','d','e','c','h','e','f']
 for __ in range(n):
  s = input()
  x=x+s
 for l in c:
  if l == 'c' or l == 'e':
   lst.append(x.count(l)//2)
  else:
   lst.append(x.count(l))
 print(min(lst))


# cook your dish here
for _ in range(int(input())):
 s=""
 for i in range(int(input())):
  s+=input()
 counts=[]
 counts.append(s.count("c")//2)
 counts.append(s.count("e")//2)
 counts.append(s.count("o"))
 counts.append(s.count("d"))
 counts.append(s.count("h"))
 counts.append(s.count("f"))
 print(min(counts))