There has been yet another murder in the Shady city of Riverdale. This murder is being investigated by none other than the Riverdale's Finest- Jughead Jones & Betty Cooper. This murder has been done exactly in the same manner as all the murders happening since the return of the deadly game Gargoyle &Griffins. Betty has decided to put an end to these murders, so they decide to interrogate each and every person in the neighbourhood.
As they don't know these people personally they want to first get to know about their character i.e whether a particular person is a Truth−speaking−person$Truth-speaking-person$ or a False−speaking−person$False-speaking-person$. Jughead devises a strategy of interrogating the civilians.
Jughead decides that they will collect statements from all the people in the neighbourhood about every other person living in the neighbourhood. Each person speaks a statement in form of an array consisting of T$T$ and F$ F$, which tells us what he thinks about the ith$ith$ person. Let there be N$N$ people living in the neighbourhood. So if a person i$i$ is giving his/her statement, he/her will always call himself/herself a True person i.e Statement[i]=T$Statement[i]=T$.
So Jughead says that they will select the maximum$maximum$ number$number$ of people that maybe speaking the truth such that their statements don't contradict and then interrogate them further about the murder.
Help them pick the max no. of Truth speaking people.
Note$Note$- A person speaking falsely$falsely$ doesn't mean that the complement of his statement would be the truth$truth$. If a person is declared false$false$(i.e not included in the set) after Betty and Jughead pick their set of truth speaking people with non-contradicting statements, the person declared false might not be speaking falsely$falsely$ about anyone(except saying he himself is a true$true$ speaking person which contradicts with the selected statements) but since the selected Set of statements feels him to be a false$false$ speaking person he won't be included in the set. 
But if a person is tagged as truth$truth$ speaking person then their Statement must be entirely correct and should not contradict with the chosen set of truth$truth$ speaking people. All truth$truth$ speaking people mentioned in the selected statements should be part of the set and all the people declared false$false$ in the statements shouldn't be part of the set.
See example for clarity.

-----Input:-----
- First line will contain N$N$, the number of people in the neighbourhood. Then the Statements of ith$ith$ person follow. 
- Each Statement contains a single line of input, an array of length N$N$ consisting of T$T$ and F$F$.

-----Output:-----
Print a single line denoting the maximum no. of people that might be speaking the truth.

-----Constraints-----
- 1≤N≤1000$1 \leq N \leq 1000$
- Statement$Statement$i$i$[i]=T$[i]=T$

-----Sample Input1:-----
5
T T F F F
T T F F F
T T T F F
F F F T T
F F F T T

-----Sample Output1:-----
2

-----Sample Input2:-----
3
T T T
T T T
F F T

-----Sample Output2:-----
1

-----EXPLANATION:-----
In Sample 1
We can consider the 1st$1st$ and 2nd$2nd$ person to be speaking the truth. We can also consider the 4th$4th$ and the 5th$5th$ person to be speaking the truth. 
Note$Note$: we cannot select 1st$1st$ 2nd$2nd$ and 3rd$3rd$ person because the 1st$1st$ and the second person have labelled the 3rd person as a false speaking person, therefore if we select all 3 contradiction will arise.
In sample 2
Set contains only the 3rd person

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
testCases = int(input())
answers = []
for i in range(testCases):
	a = input().split()
	answers.append(a)
count = 0
for i in range(testCases):
	flag = 0
	ans = answers[i].count('T')
	for j in range(testCases):
		if answers[i][j] == 'T' and i != j:
			if answers[i] == answers[j]:
				continue
			else:
				flag = 1
				break
	if flag == 0 and count < ans:
		count = ans
print(count)


from collections import Counter
n = int(input())
arr = []
for i in range(n):
	s = map(str, input().split())
	arr.append(''.join(s))
c = Counter(arr)
keys = list(c.keys())
ans = []
for item in keys:
	x = c[item]
	if x == item.count('T'):
		ans.append(x)
if len(ans) != 0:
	print(max(ans))
else:
	print(0)


from collections import Counter
n = int(input())
matrix = []
arr = []
for i in range(n):
	s = input().strip().split()
	matrix.append(s)
	arr.append(''.join(s))
unique = list(set(arr))
c = Counter(arr)
ans = []
for items in unique:
	x = c[items]
	if x == items.count('T'):
		ans.append(x)
if ans != []:
	print(max(ans))
else:
	print(0)


a = int(input())
aa = []
for _ in range(a):
	cc = input()
	aa.append(cc)
maxs = 0
for j in range(a):
	k = 0
	for i in range(a):
		if aa[j][2 * i] == 'T':
			k += 1
			if aa[i] != aa[j]:
				break
	else:
		if maxs < k:
			maxs = k
print(maxs)


N = int(input())
D = {}
for i in range(N):
	T = [x for x in input().split()]
	if T[i] == 'T':
		L = []
		for j in range(N):
			if T[j] == 'T':
				L.append(j)
		x = tuple(L)
		if x in D:
			D[x] += 1
		else:
			D[x] = 1
best = 0
for i in D:
	if len(i) == D[i]:
		best = max(best, D[i])
print(best)


N = int(input())
L = []
for a in range(N):
	L.append(input().split())
A = [ele for (ind, ele) in enumerate(L) if ele not in L[:ind]]
C = [[a, L.count(a)] for a in A]
ans = 0
for B in C:
	for a in range(N):
		if B[0][a] == 'T':
			if L[a] != B[0]:
				break
	else:
		ans = B[1]
print(ans)


def fn(s):
	ans = 0
	for i in range(len(s)):
		if s[i] == 'T':
			ans += 1
	return ans
n = int(input())
maxa = 0
dic = {}
for i in range(n):
	temp = input()
	if temp in dic.keys():
		dic[temp] += 1
	else:
		dic[temp] = 1
	if dic[temp] > maxa:
		maxa = dic[temp]
		maxst = temp
abc = fn(maxst)
dictlist = []
for (key, value) in dic.items():
	tempa = [key, value]
	dictlist.append(tempa)
dictlist = sorted(dictlist, key=lambda x: x[1])
var = len(dictlist) - 2
while abc != maxa and var > -1:
	maxst = dictlist[var][0]
	maxa = dictlist[var][1]
	abc = fn(maxst)
	var -= 1
if var == -1 and abc != maxa:
	print(0)
else:
	print(maxa)


n = int(input())
arr = []
for q in range(n):
	arr.append(list(map(str, input().strip().split())))
ans = []
for i in range(n):
	st = 1
	c = 1
	for j in range(n):
		if arr[i][j] == 'T' and i != j:
			c += 1
			if arr[i] != arr[j]:
				st = 0
				break
	if st != 0:
		ans.append(c)
	else:
		ans.append(0)
print(max(ans))


n = int(input())
data = []
for _ in range(n):
	temp = list(input().split())
	val = ''
	for i in temp:
		if i == 'T':
			val += '1'
		else:
			val += '0'
	data.append(int(val, 2))
f = {}
for i in data:
	if i in f:
		f[i] += 1
	else:
		f[i] = 1
ans = [0]
for i in data:
	if bin(i).count('1') == f[i]:
		ans.append(f[i])
print(max(ans))


N = int(input())
grid = []
gridSlice = []
for n in range(N):
	x = input()
	grid.append(x)
	gridSlice.append(x.split())
curDict = dict()
for i in range(N):
	if grid[i] not in curDict:
		isFine = True
		for j in range(len(gridSlice[i])):
			if gridSlice[i][j] == 'T' and grid[i] != grid[j]:
				isFine = False
				break
		if isFine == True:
			curDict[grid[i]] = 1
		else:
			curDict[grid[i]] = -1
	elif curDict[grid[i]] == -1:
		continue
	else:
		curDict[grid[i]] += 1
ans = 0
for x in curDict:
	ans = max(curDict[x], ans)
print(ans)


n = int(input())
de = dict()

def Count(tu):
	count = 0
	for i in tu:
		if i == 'T':
			count += 1
	return count
for i in range(n):
	l = tuple(input().split())
	if l in de.keys():
		de[l] += 1
	else:
		de[l] = 1
maxi = 0
for (i, j) in de.items():
	if maxi < j and Count(i) == j:
		maxi = j
print(maxi)


N = int(input())
l = []
for i in range(N):
	a = input().split()
	l.append(a)
count = 0
for i in range(N):
	flag = 0
	value = l[i].count('T')
	for j in range(N):
		if l[i][j] == 'T' and i != j:
			if l[i] == l[j]:
				continue
			else:
				flag = 1
				break
	if flag == 0 and count < value:
		count = value
print(count)


n = int(input())
A = []
for i in range(n):
	x = input().split()
	A.append((x, x.count('T')))
A.sort()
A.sort(reverse=True, key=lambda A: A[1])
for i in range(len(A)):
	try:
		if A[i] == A[i + A[i][1] - 1]:
			print(A[i][1])
			break
	except:
		continue
else:
	print(0)


t = int(input())
v = []
for x in range(t):
	result = ''
	s = input().split()
	for i in s:
		result += i
	v.append(result)
maxi = 0
m = [0] * (t + 1)
for i in range(t):
	if m[i] == 1:
		continue
	m[i] = 1
	good = True
	for j in range(t):
		if v[i][j] == 'T':
			if v[j] != v[i]:
				good = False
				break
			m[i] = 1
	if good == True:
		sc = 0
		for k in range(t):
			if v[i][k] == 'T':
				sc += 1
		maxi = max(sc, maxi)
print(maxi)


n = int(input())
k = []
i = 0
while i < n:
	l = list(map(str, input().strip().split(' ')))
	if 'T' in l or 'F' in l:
		k.append(l)
		i += 1
ans = 0
for i in range(n):
	ch_me = True
	amount = k[i].count('T')
	for j in range(n):
		if k[i][j] == 'T':
			if k[i] == k[j]:
				pass
			else:
				ch_me = False
				break
	if ch_me and amount > ans:
		ans = amount
print(ans)


n = int(input())
l = []
for i in range(n):
	a = input().split()
	l.append(a)
c = 0
for i in range(n):
	f = 0
	v = l[i].count('T')
	for j in range(n):
		if l[i][j] == 'T' and i != j:
			if l[i] == l[j]:
				continue
			else:
				f = 1
				break
	if f == 0 and c < v:
		c = v
print(c)


def fun():
	n = int(input())
	biglist = []
	for i in range(n):
		s = tuple(map(f, input().split()))
		biglist.append(s)
	biglist.sort()
	d = dict()
	for i in biglist:
		d[i] = d.get(i, 0) + 1
	ans = 0
	for i in d:
		if d[i] == sum(i):
			ans = max(ans, d[i])
	print(ans)

def f(a):
	if a == 'T':
		return 1
	else:
		return 0
fun()


n = int(input())
list1 = []
list2 = []
list3 = []
for i in range(n):
	li = input().split()
	list1.append(li)
for i in range(n):
	if i == 0:
		count1 = list1.count(list1[i])
		list2.append(i)
		list3.append(count1)
	else:
		flag = 0
		for j in range(i):
			if list1[i] == list1[j]:
				flag = 1
				break
		if flag == 0:
			count1 = list1.count(list1[i])
			list2.append(i)
			list3.append(count1)
k = len(list3)
max1 = 0
for j in range(k):
	count2 = list1[list2[j]].count('T')
	if count2 == list3[j]:
		if count2 > max1:
			max1 = count2
print(max1)


n = int(input())
a = []
for i in range(n):
	a.append(input().strip().replace(' ', ''))
d = dict()
for i in range(n):
	if a[i] in d:
		d[a[i]].append(i)
	else:
		d[a[i]] = [i]
maxi = 0
for i in d:
	for ind in d[i]:
		if i[ind] != 'T':
			break
	else:
		if i.count('T') == len(d[i]):
			maxi = max(maxi, len(d[i]))
print(maxi)


n = int(input())
L = []
for _ in range(n):
	M = list(map(str, input().split()))
	L.append(M)
M = [1] * n
for i in range(n):
	for j in range(n):
		if j == i:
			pass
		elif L[i][j] == 'T':
			if L[j] == L[i]:
				M[i] += 1
			else:
				M[i] = 0
				break
		else:
			pass
print(max(M))


x = int(input())
a = []
for i in range(x):
	r = [y for y in input().split()]
	a.append(r)
ma = 0
for i in range(x):
	p = 0
	for j in range(x):
		if a[i][j] == 'T':
			if a[i] == a[j]:
				p += 1
			else:
				p = 0
				break
	if p > ma:
		ma = p
print(ma)


def dec(x):
	x = x[::-1]
	c = 0
	for i in range(len(x)):
		if x[i] == 'T':
			c += pow(2, i)
	return c
a = []
for _ in range(int(input())):
	a.append(input().split())
b = []
m = 0
for i in a:
	x = ''.join(i)
	b.append(dec(x))
for i in range(len(a)):
	g = b[i]
	c = 1
	k = 0
	for j in range(len(a)):
		if a[i][j] == 'T' and i != j:
			k += 1
		if a[i][j] == 'T' and b[j] == g and (i != j):
			c += 1
	if k + 1 == c:
		m = max(m, c)
print(m)


n = int(input())
arr = []
for _ in range(n):
	row = [x for x in input().split()]
	arr.append(row)
ans = 0
for i in range(n):
	now = 0
	for j in range(n):
		if arr[i][j] == 'T':
			if arr[i] == arr[j]:
				now += 1
			else:
				now = 0
				break
	if now > ans:
		ans = now
print(ans)