As you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane.

You prefer flying from Seattle to San Francisco than in the other direction, because it's warmer in San Francisco. You are so busy that you don't remember the number of flights you have made in either direction. However, for each of the last n days you know whether you were in San Francisco office or in Seattle office. You always fly at nights, so you never were at both offices on the same day. Given this information, determine if you flew more times from Seattle to San Francisco during the last n days, or not.


-----Input-----

The first line of input contains single integer n (2 ≤ n ≤ 100) — the number of days.

The second line contains a string of length n consisting of only capital 'S' and 'F' letters. If the i-th letter is 'S', then you were in Seattle office on that day. Otherwise you were in San Francisco. The days are given in chronological order, i.e. today is the last day in this sequence.


-----Output-----

Print "YES" if you flew more times from Seattle to San Francisco, and "NO" otherwise.

You can print each letter in any case (upper or lower).


-----Examples-----
Input
4
FSSF

Output
NO

Input
2
SF

Output
YES

Input
10
FFFFFFFFFF

Output
NO

Input
10
SSFFSFFSFF

Output
YES



-----Note-----

In the first example you were initially at San Francisco, then flew to Seattle, were there for two days and returned to San Francisco. You made one flight in each direction, so the answer is "NO".

In the second example you just flew from Seattle to San Francisco, so the answer is "YES".

In the third example you stayed the whole period in San Francisco, so the answer is "NO".

In the fourth example if you replace 'S' with ones, and 'F' with zeros, you'll get the first few digits of π in binary representation. Not very useful information though.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = input()
s = input()
print('YES' if s.count('SF') > s.count('FS') else 'NO')


n = int(input())
s = input()
(sf, fs) = [0, 0]
for i in range(1, n):
	if s[i] == 'F' and s[i - 1] == 'S':
		sf += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


def bublesort(a):
	n = len(a)
	fl1 = False
	while not fl1:
		fl1 = True
		for i in range(n - 1):
			if a[i] > a[i + 1]:
				(a[i], a[i + 1]) = (a[i + 1], a[i])
				fl1 = False
n = int(input())
a = input()
k = 0
p = 0
for i in range(len(a) - 1):
	if a[i] != a[i + 1] and a[i] == 'S':
		k += 1
	elif a[i] != a[i + 1]:
		p += 1
if k > p:
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
SF = int()
FS = int()
for ci in range(n - 1):
	if cities[ci] == 'S' and cities[ci + 1] == 'F':
		SF += 1
	elif cities[ci] == 'F' and cities[ci + 1] == 'S':
		FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


(a, d) = (input(), input())
print('YES' if d[0] == 'S' and d[-1] == 'F' else 'NO')


n = int(input())
s = input()
lst = list(s)
frst = lst[0]
k = 0
if s[0] == 'F':
	print('no')
else:
	for i in lst:
		if i == frst:
			pass
		else:
			frst = i
			k += 1
	if k % 2 == 0:
		print('no')
	else:
		print('yes')


sf = 0
fs = 0
n = int(input())
places = input()
for i in range(0, n):
	if places[i:i + 2] == 'SF':
		sf += 1
	elif places[i:i + 2] == 'FS':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
StoF = 0
FtoS = 0
current = s[0]
for i in range(1, n):
	if current != s[i]:
		if s[i] == 'F':
			StoF += 1
			current = 'F'
		else:
			FtoS += 1
			current = 'S'
if StoF > FtoS:
	print('YES')
else:
	print('NO')


n = int(input())
f = input()
print('YES' if f[0] == 'S' and f[-1] == 'F' else 'NO')


no_of_days = int(input())
days = input()
st = []
count = 0
count1 = 0
for i in days:
	st.append(i)
for i in range(no_of_days):
	if i == no_of_days - 1:
		break
	elif st[i] + st[i + 1] == 'SF':
		count = count + 1
	elif st[i] + st[i + 1] == 'FS':
		count1 = count1 + 1
	else:
		continue
if count > count1:
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
a = 0
b = 0
for x in range(1, n):
	if l[x - 1] == 'F' and l[x] == 'S':
		a += 1
	elif l[x - 1] == 'S' and l[x] == 'F':
		b += 1
if b > a:
	print('YES')
else:
	print('NO')


n = input()
sequence = [char for char in input()]
f_s = 0
s_f = 0
for i in range(len(sequence) - 1):
	if sequence[i] == 'S' and sequence[i + 1] == 'F':
		s_f += 1
	elif sequence[i] == 'F' and sequence[i + 1] == 'S':
		f_s += 1
if s_f > f_s:
	print('YES')
else:
	print('NO')


k = int(input())
line = input()
if line.count('SF') > line.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sf = s.count('SF')
fs = s.count('FS')
if sf > fs:
	print('YES')
else:
	print('NO')


t = int(input())
n = str(input())
sf = n.count('SF')
fs = n.count('FS')
if sf > fs:
	print('Yes')
else:
	print('No')


input()
s = input()
print(['NO', 'YES'][s.count('SF') > s.count('FS')])


a = int(input())
s = input()
l = 0
r = 0
s = list(s)
d = len(s)
for i in range(0, d - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		l += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		r += 1
if l > r:
	print('Yes')
else:
	print('No')


x = int(input())
s = input().strip()
fc = 0
sc = 0
li = []
c = s[0]
li.append(c)
for i in range(1, x):
	if c != s[i]:
		li.append(s[i])
		c = s[i]
l = len(li)
for i in range(1, l):
	if li[i] == 'F' and li[i - 1] == 'S':
		sc = sc + 1
	else:
		fc = fc + 1
if sc > fc:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
last = 'X'
sf = 0
fs = 0
for c in s:
	if c == 'S':
		if last == 'F':
			fs += 1
		last = c
	else:
		if last == 'S':
			sf += 1
		last = c
if sf > fs:
	print('YES')
else:
	print('NO')


n = input()
str = input()
Seattle = str.count('SF')
SanFrancisco = str.count('FS')
print('YES') if Seattle > SanFrancisco else print('NO')


n = int(input())
l = list(input())
(c1, c2) = (0, 0)
for i in range(n - 1):
	if l[i] == 'F' and l[i + 1] == 'S':
		c1 += 1
	if l[i] == 'S' and l[i + 1] == 'F':
		c2 += 1
if c2 > c1:
	print('YES')
else:
	print('NO')


x = int(input())
flights = input()
if flights[0] != flights[-1] and flights[0] == 'S':
	print('YES')
else:
	print('NO')


N = int(input())
s = input()
s2f = 0
f2s = 0
for i in range(len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		s2f += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		f2s += 1
if s2f > f2s:
	print('Yes')
else:
	print('No')


n = int(input())
places = input()
count1 = 0
count2 = 0
for i in range(1, n):
	if places[i] == 'F' and places[i - 1] == 'S':
		count1 += 1
	elif places[i] == 'S' and places[i - 1] == 'F':
		count2 += 1
if count1 > count2:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(input())
s2f = 0
f2s = 0
i = 1
while i < len(s):
	if s[i] != s[i - 1]:
		if s[i] == 'F':
			s2f += 1
		else:
			f2s += 1
	i += 1
op = 'YES' if s2f > f2s else 'NO'
print(op)


foul_number = int(input())
string = input()
sf = 0
fs = 0
for i in range(foul_number - 1):
	if string[i] == 'S' and string[i + 1] == 'F':
		sf += 1
	elif string[i] == 'F' and string[i + 1] == 'S':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


import time

def countFlights(flightStr):
	flSF = 0
	flFS = 0
	for x in range(len(flightStr) - 1):
		if flightStr[x:x + 2] == 'SF':
			flSF += 1
		if flightStr[x:x + 2] == 'FS':
			flFS += 1
	if flSF > flFS:
		return 'YES'
	else:
		return 'NO'

def solve():
	n = int(input())
	flightStr = input()
	print(countFlights(flightStr))
solve()


n = int(input())
l = input()
k = l.count('SF')
t = l.count('FS')
if k > t:
	print('YES')
else:
	print('NO')


i1 = input()
i2 = input()
s = ''
if i2.count('SF') > i2.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
(c, d) = (0, 0)
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		c += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		d += 1
if c > d:
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input())
x = 0
y = 0
for i in range(len(s)):
	if s[i:i + 2] == 'SF':
		x = x + 1
	elif s[i:i + 2] == 'FS':
		y = y + 1
if x > y:
	print('YES')
else:
	print('NO')


a = int(input())
s = input().strip()[:a]
s = list(s)
s.append('#@%')
d = {'S': 0, 'F': 0}
for x in range(0, len(s) - 2):
	if s[x] != s[x + 1]:
		d[s[x]] += 1
if d['S'] > d['F']:
	print('YES')
else:
	print('NO')


import sys, math
input = sys.stdin.readline
L = lambda : list(map(int, input().split().strip()))
M = lambda : map(int, input().split())
n = int(input())
s = input()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


q = int(input())
c = input()
g = c.replace('SF', '1').count('1')
d = c.replace('FS', '2').count('2')
if g > d:
	print('YES')
else:
	print('NO')


n = int(input())
t = str(input())
s_to_f = 0
f_to_s = 0
for i in range(n - 1):
	if t[i] == 'S' and t[i + 1] == 'F':
		s_to_f += 1
	if t[i] == 'F' and t[i + 1] == 'S':
		f_to_s += 1
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


input()
string = input()
SF = 0
FS = 0
current = string[0]
for city in string:
	if city != current:
		if current == 'S':
			SF += 1
		else:
			FS += 1
		current = city
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
f = list(input())
a = 0
b = 0
for i in range(n - 1):
	if f[i] == 'S' and f[i + 1] == 'F':
		a += 1
	if f[i] == 'F' and f[i + 1] == 'S':
		b += 1
if a > b:
	print('YES')
else:
	print('NO')


input()
ins = input()
print('YES' if ins.count('SF') > ins.count('FS') else 'NO')


n = int(input())
days = input()
numFS = 0
numSF = 0
for i in range(n - 1):
	if days[i] + days[i + 1] == 'FS':
		numFS += 1
	elif days[i] + days[i + 1] == 'SF':
		numSF += 1
if numSF > numFS:
	print('YES')
else:
	print('NO')


n = int(input())
traveled = str(input())
if traveled.count('SF') > traveled.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
stof = 0
ftos = 0
for i in range(len(s) - 1):
	if s[i] == 'S':
		if s[i + 1] == 'F':
			stof += 1
	elif s[i + 1] == 'S':
		ftos += 1
if stof > ftos:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(input())
x = 0
y = 0
for i in range(n - 1):
	if l[i] == 'S' and l[i + 1] == 'F':
		x += 1
	elif l[i] == 'F' and l[i + 1] == 'S':
		y += 1
if x > y:
	print('YES')
else:
	print('NO')


_ = int(input())
flights = input()
flew_more_times_to_sf = False
if 'S' not in flights:
	pass
else:
	seattle_to_sf_flights = flights.count('SF')
	sf_to_seattle_flights = flights.count('FS')
	if seattle_to_sf_flights > sf_to_seattle_flights:
		flew_more_times_to_sf = True
if flew_more_times_to_sf:
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
b = list(b)
e = int()
f = int()
for x in range(a):
	if x < a - 1:
		if b[x] == b[x + 1]:
			pass
		elif b[x] < b[x + 1]:
			f = f + 1
		elif b[x] > b[x + 1]:
			e = e + 1
if e > f:
	print('Yes')
else:
	print('No')


n = int(input())
my_str = input()
(from_s_to_f, from_f_to_s) = (0, 0)
for i in range(1, len(my_str)):
	if my_str[i] == 'F' and my_str[i - 1] == 'S':
		from_s_to_f += 1
	if my_str[i] == 'S' and my_str[i - 1] == 'F':
		from_f_to_s += 1
if from_s_to_f > from_f_to_s:
	print('Yes')
else:
	print('No')


q = lambda : map(int, input().split())
qs = lambda : input().split()
(n,) = q()
(a,) = qs()
print('NYOE S'[a.count('SF') > a.count('FS')::2])


import re
n = int(input())
string = input()
if len(re.findall('SF', string)) > len(re.findall('FS', string)):
	print('YES')
else:
	print('NO')


import itertools
import math
from collections import defaultdict

def input_ints():
	return list(map(int, input().split()))

def solve():
	input()
	s = input()
	print('YES' if s.count('SF') > s.count('FS') else 'NO')
solve()


n = int(input())
d = []
d.extend(input())
s = 0
f = 0
for i in range(0, n - 1):
	if d[i] == d[i + 1]:
		i += 1
	elif d[i] == 'S':
		s += 1
		i += 1
	else:
		f += 1
		i += 1
if f < s:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = 0
b = 0
for i in range(1, n):
	if s[i - 1] == 'S' and s[i] == 'F':
		a += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		b += 1
print('YES' if a > b else 'NO')


a = input()
b = input()
c = b.count('SF')
d = b.count('FS')
e = b.count('F')
f = b.count('S')
if e == len(b):
	print('NO')
elif f == len(b):
	print('NO')
elif c > d:
	print('YES')
else:
	print('NO')


num = int(input())
string = input()
current = string[0]
count = 0
count2 = 0
for i in range(num):
	if current == 'S' and string[i] == 'F':
		count += 1
	if current == 'F' and string[i] == 'S':
		count2 += 1
	current = string[i]
if count > count2:
	print('YES')
else:
	print('NO')


n = int(input())
stof = 0
ftos = 0
days = list((char for char in input()))
city = days[0]
for nextcity in days:
	if city != nextcity:
		if city == 'S':
			stof += 1
		elif city == 'F':
			ftos += 1
		city = nextcity
if stof > ftos:
	print('YES')
else:
	print('NO')


n = input()
palabra = input()
cnt_s = 0
cnt_f = 0
for i in range(1, len(palabra)):
	if palabra[i] != palabra[i - 1]:
		if palabra[i] == 'F':
			cnt_s += 1
		else:
			cnt_f += 1
if cnt_s > cnt_f:
	print('YES')
else:
	print('NO')


a = int(input())
b = str(input())
if b[:1] == 'S' and b[-1:] == 'F':
	print('YES')
else:
	print('NO')


input()
s = input()
if s[0] == 'S' and s[-1] == 'F':
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
z = 'S'
x = 'F'
s = 0
f = 0
for i in range(a):
	if i != a - 1:
		if b[i] == z:
			if b[i + 1] == x:
				s = s + 1
		if b[i] == x:
			if b[i + 1] == z:
				f = f + 1
if s > f:
	print('yes')
else:
	print('no')


a = int(input())
b = str(input())
k = 0
for i in range(a - 1):
	x = b[i:i + 1]
	y = b[i + 1:i + 2]
	if x == 'S' and y == 'F':
		k += 1
	elif x == 'F' and y == 'S':
		k -= 1
if k > 0:
	print('YES')
else:
	print('NO')


N = int(input())
S = input()
s = 0
f = 0
for i in range(0, N - 1):
	if S[i] == 'S':
		if S[i + 1] == 'F':
			s = s + 1
	elif S[i] == 'F':
		if S[i + 1] == 'S':
			f = f + 1
if s > f:
	print('YES')
else:
	print('NO')


n = int(input())
way = input()
fromFtoS = 0
fromStoF = 0
for i in range(1, n):
	if way[i] == 'S' and way[i - 1] == 'F':
		fromFtoS += 1
	elif way[i] == 'F' and way[i - 1] == 'S':
		fromStoF += 1
if fromStoF > fromFtoS:
	print('YES')
else:
	print('NO')


input()
s = input()
print('Yes' if s.count('SF') > s.count('FS') else 'No')


n = int(input())
st = input()
s = 0
f = 0
x = 'a'
for i in st:
	if x == 'S' and i == 'F':
		f += 1
		x = i
	elif x == 'F' and i == 'S':
		s += 1
		x = i
	else:
		x = i
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
k = ''
for i in range(n - 1):
	if s[i] != s[i + 1]:
		k = k + s[i]
k = k + s[n - 1]
sc = 0
fc = 0
for i in range(len(k) - 1):
	if k[i] == 'S' and k[i + 1] == 'F':
		sc += 1
	elif k[i] == 'F' and k[i + 1] == 'S':
		fc += 1
if sc > fc:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
s2 = s.count('SF')
s3 = s.count('FS')
if s2 > s3:
	print('YES')
else:
	print('NO')


x = int(input())
j = input()
h = 0
l = 0
for i in range(x - 1):
	if j[i] == 'F' and j[i + 1] == 'S':
		h += 1
	elif j[i] == 'S' and j[i + 1] == 'F':
		l += 1
if h > l or h == l:
	print('NO')
else:
	print('YES')


n = int(input())
string = input()
counter_s = 0
counter_f = 0
for i in range(1, len(string)):
	if string[i] == 'S' and string[i - 1] == 'F':
		counter_f += 1
	elif string[i] == 'F' and string[i - 1] == 'S':
		counter_s += 1
print('YES' if counter_s > counter_f else 'NO')


length = input()
string = input()
ftos = 0
stof = 0
for i in range(len(string) - 1):
	if string[i] != string[i + 1]:
		if string[i] == 'F':
			ftos = ftos + 1
		else:
			stof = stof + 1
if stof > ftos:
	print('yes')
else:
	print('no')


n = int(input())
x = input()
cnt = 0
count = 0
for i in range(0, n - 1):
	if x[i] == 'S':
		if x[i + 1] == 'F':
			count += 1
	if x[i] == 'F':
		if x[i + 1] == 'S':
			cnt += 1
if count > cnt:
	print('YES')
else:
	print('NO')


input()
s = input()
sf_count = 0
fs_count = 0
for i in range(len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		sf_count += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		fs_count += 1
if sf_count > fs_count:
	print('YES')
else:
	print('NO')


n = int(input())
x = str(input())
if x.count('SF') > x.count('FS'):
	print('yes')
else:
	print('no')


_ = input()
resT = resF = 0
l = list(input())
s = l[0]
for j in l:
	if j != s:
		if j == 'F':
			resT += 1
		else:
			resF += 1
	s = j
res = 'YES' if resT > resF else 'NO'
print(res)


a = int(input())
s = input()
c = 0
d = 0
for i in range(a - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		c += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		d += 1
	if s[i] == 'F' and s[i + 1] == 'F':
		pass
	if s[i] == 'S' and s[i + 1] == 'S':
		pass
if c > d:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = list(s.split('SF'))
b = list(s.split('FS'))
print('YES' if len(a) > len(b) else 'NO')


n = int(input())
st = input()
si = 0
sf = 0
for i in range(len(st) - 1):
	if st[i] == 'F' and st[i + 1] == 'S':
		si += 1
	if st[i] == 'S' and st[i + 1] == 'F':
		sf += 1
if sf > si:
	print('Yes')
else:
	print('No')


n = int(input())
trips = input()
sToF = trips.count('SF')
fToS = trips.count('FS')
if sToF > fToS:
	print('YES')
else:
	print('NO')


n = int(input())
line = input()
in_sf = line[0] == 'F'
sf_seattle = 0
seattle_sf = 0
for v in line[1:]:
	if v == 'F' and (not in_sf):
		in_sf = True
		seattle_sf += 1
	elif v == 'S' and in_sf:
		sf_seattle += 1
		in_sf = False
if seattle_sf > sf_seattle:
	print('YES')
else:
	print('NO')


import sys
fin = sys.stdin
fout = sys.stdout
lines = (line.strip() for line in fin)
n = int(next(lines))
trips = next(lines)
total = 0
for i in range(n - 1):
	trip = trips[i:i + 2]
	if trip == 'SF':
		total += 1
	elif trip == 'FS':
		total -= 1
print('YES' if total > 0 else 'NO', file=fout)


n = int(input())
s = input()
current_pos = s[0]
count = 0
for i in range(1, n):
	if s[i] != current_pos:
		count += 1 if current_pos == 'S' else -1
		current_pos = s[i]
res = 'YES' if count > 0 else 'NO'
print(res)


n = int(input())
tour = input()
(hasil1, hasil2, j) = (0, 0, 1)
for i in range(len(tour)):
	if i != len(tour) - 1:
		if tour[i] == 'S' and tour[j] == 'F':
			hasil1 += 1
		elif tour[i] == 'F' and tour[j] == 'S':
			hasil2 += 1
		j += 1
if hasil1 <= hasil2:
	print('NO')
else:
	print('YES')


n = int(input())
str1 = input().strip()
c1 = 0
c2 = 0
for i in range(n - 1):
	if str1[i] == 'S' and str1[i + 1] == 'F':
		c1 += 1
	if str1[i] == 'F' and str1[i + 1] == 'S':
		c2 += 1
if c1 > c2:
	print('Yes')
else:
	print('No')


n = int(input())
x = input()
ca = 0
cb = 0
for i in range(n - 1):
	if x[i] == 'S' and x[i + 1] == 'F':
		ca = ca + 1
	if x[i] == 'F' and x[i + 1] == 'S':
		cb = cb + 1
if ca > cb:
	print('YES')
else:
	print('NO')


n = int(input())
travel = list(input())
good = 0
bad = 0
for i in range(1, len(travel)):
	if travel[i] == 'F' and travel[i - 1] == 'S':
		good += 1
	elif travel[i] == 'S' and travel[i - 1] == 'F':
		bad += 1
if good > bad:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
c = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		c += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		c -= 1
if c > 0:
	print('YES')
else:
	print('NO')


n = input()
m = input()
l = len(m)
s = 0
f = 0
for i in range(l):
	if i != l - 1 and m[i] == 'S' and (m[i + 1] == 'F'):
		s += 1
	elif i != l - 1 and m[i] == 'F' and (m[i + 1] == 'S'):
		f += 1
if s > f:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
s = 0
f = 0
for i in range(1, n):
	if a[i] != a[i - 1]:
		if a[i] == 'F':
			f += 1
		else:
			s += 1
if f > s:
	print('yes')
else:
	print('no')


input()
str = input()
print('YES' if str[0] == 'S' and str[-1] == 'F' else 'NO')


d = int(input())
s = input()
if s.count('SF') > s.count('FS'):
	print('Yes')
else:
	print('No')


n = int(input())
s = list(input())
a = 0
b = 0
for i in range(n - 1):
	if s[i:i + 2] == list('SF'):
		a += 1
	elif s[i:i + 2] == list('FS'):
		b += 1
if a > b:
	print('YES')
else:
	print('NO')


(_, s) = (input(), input())
(sf, fs) = (0, 0)
for i in range(1, len(s)):
	if s[i - 1] == 'S' and s[i] == 'F':
		sf += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		fs += 1
print('YES' if sf > fs else 'NO')


n = int(input())
s = input()
totalF = 0
for i in range(n - 1):
	if s[i] != s[i + 1]:
		totalF = totalF + 1 if s[i + 1] == 'F' else totalF - 1
print('YES') if totalF > 0 else print('NO')


a = int(input())
k = list(input())
p = 0
q = 0
for i in range(a - 1):
	if k[i] == 'S' and k[i + 1] == 'F':
		p += 1
	elif k[i] == 'F' and k[i + 1] == 'S':
		q += 1
if p > q:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
c1 = c2 = 0
for i in range(n - 1):
	if s[i:i + 2] == 'SF':
		c1 += 1
	elif s[i:i + 2] == 'FS':
		c2 += 1
if c1 > c2:
	print('YES')
else:
	print('NO')


number = input()
arr = input()
print('YES') if arr[0] == 'S' and arr[len(arr) - 1] == 'F' else print('NO')


n = int(input())
s = input()
toF = 0
toS = 0
for i in range(1, len(s)):
	if s[i] != s[i - 1]:
		if s[i] == 'S':
			toS += 1
		else:
			toF += 1
if toF > toS:
	print('YES')
else:
	print('NO')


x = int(input())
s = input()
y = 0
c = 0
for n in range(x - 1):
	if s[n] == s[n + 1]:
		y = y
		c = c
	elif s[n] != s[n + 1]:
		if s[n] == 'F' and s[n + 1] == 'S':
			c = c + 1
		elif s[n] == 'S' and s[n + 1] == 'F':
			y = y + 1
if y > c:
	print('YES')
elif y <= c:
	print('NO')


n = int(input())
string1 = input()
if string1.count('SF') > string1.count('FS'):
	print('YES')
else:
	print('NO')


y = int(input())
x = input()
c = 0
d = 0
e = 0
for i in range(y - 1):
	if x[i] == 'S' and x[i + 1] == 'F':
		c = c + 1
	elif x[i] == 'F' and x[i + 1] == 'S':
		d = d + 1
	else:
		e = e + 1
if c > d:
	print('YES')
elif e == x:
	print('NO')
else:
	print('NO')


days = int(input())
offices = input()
SF = 0
FS = 0
for i in range(0, days - 1):
	if offices[i] == 'S' and offices[i + 1] == 'F':
		SF = SF + 1
	elif offices[i] == 'F' and offices[i + 1] == 'S':
		FS = FS + 1
if SF > FS:
	print('YES')
else:
	print('NO')


def solve(n, s):
	cnt = 0
	for i in range(1, len(s)):
		if s[i - 1] == 'S' and s[i] == 'F':
			cnt += 1
		elif s[i - 1] != s[i]:
			cnt -= 1
	return 'YES' if cnt > 0 else 'NO'
n = int(input())
s = list(map(str, input()))
print(solve(n, s))


p = int(input())
s = input()
s = s.upper()
count1 = 0
count2 = 0
for k in range(0, len(s) - 1):
	if s[k] == 'F' and s[k + 1] == 'S':
		count1 += 1
	if s[k] == 'S' and s[k + 1] == 'F':
		count2 += 1
if count2 > count1:
	print('YES')
else:
	print('NO')


n = input()
s = input()
l = list(s)
stof = 0
ftos = 0
for i in range(len(s) - 1):
	if l[i] == 'F' and l[i + 1] == 'S':
		ftos = ftos + 1
	elif l[i] == 'S' and l[i + 1] == 'F':
		stof = stof + 1
if stof > ftos:
	print('YES')
else:
	print('NO')


def solve():
	n = int(input())
	s = input()
	(s1, s2) = (0, 0)
	for i in range(1, n):
		if s[i] != s[i - 1]:
			if s[i] == 'F':
				s1 += 1
			else:
				s2 += 1
	if s1 > s2:
		print('YES')
	else:
		print('NO')
solve()


input()
a = input()
print('Yes' if a.count('SF') > a.count('FS') else 'No')


size = int(input())
data = input()
if data[0] == 'S' and data[-1] == 'F':
	print('YES')
else:
	print('NO')


a = int(input())
q = 0
p = 0
y = []
w = input()
for i in range(0, a):
	y.append(w[i])
for u in range(0, a - 1):
	if y[u] == 'S' and y[u + 1] == 'F':
		q = q + 1
	elif y[u] == 'F' and y[u + 1] == 'S':
		p = p + 1
if q > p:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
strng = 'SF'
c = 0
if s.count('SF') > 0:
	if s.count('FS') <= 0 or s.count('FS') < s.count('SF'):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


a = int(input())
b = input()
c = b.count('SF')
d = b.count('FS')
if c > d:
	print('YES')
else:
	print('NO')


n = int(input())
ch = input()
s = 0
f = 0
for i in range(1, n):
	if ch[i - 1] == 'F' and ch[i] == 'S':
		f += 1
	elif ch[i - 1] == 'S' and ch[i] == 'F':
		s += 1
if s > f:
	print('YES')
elif f >= s:
	print('NO')


n = int(input())
d = input()
toS = d.count('FS')
toF = d.count('SF')
if toF > toS:
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
a = 0
b = 0
a = x.count('SF')
b = x.count('FS')
if a > b:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
j = 0
count = 0
j = int(j)
count = int(count)
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		count = count + 1
	if a[i] == 'F' and a[i + 1] == 'S':
		j = j + 1
if j < count:
	print('YES')
else:
	print('NO')


n = int(input())
j = str(input())
count = 0
for i in range(0, n - 1):
	if j[i] != j[i + 1]:
		if j[i] == 'S':
			count = count + 1
		else:
			count = count - 1
if count <= 0:
	print('No')
else:
	print('Yes')


n = int(input())
s = input()
y = 0
n1 = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		y += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		n1 += 1
if y > n1:
	print('YES')
else:
	print('NO')


days = input()
office = input()
sf = office.count('SF')
fs = office.count('FS')
if sf > fs:
	print('YES')
else:
	print('NO')


input()
s = input().lower()
s2f = s.count('sf')
f2s = s.count('fs')
if s2f > f2s:
	print('YES')
else:
	print('NO')


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
n = int(input())
s = input()
cnt1 = 0
cnt2 = 0
i = 1
while i < n:
	if s[i] == 'F' and s[i - 1] == 'S':
		cnt1 += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		cnt2 += 1
	i += 1
if cnt1 > cnt2:
	print('YES')
else:
	print('NO')


import sys
import math

def main():
	n = int(sys.stdin.readline())
	f = sys.stdin.readline().strip()
	if f[0] == 'S' and f[n - 1] == 'F':
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = list(input())
cur = a[0]
count = 0
total = 0
for i in range(1, n):
	if cur == 'S' and a[i] == 'F':
		count += 1
	if not cur == a[i]:
		total += 1
	cur = a[i]
if count > total - count:
	print('YES')
else:
	print('NO')


n = int(input())
se2sf = 0
sf2se = 0
lst = None
for ch in input():
	if lst is None:
		lst = ch
	else:
		if lst == 'S' and ch == 'F':
			se2sf += 1
		if lst == 'F' and ch == 'S':
			sf2se += 1
	lst = ch
print('YES' if se2sf > sf2se else 'NO')


n = int(input())
fl = input()
count = 0
if fl.count('SF') <= fl.count('FS'):
	print('NO')
elif fl.count('SF') > fl.count('FS'):
	print('YES')


n = int(input())
s = input()
k1 = 0
k2 = 0
for x in range(len(s) - 1):
	if s[x] != s[x + 1]:
		if s[x] == 'S':
			k1 += 1
		else:
			k2 += 1
if k1 > k2:
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
SF = 0
FS = 0
for i in range(a - 1):
	if b[i] == 'S' and b[i + 1] == 'F':
		SF += 1
	elif b[i] == 'F' and b[i + 1] == 'S':
		FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input())
count_s = 0
count_f = 0
for i in range(n - 1):
	if a[i] == 'S' and a[i] != a[i + 1]:
		count_s += 1
	elif a[i] == 'F' and a[i] != a[i + 1]:
		count_f += 1
if count_s > count_f:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
x = 0
y = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		x += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		y += 1
	else:
		pass
if x > y:
	print('YES')
else:
	print('NO')


n = int(input())
w = str(input())
w.upper()
a1 = 'SF'
a2 = 'FS'
b1 = w.count(a1)
b2 = w.count(a2)
if b1 > b2:
	print('YES')
else:
	print('NO')


booseted = int(input(''))
travel_log = input('')
sf = travel_log.count('SF')
fs = travel_log.count('FS')
if sf > fs:
	print('YES')
else:
	print('NO')


import sys

def main():
	n = int(input())
	stays = input().strip()
	state = stays[0]
	fts = stf = 0
	for stay in stays[1:]:
		if state != stay:
			if state > stay:
				stf += 1
			elif state < stay:
				fts += 1
			state = stay
	print('YES' if stf > fts else 'NO')
main()


days = int(input())
record = input()
sf = 0
fs = 0
for i in range(days - 1):
	if record[i] == 'S' and record[i + 1] == 'F':
		sf += 1
	if record[i] == 'F' and record[i + 1] == 'S':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('No')


try:
	n = int(input())
	s = input()
	(countsf, countfs) = (0, 0)
	last = s[0]
	for i in range(1, n):
		if s[i - 1] != s[i]:
			if last == 'S':
				countsf += 1
			else:
				countfs += 1
			last = s[i]
	if countsf > countfs:
		print('YES')
	else:
		print('NO')
except Exception:
	pass


in1 = int(input())
in2 = input()
sf = 0
fs = 0
for i in range(in1 - 1):
	s = in2[i:i + 2]
	if s == 'SF':
		sf = sf + 1
	if s == 'FS':
		fs = fs + 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
count = 0
count1 = 0
for i in range(0, n - 1):
	if s[i + 1] == 'S' and s[i] == 'F':
		count += 1
	if s[i + 1] == 'F' and s[i] == 'S':
		count1 += 1
if count1 > count:
	print('yes')
else:
	print('no')


n = int(input())
sttr = input()
print('YES' if sttr.count('SF') > sttr.count('FS') else 'NO')


n = int(input())
flights = input()
(fs, sf) = (0, 0)
for i in range(n - 1):
	(a, b) = flights[i:i + 2]
	if a == 'F' and b == 'S':
		fs += 1
	elif a == 'S' and b == 'F':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
flights = [char for char in string]
SE_TO_SF = 0
SF_TO_SE = 0
for i in range(len(flights) - 1):
	if flights[i] == 'S' and flights[i + 1] == 'F':
		SE_TO_SF += 1
	elif flights[i] == 'F' and flights[i + 1] == 'S':
		SF_TO_SE += 1
	else:
		pass
if SE_TO_SF > SF_TO_SE:
	print('YES')
else:
	print('NO')


import sys
n = int(input(''))
string_n = input('')
if not len(string_n) == n or not (n >= 2 or n <= 100) or (not str.isupper(string_n)):
	print('Error')
	sys.exit(1)
F = False
S = False
F_S = 0
S_F = 0
for item in string_n:
	if item == 'F':
		if S == True:
			S_F += 1
			S = False
		F = True
	elif item == 'S':
		if F == True:
			F_S += 1
			F = False
		S = True
if S_F > F_S:
	print('YES')
else:
	print('NO')


n1 = input()
arr1 = input()
arr = []
for i in arr1:
	arr.append(i)
n = int(n1)
count = 0
for i in range(n):
	if arr[i] == 'S' and i + 1 < n:
		if arr[i + 1] == 'F':
			count += 1
	elif arr[i] == 'F' and i + 1 < n:
		if arr[i + 1] == 'S':
			count -= 1
if count <= 0:
	print('NO')
else:
	print('YES')


n = int(input())
fly = input()
prev = fly[0]
result = 0
if len(fly) == 1:
	print('NO')
else:
	for i in range(1, n):
		if prev != fly[i]:
			if prev == 'S':
				result += 1
			else:
				result -= 1
			prev = fly[i]
print('YES' if result > 0 else 'NO')


n = int(input())
st = input()
SF = st.count('SF')
FS = st.count('FS')
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sf = 0
st = 0
for i in range(1, n):
	if s[i] != s[i - 1]:
		if s[i] == 'F':
			sf += 1
		else:
			st += 1
print('YES' if sf > st else 'NO')


n = int(input())
a = input()
if a.count('SF') > a.count('FS'):
	print('Yes')
else:
	print('No')


a = int(input())
b = input()
f = 0
s = 0
for i in range(len(b) - 1):
	if b[i] + b[i + 1] == 'SF':
		f += 1
	elif b[i] + b[i + 1] == 'FS':
		s += 1
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
count1 = 0
count2 = 0
for i in range(len(l) - 1):
	if l[i:i + 2] == 'SF':
		count1 += 1
	elif l[i:i + 2] == 'FS':
		count2 += 1
if count1 > count2:
	print('YES')
else:
	print('NO')


x = int(input())
y = input()
kolvo = 0
for z in range(x - 1):
	if y[z] != y[z + 1]:
		if y[z] == 'F':
			kolvo += -1
		else:
			kolvo += 1
if kolvo >= 1:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
c = s.count('SF')
e = s.count('FS')
if c > e:
	print('YES')
else:
	print('NO')


a = int(input())
n = input()
if n.count('SF') > n.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
(inp, t) = ([x for x in str(input())], [])
for i in range(n - 1):
	if inp[i] != inp[i + 1]:
		if inp[i] == 'S':
			t.append(1)
		else:
			t.append(-1)
if sum(t) > 0:
	print('YES')
else:
	print('NO')


def is_pleasant(n, travel_string):
	s2sf = 0
	sf2s = 0
	for i in range(n - 1):
		if travel_string[i] == travel_string[i + 1]:
			continue
		elif travel_string[i + 1] == 'S':
			sf2s += 1
		else:
			s2sf += 1
	if s2sf > sf2s:
		print('YES')
	else:
		print('NO')
n = int(input())
travel_string = input()
is_pleasant(n, travel_string)


n = int(input())
string1 = input()
listk = []
for i in range(0, n, 1):
	k = string1[i:i + 2]
	listk.append(k)
fs = listk.count('FS')
sf = listk.count('SF')
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
num = 0
num1 = 0
for k in range(n - 1):
	if s[k] == 'S' and s[k + 1] == 'F':
		num += 1
	elif s[k] == 'F' and s[k + 1] == 'S':
		num1 += 1
if num > num1:
	print('YES')
else:
	print('NO')


l = input()
s = str(input())
x = s.count('SF')
y = s.count('FS')
if x <= y:
	print('NO')
else:
	print('YES')


import sys
import math
lol = input()
s = input()
print('YES' if s[0] == 'S' and s[-1] == 'F' else 'NO')


n = int(input())
m = input()
c = m.count('FS')
d = m.count('SF')
if m == 'SF':
	print('YES')
elif d > c:
	print('YES')
else:
	print('NO')


n = int(input())
K = input()
s = K.count('SF')
f = K.count('FS')
if s > f:
	print('Yes')
else:
	print('No')


n = int(input())
s = str(input())
ans = 'NO'
fly_counter = 0
initial_city = s[0]
for i in range(1, n):
	if s[i] != s[i - 1]:
		fly_counter += 1
if initial_city == 'S':
	if fly_counter % 2 == 1:
		ans = 'YES'
print(ans)


def isFlewMoreTimesFromSeattleToSanFrancisco(numberOfDays, flights):
	sToF = 0
	others = 0
	previous = flights[0]
	for x in range(1, len(flights)):
		if previous == 's' and flights[x] == 'f':
			sToF = sToF + 1
		elif previous == 'f' and flights[x] == 's':
			others = others + 1
		previous = flights[x]
	if sToF > others:
		print('YES')
	else:
		print('NO')
numberOfDays = int(input())
flights = input().lower()
isFlewMoreTimesFromSeattleToSanFrancisco(numberOfDays, flights)


n = int(input())
strr = input()
m = [ord(strr[i]) - ord(strr[i - 1]) for i in range(1, len(strr))]
print('YES' if m.count(-13) > m.count(13) else 'NO')


n = int(input())
cities = input()
print('YES' if 'S' == cities[0] and 'S' != cities[n - 1] else 'NO')


def program(n, a):
	current = a[0]
	san_fran = 0
	seattle = 0
	for i in range(1, n):
		if current != a[i]:
			if current == 'F':
				seattle += 1
			else:
				san_fran += 1
			current = a[i]
	if san_fran > seattle:
		return 'Yes'
	return 'No'
n = int(input())
string = input()
print(program(n, string))


n = int(input())
office = str(input())
san = 0
sea = 0
for i in range(n - 1):
	if office[i] == 'S' and office[i + 1] == 'F':
		san = san + 1
	elif office[i] == 'F' and office[i + 1] == 'S':
		sea = sea + 1
if san != 0 and san > sea:
	print('YES')
else:
	print('NO')


b = int(input())
a = input()
se = 0
sf = 0
for i in range(0, len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		se = se + 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		sf = sf + 1
if se > sf:
	print('YES')
else:
	print('NO')


input()
n = input()
k = 0
for i in range(len(n) - 1):
	if n[i] == 'S' and n[i + 1] == 'F':
		k = k + 1
	if n[i] == 'F' and n[i + 1] == 'S':
		k = k - 1
if k > 0:
	print('YES')
	exit()
print('NO')


a = input()
a = input()
b = a.split('FS')
a = a.split('SF')
if len(a) > len(b):
	print('YES')
else:
	print('NO')


n = int(input())
strok = input()
if strok.count('SF') > strok.count('FS'):
	print('YES')
else:
	print('NO')


not_gonna_use_this = input()
days = input()
SF = days.count('SF')
FS = days.count('FS')
if SF > FS:
	print('Yes')
else:
	print('No')


import math
import collections
import bisect
import heapq
import random
import time
N = int(input())
S = input()
tos = 0
tof = 0
for i in range(1, N):
	if S[i] == 'S' and S[i - 1] == 'F':
		tos += 1
	elif S[i] == 'F' and S[i - 1] == 'S':
		tof += 1
if tof > tos:
	print('YES')
else:
	print('NO')


a = input()
n = int(a)
word = input()
f = 0
s = 0
for x in range(1, n):
	if word[x - 1] == 'S' and word[x] == 'F':
		s = s + 1
	elif word[x - 1] == 'F' and word[x] == 'S':
		f = f + 1
if f >= s:
	print('NO')
else:
	print('YES')


(n, str) = (int(input()), input())
(fs, sf) = (0, 0)
for i in range(str.__len__() - 1):
	if str[i:i + 2] == 'FS':
		fs += 1
	elif str[i:i + 2] == 'SF':
		sf += 1
print('yes' if sf > fs else 'no')


n = int(input())
s = input()
(yes, no) = (0, 0)
for i in range(1, n):
	if s[i] != s[i - 1]:
		if s[i] == 'F':
			yes += 1
		else:
			no += 1
if yes > no:
	print('YES')
else:
	print('NO')


input()
i = input()
for _ in range(101):
	i = i.replace('SS', 'S').replace('FF', 'F')
i = i[1:]
print('YES' if i.count('F') > i.count('S') else 'NO')


from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline()
if s[0] == 'S' and s[n - 1] == 'F':
	stdout.write('YES')
else:
	stdout.write('NO')


input()
s = input()
print(('NO', 'YES')[s[0] + s[-1] == 'SF'])


input()
s = input()
t = f = 0
for (x, y) in zip(s, s[1:]):
	if x != y:
		t += 1
		f += y == 'F'
print('NYOE S'[f > t - f::2])


n = input()
s = input()
print(['NO', 'YES'][s[0] == 'S' and s[-1] == 'F'])


n = int(input())
s = input()
cnt_1 = int(0)
cnt_2 = int(0)
for i in range(1, n):
	if s[i - 1] == 'S' and s[i] == 'F':
		cnt_1 += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		cnt_2 += 1
if cnt_1 > cnt_2:
	print('Yes')
else:
	print('No')


n = int(input())
days = input()
start = days[0]
sf = 0
fs = 0
for i in range(1, n):
	if start != days[i]:
		if start == 'S':
			sf += 1
		else:
			fs += 1
	start = days[i]
print('YES' if sf > fs else 'NO')


n = int(input())
d = input()
s = 0
f = 0
for i in range(len(d) - 1):
	if d[i] == 'S' and d[i + 1] == 'F':
		f += 1
	elif d[i] == 'F' and d[i + 1] == 'S':
		s += 1
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
p = input()
x = 0
c = p[0]
for i in range(1, n):
	if p[i] == c:
		continue
	if c == 'F':
		x -= 1
	else:
		x += 1
	c = p[i]
print('YES' if x == 1 else 'NO')


input()
line = input()
line = line.lower()
sf = 0
fs = 0
for i in range(len(line) - 1):
	if line[i] == 's' and line[i + 1] == 'f':
		sf += 1
	elif line[i] == 'f' and line[i + 1] == 's':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


def manager(n, s):
	c1 = 0
	c2 = 0
	for i in range(n - 1):
		if s[i] == 'S' and s[i + 1] == 'F':
			c1 = c1 + 1
		elif s[i] == 'F' and s[i + 1] == 'S':
			c2 = c2 + 1
	if c1 > c2:
		return 'YES'
	else:
		return 'NO'
n = int(input())
s = str(input())
print(manager(n, s))


def dkwpwn(string):
	sfcount = fscount = 0
	for i in range(len(string) - 1):
		if string[i] == 'S' and string[i + 1] == 'F':
			sfcount += 1
		elif string[i] == 'F' and string[i + 1] == 'S':
			fscount += 1
	return 'YES' if sfcount > fscount else 'NO'
useless = int(input())
string = input()
print(dkwpwn(string))


n = int(input())
arr = list(input())
s2f = 0
f2s = 0
for i in range(n - 1):
	if arr[i] == 'S' and arr[i + 1] == 'F':
		s2f += 1
	elif arr[i] == 'F' and arr[i + 1] == 'S':
		f2s += 1
	else:
		pass
if s2f > f2s:
	print('YES')
else:
	print('NO')


n = int(input())
o = input()
FtS = 0
StF = 0
for i in range(1, n):
	if o[i - 1] == 'F' and o[i] == 'S':
		FtS += 1
	elif o[i - 1] == 'S' and o[i] == 'F':
		StF += 1
print('YES' if StF > FtS else 'NO')


n = int(input())
sf = str(input())
i = 0
k = 0
p = 0
while i < n - 1:
	if sf[i] == 'S' and sf[i + 1] == 'F':
		k += 1
	elif sf[i] == 'F' and sf[i + 1] == 'S':
		p += 1
	i += 1
if k > p:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
score = 0
for idx in range(n - 1):
	if s[idx] == 'F' and s[idx + 1] == 'S':
		score -= 1
	elif s[idx] == 'S' and s[idx + 1] == 'F':
		score += 1
if score > 0:
	print('YES')
else:
	print('NO')


c = int(input())
s = input()
if s[0] == 'S' and s[len(s) - 1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
p = ''
c = 0
d = 0
for i in input():
	if i != p and p == 'S' and (i == 'F'):
		c += 1
	elif i != p and p == 'F' and (i == 'S'):
		d += 1
	p = i
print('YES' if c > d else 'NO')


n = int(input())
d = [i for i in input()]
seattle_sanfran = 0
sanfran_seattle = 0
s = len(d)
for j in range(n):
	if j == s - 1:
		break
	if d[j] == 'S':
		if d[j + 1] == 'F':
			seattle_sanfran += 1
	elif d[j] == 'F':
		if d[j + 1] == 'S':
			sanfran_seattle += 1
if seattle_sanfran > sanfran_seattle:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
countS = s.count('SF')
countF = s.count('FS')
if countS > countF:
	print('YES')
else:
	print('NO')


a = int(input())
s = input()
d = 0
w = 0
for i in range(len(s)):
	if i + 1 == len(s):
		break
	else:
		if s[i] == 'S' and s[i + 1] == 'F':
			d = d + 1
		if s[i] == 'F' and s[i + 1] == 'S':
			w = w + 1
if d > w:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
temp = 0
F = 0
S = 0
z = 0
if s[0] == 'F':
	z = 0
else:
	z = 1
for i in range(n):
	if s[i] == 'F' and z == 0:
		F += 1
		z = 1
	elif z and s[i] == 'S':
		S += 1
		z = 0
if s[n - 1] == 'F':
	F -= 1
else:
	S -= 1
if F < S:
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
favorite = 0
non_favorite = 0
for i in range(len(cities) - 1):
	if cities[i] + cities[i + 1] == 'SF':
		favorite += 1
	elif cities[i] + cities[i + 1] == 'FS':
		non_favorite += 1
if favorite > non_favorite:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
print('NYOE S'[s.count('SF') > s.count('FS')::2])


n = int(input())
f = input()
curs = 0
for i in range(n - 1):
	curs += f[i] + f[i + 1] == 'SF'
	curs -= f[i] + f[i + 1] == 'FS'
else:
	print('YES' if curs > 0 else 'NO')


n = int(input())
days = input()
to_san_francisco = 0
to_seattle = 0
for i in range(1, len(days)):
	if days[i - 1] == 'S' and days[i] == 'F':
		to_san_francisco += 1
	elif days[i - 1] == 'F' and days[i] == 'S':
		to_seattle += 1
print('YES' if to_san_francisco > to_seattle else 'NO')


days = int(input())
c1 = 0
c2 = 0
flights = input()
for i in range(len(flights) - 1):
	if flights[i] == 'F' and flights[i + 1] == 'S':
		c1 += 1
	elif flights[i] == 'S' and flights[i + 1] == 'F':
		c2 += 1
if c1 > c2:
	print('NO')
elif c1 == c2:
	print('NO')
else:
	print('YES')


n = input()
sf = input()
print('YNEOS'[int(sf[0] == 'F' or sf[::-1][0] == sf[0])::2])


n = int(input())
ss = list(input())
f = 0
s = 0
l = ss[0]
for i in range(1, len(ss)):
	c = ss[i]
	if c == l:
		continue
	if c == 'F':
		f += 1
	else:
		s += 1
	l = c
print('YES') if f > s else print('NO')


x = int(input())
p = input()
cf = 0
cs = 0
for i in range(len(p) - 1):
	if p[i] == 'F' and p[i + 1] == 'S':
		cf += 1
	elif p[i] == 'S' and p[i + 1] == 'F':
		cs += 1
if cs > cf:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
g = s.count('SF')
b = s.count('FS')
if g > b:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	s = S()
	if s[0] == 'S' and s[-1] == 'F':
		return 'YES'
	return 'NO'
print(main())


def func(st):
	if st[0] == 'S' and st[-1] == 'F':
		return 'YES'
	else:
		return 'NO'
n = int(input())
st = input()
print(func(st))


a = int(input())
b = input()
i = 0
countfs = 0
countsf = 0
while i + 1 < a:
	if b[i] == 'F' and b[i + 1] == 'S':
		countfs += 1
	elif b[i] == 'S' and b[i + 1] == 'F':
		countsf += 1
	i += 1
if countsf > countfs:
	print('YES')
else:
	print('NO')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	N = Scanner.int()
	S = Scanner.string()
	now = S[0]
	cnt = [0] * 2
	for i in range(1, N):
		if now != S[i]:
			cnt[0 if now == 'F' else 1] += 1
			now = S[i]
	print('YNEOS '[cnt[0] >= cnt[1]::2])
main()


n = int(input())
string = input()
s = 0
f = 0
for i in range(n - 1):
	char1 = string[i]
	char2 = string[i + 1]
	if char1 == 'S' and char2 == 'F':
		f += 1
	if char1 == 'F' and char2 == 'S':
		s += 1
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
cs = 0
cf = 0
for i in range(n - 1):
	if s[i] == 'F':
		if s[i + 1] == 'S':
			cf = cf + 1
	if s[i] == 'S':
		if s[i + 1] == 'F':
			cs = cs + 1
	if s[i] == 'S':
		if s[i + 1] == 'S':
			cs = cs
	if s[i] == 'F':
		if s[i + 1] == 'F':
			cf = cf
if cs > cf:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
sf = 0
fs = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		sf += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		fs += 1
if sf > fs:
	print('YES')
elif sf <= fs:
	print('NO')


input()
s = input()
a = s.count('FS')
b = s.count('SF')
if b > a:
	print('YES')
else:
	print('no')


from sys import stdin
inp = stdin.readline
n = int(inp().strip())
s = inp().strip()
stf = 0
fts = 0
prev = s[0]
for city in s:
	if prev == 'S' and city == 'F':
		stf += 1
	elif prev == 'F' and city == 'S':
		fts += 1
	prev = city
print('YES' if stf > fts else 'NO')


n = int(input())
days = input()
if days.count('SF') > days.count('FS'):
	print('YES')
else:
	print('NO')


input()
s = str(input())
if s[0] == 'S' and s[-1] == 'F':
	print('Yes')
else:
	print('No')


input()
x = input()
if x.count('SF') > x.count('FS'):
	print('YES')
else:
	print('NO')


import sys
sys.stdin.readline()
input = sys.stdin.readline().strip()
if input[0] == 'S' and input[-1] == 'F':
	print('YES')
else:
	print('NO')


night = int(input())
str = [a for a in input()]
(s, f) = (0, 0)
for x in range(1, len(str)):
	if str[x] != str[x - 1] and str[x] == 'F':
		s += 1
	elif str[x] != str[x - 1] and str[x] == 'S':
		f += 1
if s > f:
	print('YES')
else:
	print('NO')


noOfDays = input()
noOfDays = int(noOfDays)
FlightsString = input()
(StoF, FtoS) = (0, 0)
for x in range(1, noOfDays):
	if FlightsString[x] == FlightsString[x - 1]:
		continue
	elif FlightsString[x] == 'S':
		FtoS += 1
	else:
		StoF += 1
print('Yes' if StoF > FtoS else 'No')


n = int(input())
stay = input()
flight_SF = 0
flight_FS = 0
for i in range(n - 1):
	if (stay[i] == 'F') & (stay[i + 1] == 'S'):
		flight_FS += 1
	elif (stay[i] == 'S') & (stay[i + 1] == 'F'):
		flight_SF += 1
if flight_SF > flight_FS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = 0
b = 0
for i in range(0, n - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		a += 1
	if s[i] == 'S' and s[i + 1] == 'F':
		b += 1
if b > a:
	print('Yes')
else:
	print('No')


import math, random, sys, os, re
n = int(input())
s = input()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
i = 0
countS = 0
countSF = 0
while i < n - 1:
	if s[i] == 'S' and s[i + 1] == 'F':
		countS += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		countSF += 1
	i += 1
if countS > countSF:
	print('YES')
else:
	print('NO')


days = int(input())
travel = input()
day_counter = 0
day_counter_1 = 2
sf_counter = 0
fs_counter = 0
while day_counter <= days:
	if 'SF' in travel[day_counter:day_counter_1]:
		sf_counter += 1
	elif 'FS' in travel[day_counter:day_counter_1]:
		fs_counter += 1
	day_counter += 1
	day_counter_1 += 1
if sf_counter > fs_counter:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
if string.count('SF') > string.count('FS'):
	print('YES')
else:
	print('NO')


y = int(input())
x = input()
if x.count('SF') > x.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
k = input()
sf = 0
fs = 0
if len(set(k)) == 1:
	print('NO')
else:
	for i in range(n - 1):
		if k[i] == 'S' and k[i + 1] == 'F':
			sf += 1
		elif k[i] == 'F' and k[i + 1] == 'S':
			fs += 1
	if sf > fs:
		print('YES')
	else:
		print('NO')


a = int(input())
s = input()
sf = 0
fs = 0
i = 0
while i != a:
	if s[i:i + 2] == 'SF':
		sf = sf + 1
	elif s[i:i + 2] == 'FS':
		fs = fs + 1
	i = i + 1
if sf > fs:
	print('Yes')
else:
	print('No')


n = int(input())
a = input()
sf = 0
fs = 0
r = a[0]
for i in range(1, n):
	if r != a[i]:
		if a[i] == 'S':
			r = 'S'
			fs += 1
		else:
			r = 'F'
			sf += 1
if sf > fs:
	print('yes')
else:
	print('no')


S_to_F_amount = 0
F_to_S_amount = 0
n = input()
(prev_city, next_city) = ('', '')
cities = input()
for city in cities:
	next_city = city
	if prev_city != '':
		if prev_city == 'S' and next_city != 'S':
			S_to_F_amount += 1
		elif prev_city != 'S' and next_city == 'S':
			F_to_S_amount += 1
	prev_city = next_city
if S_to_F_amount > F_to_S_amount:
	print('YES')
else:
	print('NO')


a = int(input())
b = str(input())
d = b.count('FS')
e = b.count('SF')
if e > d:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
res1 = 0
res2 = 0
for i in range(len(s) - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		res1 += 1
	elif s[i] == 'S' and s[i + 1] == 'F':
		res2 += 1
if res2 > res1:
	print('YES')
else:
	print('NO')


t = int(input())
city = input().upper()
if city.count('SF') > city.count('FS'):
	print('YES')
else:
	print('NO')


import sys
n = int(input())
x = input()
lst = x.split()
f = 0
if x[0] == 'S' and x[n - 1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
cnt = 0
for i in range(n):
	v = st[i:i + 2]
	if v == 'SF':
		cnt += 1
	elif v == 'FS':
		cnt -= 1
print(['NO', 'YES'][cnt > 0])


n = int(input().strip())
s = input().strip()
SF = FS = 0
for i in range(1, n):
	if s[i] == 'S' and s[i - 1] == 'F':
		FS += 1
	elif s[i] == 'F' and s[i - 1] == 'S':
		SF += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input())[:n]
count = 0
k = 0
f = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		count = count + 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		k += 1
	elif a[i] == 'F' and a[i] == 'F':
		f = 1
	else:
		f = 1
if count > k:
	print('YES')
elif f == 1:
	print('NO')
else:
	print('NO')


(n, tour, tours_count) = (int(input()), input(), [0] * 2)
for i in range(n - 1):
	if tour[i] != tour[i + 1]:
		if tour[i] == 'S':
			tours_count[0] += 1
		else:
			tours_count[1] += 1
print('YES' if tours_count[0] > tours_count[1] else 'NO')


n = int(input())
s = input()
base = s[0]
c = 0
while len(s) > 1:
	if s[0] != s[1]:
		c += 1
	s = s[1:]
if c % 2 == 1 and base == 'S':
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
f = 0
s = 0
i = 0
while i < n - 1:
	if string[i] == 'F' and string[i + 1] == 'S':
		f += 1
	elif string[i] == 'S' and string[i + 1] == 'F':
		s += 1
	i += 1
if s > f:
	print('YES')
else:
	print('NO')


from sys import stdin
q = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
(fs, sf) = (0, 0)
for i in range(1, q):
	if s[i] == 'S' and s[i - 1] == 'F':
		fs += 1
	elif s[i] == 'F' and s[i - 1] == 'S':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
seattle = 0
san_fran = 0
for i in range(n):
	if s[i] == 'F' and (i + 1 < n and s[i + 1] == 'S'):
		san_fran += 1
	elif s[i] == 'S' and (i + 1 < n and s[i + 1] == 'F'):
		seattle += 1
if seattle > san_fran:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
cnt1 = 0
cnt2 = 0
s1 = ''
for i in range(1, n):
	if s[i - 1] == 'S' and s[i] == 'F':
		cnt1 += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		cnt2 += 1
if cnt1 > cnt2:
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
prev = st[0]
(more, less) = (0, 0)
for i in range(1, n):
	if prev == 'S' and st[i] == 'F':
		more += 1
	elif prev == 'F' and st[i] == 'S':
		less += 1
	prev = st[i]
if more > less:
	print('Yes')
else:
	print('No')


a = input()
b = input()
sf = b.count('SF')
fs = b.count('FS')
if sf > fs:
	print('YES')
else:
	print('NO')


def sol():
	n = int(input())
	s = input()
	print('YES' if s[0] == 'S' and s[n - 1] == 'F' else 'NO')
sol()


n = int(input())
s = input()
k = []
i = n - 1
sf = fs = 0
while i > 0:
	if s[i] != s[i - 1]:
		k.append(s[i - 1] + s[i])
		i -= 1
	else:
		i -= 1
for i in k:
	if i == 'SF':
		sf += 1
	else:
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
s = 0
f = 0
l = b[0]
for i in range(1, a):
	if b[i] != l:
		if b[i] == 'S':
			s += 1
		else:
			f += 1
	l = b[i]
if f > s:
	print('YES')
else:
	print('NO')


input()
s = list(input())
prev = s[0]
toS = 0
toF = 0
for i in range(1, len(s)):
	if s[i] == 'F' and s[i - 1] == 'S':
		toF += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		toS += 1
print('YES' if toF > toS else 'NO')


n = int(input())
s = input()
s = list(s)
counts = 0
countf = 0
for i in range(1, len(s)):
	if s[i - 1] == 'S' and s[i] == 'F':
		counts += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		countf += 1
if counts > countf:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
s_to_f = 0
f_to_s = 0
for c in range(len(s) - 1):
	if s[c] == 'S' and s[c + 1] == 'F':
		s_to_f += 1
	elif s[c] == 'F' and s[c + 1] == 'S':
		f_to_s += 1
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


a = int(input())
c = input()
s = 0
f = 0
for i in range(a - 1):
	if c[i] == 'S' and c[i + 1] == 'F':
		f += 1
	if c[i] == 'F' and c[i + 1] == 'S':
		s += 1
if f > s:
	print('YES')
else:
	print('No')


n = int(input())
st = input()
c1 = 0
c2 = 0
for i in range(1, len(st)):
	if st[i] == 'F' and st[i - 1] == 'S':
		c1 = c1 + 1
	elif st[i] == 'S' and st[i - 1] == 'F':
		c2 = c2 + 1
if c1 > c2:
	print('YES')
else:
	print('NO')


n = input()
s = input()
n = int(n)
cnt = 0
i = 0
while i < len(s) - 1:
	if s[i] == 'S' and s[i + 1] == 'F':
		cnt = cnt + 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		cnt = cnt - 1
	i += 1
if cnt > 0:
	print('YES')
else:
	print('NO')


def split(word):
	return [char for char in word]
n = int(input())
city = input()
city = split(city)
stof = 0
ftos = 0
for i in range(n - 1):
	if city[i] == 'F' and city[i + 1] == 'S':
		ftos += 1
	elif city[i] == 'S' and city[i + 1] == 'F':
		stof += 1
	else:
		continue
if stof > ftos:
	print('YES')
else:
	print('NO')


n = int(input())
shed = str(input())
ToS = 0
ToF = 0
for i in range(len(shed) - 1):
	if shed[i] == 'S' and shed[i + 1] == 'F':
		ToF += 1
	if shed[i] == 'F' and shed[i + 1] == 'S':
		ToS += 1
if ToF > ToS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
(ts, tf) = (0, 0)
l = 'N'
for i in range(n):
	if s[i] != l:
		if l == 'F':
			ts += 1
		elif l == 'S':
			tf += 1
	l = s[i]
if tf > ts:
	print('YES')
else:
	print('NO')


input()
s = input().strip()
last = s[0]
fts = stf = 0
for c in s:
	if c != last:
		if c == 'S':
			fts += 1
		else:
			stf += 1
	last = c
print('Yes' if stf > fts else 'No')


import sys
n = int(input())
s = input()
s_to_f = f_to_s = 0
pre = s[0]
for i in range(1, n):
	if s[i] != pre and (pre == 'F' and s[i] == 'S'):
		f_to_s += 1
	elif s[i] != pre and (pre == 'S' and s[i] == 'F'):
		s_to_f += 1
	pre = s[i]
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


from sys import stdin
n = int(stdin.readline())
days = stdin.readline()
more = 0
for i in range(0, n - 1):
	if days[i] != days[i + 1]:
		if days[i + 1] == 'F':
			more += 1
		else:
			more -= 1
if more > 0:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(str, input()))
if a[0] == 'S' and a[n - 1] == 'F':
	print('YES')
else:
	print('NO')


(n, s) = (int(input()), input())
(last, cntf, cnts) = (s[0], 0, 0)
for i in s:
	if i != last:
		if i == 'F':
			cnts += 1
		else:
			cntf += 1
		last = i
print('YES' if cnts > cntf else 'NO')


n = int(input())
tofrance = 0
tosietle = 0
line = [i for i in input()]
for i in range(1, n):
	if line[i] != line[i - 1]:
		if line[i] == 'F':
			tofrance += 1
		else:
			tosietle += 1
if tofrance > tosietle:
	print('YES')
else:
	print('NO')


num_of_days = input()
pattern = input()
counter = 0
false_counter = 0
if 'S' not in pattern:
	print('NO')
else:
	for char in range(len(pattern) - 1):
		if pattern[char] + pattern[char + 1] == 'SF':
			counter += 1
		elif pattern[char] + pattern[char + 1] == 'FS':
			false_counter += 1
	if counter > false_counter:
		print('YES')
	else:
		print('NO')


n = int(input())
lst = list(input())
count = 0
for i in range(n - 1):
	if lst[i] + lst[i + 1] == 'FS':
		count -= 1
	if lst[i] + lst[i + 1] == 'SF':
		count += 1
if count > 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
seattle_to_sf = 0
sf_to_seattle = 0
if n == 0:
	print('NO')
	sys.exit()
prev_c = s[0]
for c in s[1:]:
	if c == 'F' and prev_c == 'S':
		seattle_to_sf += 1
	elif c == 'S' and prev_c == 'F':
		sf_to_seattle += 1
	prev_c = c
if seattle_to_sf > sf_to_seattle:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
(counti, countj) = (0, 0)
for i in range(0, 1):
	for j in range(0, n - 1):
		if a[j] == 'S' and a[j + 1] == 'F':
			counti += 1
		elif a[j] == 'F' and a[j + 1] == 'S':
			countj += 1
if counti > countj:
	print('YES')
	exit()
print('NO')


a = input()
b = input()
c = b[:int(a)]
s_FS = 0
s_SF = 0
for i in range(len(c) - 1):
	if c[i:i + 2] == 'SF':
		s_SF += 1
	if c[i:i + 2] == 'FS':
		s_FS += 1
if s_SF > s_FS:
	print('YES')
else:
	print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
n = int(input())
s = input()
(nd, ndd) = (0, 0)
for i in range(0, n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		nd += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		ndd += 1
if nd > ndd:
	print('YES')
else:
	print('NO')


def bw_ofc(offices):
	ofcs = {'F': 0, 'S': 0}
	for i in range(1, len(offices)):
		if offices[i] != offices[i - 1]:
			ofcs[offices[i - 1]] += 1
	if ofcs['F'] >= ofcs['S']:
		print('NO')
	else:
		print('YES')
n = int(input().strip(' '))
offices = input().strip(' ')
bw_ofc(offices)


n = int(input())
s = input()
c = 0
d = 0
for i in range(n - 1):
	if s[i] + s[i + 1] == 'SF':
		c += 1
	if s[i] + s[i + 1] == 'FS':
		d += 1
if c > d:
	print('YES')
else:
	print('NO')


n = input()
bef = ''
sf = 0
fs = 0
string = input()
for a in string:
	if a == 'S':
		if bef == 'F':
			fs = fs + 1
	elif a == 'F':
		if bef == 'S':
			sf = sf + 1
	bef = a
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
flights = input()
if flights.count('SF') > flights.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
cities = list(cities)
to_francisco_seattle = 0
previous = cities[0]
for i in range(1, n):
	if previous == 'F' and cities[i] == 'S':
		to_francisco_seattle -= 1
	if previous == 'S' and cities[i] == 'F':
		to_francisco_seattle += 1
	previous = cities[i]
if to_francisco_seattle > 0:
	print('Yes')
else:
	print('No')


def main():
	n = int(input().strip())
	flights = input().strip()
	sfflights = 0
	fsflights = 0
	prev = flights[0]
	for i in range(1, n):
		curr = flights[i]
		if prev == 'F' and curr == 'S':
			fsflights += 1
		elif prev == 'S' and curr == 'F':
			sfflights += 1
		prev = curr
	if sfflights > fsflights:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
o = list(input())
f = 0
s = 0
for i in range(0, n - 1):
	if o[i] == 'S' and o[i + 1] == 'F':
		s += 1
	if o[i] == 'F' and o[i + 1] == 'S':
		f += 1
if s > f:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	if s[i] == 'F' and s[i - 1] == 'S':
		ans += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		ans -= 1
if ans > 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
cnt = [0, 0]
for x in range(1, n):
	if s[x] != s[x - 1]:
		if s[x] == 'F':
			cnt[0] += 1
		else:
			cnt[1] += 1
if cnt[0] > cnt[1]:
	print('YES')
else:
	print('NO')


n = int(input())
sl = input()
sf = 0
fs = 0
last = '-1'
for x in sl:
	if last == '-1' or last == x:
		last = x
		continue
	elif last == 'S' and x == 'F':
		sf += 1
	else:
		fs += 1
	last = x
if sf > fs:
	print('YES')
else:
	print('NO')


s = input()
s = input()
(s_f, f_s) = (0, 0)
for i in range(1, len(s)):
	s_f += 1 if s[i - 1] == 'S' and s[i] == 'F' else 0
	f_s += 1 if s[i - 1] == 'F' and s[i] == 'S' else 0
if s_f > f_s:
	print('YES')
else:
	print('NO')


_ = int(input())
s = input()
ftos = 0
stof = 0
p = s[0]
for c in s[1:]:
	if c != p:
		if c == 'F':
			stof += 1
		else:
			ftos += 1
	p = c
print('YES' if stof > ftos else 'NO')


n = int(input())
s = input()
if 'SF' in s and 'FS' in s:
	if s.count('SF') > s.count('FS'):
		print('YES')
	else:
		print('NO')
elif 'SF' in s:
	print('YES')
else:
	print('NO')


n = int(input())
print('YES' if input()[::n - 1] == 'SF' else 'NO')


n = int(input())
s = input()
sanf = s.count('SF')
seatt = s.count('FS')
if sanf > seatt:
	print('YES')
else:
	print('NO')


n = int(input())
x = str(input())
s = x.count('SF')
f = x.count('FS')
if s == 0 or s < f or s == f:
	print('NO')
else:
	print('YES')


no_days = int(input())
locations = input()
print('YES' if locations.count('SF') > locations.count('FS') else 'NO')


n = int(input())
x = input()
a = 0
b = 0
for i in range(len(x)):
	if i == len(x) - 1:
		break
	elif x[i] == 'F' and x[i + 1] == 'S':
		b += 1
	elif x[i] == 'S' and x[i + 1] == 'F':
		a += 1
if a > b:
	print('YES')
else:
	print('NO')


b = list()
c = list()
a = int(input())
d = str(input())

def top():
	for i in range(a - 1):
		if d[i] + d[i + 1] == 'SF':
			b.append(1)
		elif d[i] + d[i + 1] == 'FS':
			c.append(1)
		else:
			continue
top()
if len(b) > len(c):
	print('YES')
else:
	print('NO')


n = int(input())
s = [x for x in input()]
sf = fs = 0
temp = s[0]
for x in s:
	if x != temp:
		if temp == 'S':
			sf = sf + 1
		else:
			fs = fs + 1
	temp = x
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
se = 0
sf = 0
for i in range(1, n):
	if s[i] == 'S' and s[i - 1] == 'F':
		se += 1
	elif s[i] == 'F' and s[i - 1] == 'S':
		sf += 1
if se < sf:
	print('yes')
else:
	print('no')


t = int(input())
days = input()
if days.count('SF') > days.count('FS'):
	print('YES')
else:
	print('NO')


x = int(input())
town = input()
FS = town.count('FS')
SF = town.count('SF')
print('yes' if SF > FS else 'no')


n = int(input())
p = input()
if p.startswith('S') and p.endswith('F'):
	print('YES')
else:
	print('NO')


n = int(input())
q = input()
a = list(q)
s = 0
f = 0
for i in range(1, len(q)):
	if a[i] == 'S' and a[i - 1] != 'S':
		s = s + 1
	elif a[i] == 'F' and a[i - 1] != 'F':
		f = f + 1
if f > s:
	print('YES')
else:
	print('NO')


workdays = int(input())
Dayloc = input()
if Dayloc.count('SF') > Dayloc.count('FS'):
	print('YES')
else:
	print('NO')


cnt = int(input())
locs = input()
(pre, sf, fs) = (locs[0], 0, 0)
for i in range(1, len(locs)):
	if pre != locs[i]:
		if locs[i] == 'S':
			fs += 1
		elif locs[i] == 'F':
			sf += 1
	pre = locs[i]
if sf > fs:
	print('YES')
else:
	print('NO')


import sys
for s in sys.stdin:
	string = str(input())
	if string.count('SF') > string.count('FS'):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
s = input()
if s[0] == 'S' and s[len(s) - 1] == 'F':
	print('YES\n')
	exit()
print('NO\n')


n = int(input())
s = input()
d = dict(S=-1, F=1)
c = 0
x = s[0]
for i in s[1:]:
	if i != x:
		c += d[i]
	x = i
if c > 0:
	print('YES')
else:
	print('NO')


input()
t = input()
print(['NO', 'YES'][t[0] == 'S' and t[-1] == 'F'])


n = int(input())
city = list(input())
count = 0
for i in range(1, n):
	if city[i - 1] == 'S' and city[i] == 'F':
		count += 1
	if city[i - 1] == 'F' and city[i] == 'S':
		count -= 1
if count >= 1:
	print('YES')
else:
	print('NO')


def fl(s):
	sfCount = 0
	fsCount = 0
	for i in range(0, len(s) - 1):
		if s[i] + s[i + 1] == 'SF':
			sfCount += 1
		elif s[i] + s[i + 1] == 'FS':
			fsCount += 1
	if sfCount > fsCount:
		print('YES')
	else:
		print('NO')
input()
s = input()
fl(s)


input()
k = input()
s = 0
f = 0
for i in range(len(k) - 1):
	if k[i] == 'S' and k[i + 1] == 'F':
		s += 1
	elif k[i] == 'F' and k[i + 1] == 'S':
		f += 1
print('YES' if s > f else 'NO')


_ = input()
locations = input()
if locations[0] == 'S' and locations[-1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
k = list(l)
c = 0
d = 0
for i in range(n - 1):
	if k[i] == 'S' and k[i + 1] == 'F':
		c += 1
	if k[i] == 'F' and k[i + 1] == 'S':
		d += 1
if c > d:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	offices = input()
	sf_to_se = 0
	se_to_sf = 0
	for i in range(0, n - 1):
		if offices[i] == 'S' and offices[i + 1] == 'F':
			se_to_sf += 1
		elif offices[i] == 'F' and offices[i + 1] == 'S':
			sf_to_se += 1
	if se_to_sf > sf_to_se:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
cities = input()
cities = cities.upper()
s_to_f = 0
f_to_s = 0
last = cities[0]
for i in range(1, len(cities)):
	if last == 'F' and cities[i] == 'S':
		f_to_s += 1
	if last == 'S' and cities[i] == 'F':
		s_to_f += 1
	last = cities[i]
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
freq = {'FS': 0, 'SF': 0}
i = 0
while i < n - 1:
	flight = s[i:i + 2]
	if flight == 'SF' or flight == 'FS':
		freq[flight] += 1
	i += 1
if freq['SF'] > freq['FS']:
	print('YES')
else:
	print('NO')


input()
s = input()
s2 = ''
for ch in s:
	if len(s2) == 0 or ch != s2[-1]:
		s2 += ch
s2 = s2[1:]
x = 0
for ch in s2:
	x += 1 if ch == 'F' else -1
print('YES' if x > 0 else 'NO')


n = int(input())
s = input()
sf = 0
fs = 0
for i in range(n - 1):
	if s[i] != s[i + 1]:
		sf += s[i] == 'S'
		fs += s[i] == 'F'
print('YNEOS'[sf <= fs::2])


n = int(input())
s = input()
cnt = 0
prev = 0 if s[0] == 'F' else 1
for i in range(1, len(s)):
	cur = 0 if s[i] == 'F' else 1
	if cur != prev:
		if cur == 1:
			cnt -= 1
		else:
			cnt += 1
	prev = cur
print('YES' if cnt > 0 else 'NO')


n = int(input())
s = input()
stof = ftos = 0
for (pre, nex) in zip(s[:-1], s[1:]):
	if pre == 'S' and nex == 'F':
		stof += 1
	elif pre == 'F' and nex == 'S':
		ftos += 1
print('YES' if stof > ftos else 'NO')


n = input()
s = input()
fr = 0
si = 0
for i in range(len(s) - 1):
	if (s[i] == 'F') & (s[i + 1] == 'S'):
		fr += 1
	if (s[i] == 'S') & (s[i + 1] == 'F'):
		si += 1
if fr < si:
	print('YES')
else:
	print('NO')


n = input().split()
Day = input()
f = 0
s = 0
for i in range(len(Day) - 1):
	if Day[i] == 'F':
		if Day[i + 1] == 'S':
			f += 1
for i in range(len(Day) - 1):
	if Day[i] == 'S':
		if Day[i + 1] == 'F':
			s += 1
if s > f:
	print('Yes')
else:
	print('No')


n = int(input())
m = input()
a = None
count = 0
for o in m:
	if a is None:
		a = o
	elif a != o:
		a = o
		count = count + 1
	else:
		continue
if count % 2 == 0:
	print('NO')
elif m[0] == 'S':
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
count = 0
for i in range(len(s) - 1):
	if s[i:i + 2] == 'SF':
		count += 1
	elif s[i:i + 2] == 'FS':
		count -= 1
if count > 0:
	print('YES')
else:
	print('NO')


num = int(input())
string = input()
sf = 0
fs = 0
for p in range(num - 1):
	if string[p] == 'S' and string[p + 1] == 'F':
		sf += 1
	if string[p] == 'F' and string[p + 1] == 'S':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
city = input()
if city.count('SF') > city.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
(s, f) = (0, 0)
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		if a[i] == 'F':
			f += 1
		else:
			s += 1
print('YES' if s > f else 'NO')


import time
import collections

class Time_test:

	def __enter__(self):
		self.enter_time = time.time()

	def __exit__(self, exc_type, exc_val, exc_tb):
		print('Command was executed in', time.time() - self.enter_time)
n = int(input())
ipt = [x for x in input()]
p = ipt.pop(0)
fs = 0
sf = 0
for elem in ipt:
	if p == 'F' and elem == 'S':
		fs += 1
	elif p == 'S' and elem == 'F':
		sf += 1
	p = elem
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
print(('NO', 'YES')[l[0] == 'S' and l[-1] == 'F'])


days = int(input())
i = input()
prev = 'none'
s = 0
f = 0
for letter in i:
	if letter == 'F':
		if prev == 'S':
			f += 1
		else:
			f += 0
	elif prev == 'F':
		s += 1
	else:
		s += 0
	prev = letter
if f > s:
	print('YES')
else:
	print('NO')


i = int(input())
a = input()
count1 = a.count('SF')
count2 = a.count('FS')
if count1 > count2:
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
good_flies: int = 0
for i in range(len(cities) - 1):
	if cities[i] == 'S' and cities[i + 1] == 'F':
		good_flies += 1
	elif cities[i] == 'F' and cities[i + 1] == 'S':
		good_flies -= 1
if good_flies > 0:
	print('YES')
else:
	print('NO')


input()
days_offices = input()
print('YES' if days_offices.count('SF') > days_offices.count('FS') else 'NO')


n = int(input())
nstr = input()
sf_count = 0
fs_count = 0
for x in range(len(nstr) - 1):
	if nstr[x] != nstr[x + 1]:
		if nstr[x] == 'S':
			sf_count += 1
		else:
			fs_count += 1
if sf_count > fs_count:
	print('YES')
else:
	print('NO')


n = int(input())
k = str(input())
s = 0
f = 0
for i in range(0, n - 1):
	if k[i] + k[i + 1] == 'SF':
		f += 1
	if k[i] + k[i + 1] == 'FS':
		s += 1
if s >= f:
	print('No')
elif f > s:
	print('Yes')


x = input()
z = input()
s_f = z.count('SF')
f_z = z.count('FS')
if s_f > f_z:
	print('YES')
else:
	print('NO')


input()
FS = 0
SF = 0
prev = 'X'
for i in input():
	if i == 'F' and prev == 'S':
		SF += 1
	elif i == 'S' and prev == 'F':
		FS += 1
	prev = i
print('YES' if SF > FS else 'NO')


_ = int(input())
flights = str(input())
print('YES' if flights.count('SF') > flights.count('FS') else 'NO')


n = int(input())
a = input()
(x, y) = (0, 0)
for i in range(len(a) - 1):
	c = a[i:i + 2]
	if a[i:i + 2] == 'SF':
		x += 1
	elif a[i:i + 2] == 'FS':
		y += 1
if x > y:
	print('YES')
else:
	print('NO')


n = int(input())
string = list(input())
count = 0
chage = 0
for i in range(0, n - 1):
	if string[i] == 'S' and string[i + 1] == 'F':
		chage += 1
	elif string[i] == 'F' and string[i + 1] == 'S':
		count += 1
if chage > count:
	print('YES')
else:
	print('NO')


def flight(s):
	letter = ''
	countF = 0
	countS = 0
	locations = [i for i in s]
	for i in range(len(locations)):
		if i == 0:
			letter = locations[i]
		elif locations[i] == 'F' and letter != locations[i]:
			countS += 1
			letter = locations[i]
		elif locations[i] == 'S' and letter != locations[i]:
			countF += 1
			letter = locations[i]
	if countS > countF:
		return 'YES'
	return 'NO'
n = input().strip()
s = list(map(str, input().strip()))
print(flight(s))


queries = input()
string = input()
previous = string[0]
S = 0
F = 0
for char in string[1:]:
	if previous != char:
		if char == 'F':
			F += 1
		else:
			S += 1
	previous = char
if F > S:
	print('YES')
else:
	print('NO')


n = int(input())
m = input()
ans = m[0]
s = 0
for i in range(1, n):
	if m[i] != ans:
		s += 1
		ans = m[i]
if m[0] == 'S' and s % 2 != 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input())
countsf = 0
countfs = 0
for i in range(n):
	if 'SF' in s[i:i + 2]:
		countsf += 1
	else:
		continue
for j in range(n):
	if 'FS' in s[j:j + 2]:
		countfs += 1
	else:
		continue
if countsf > countfs:
	print('YES')
else:
	print('NO')


input()
X = input()
print('YES' if X.count('SF') > X.count('FS') else 'NO')


n = int(input())
x = input()
l = list(x)
j = p = 0
for i in range(n - 1):
	if l[i] == 'S' and l[i + 1] == 'F':
		j += 1
	elif l[i] == 'F' and l[i + 1] == 'S':
		p += 1
if j > p:
	print('yes')
else:
	print('no')


_ = int(input())
cities = input()
from_seattle = 0
to_seattle = 0
for i in range(len(cities) - 1):
	if cities[i] == 'S' and cities[i + 1] == 'F':
		from_seattle += 1
	elif cities[i] == 'F' and cities[i + 1] == 'S':
		to_seattle += 1
print('Yes' if from_seattle > to_seattle else 'No')


n = int(input())
ch = input()
aux = ch[0]
ch = ch[1:]
(sf, fs) = (0, 0)
for i in ch:
	if aux + i == 'FS':
		fs += 1
	if aux + i == 'SF':
		sf += 1
	aux = i
if sf > fs:
	print('YES')
else:
	print('NO')


input()
s = input()
ans = s.count('SF') - s.count('FS')
print('YES' if ans > 0 else 'NO')


days = int(input())
location = str(input())
ans = 0
for i in range(days - 1):
	day1 = location[i]
	day2 = location[i + 1]
	if day1 == 'S' and day2 == 'F':
		ans += 1
	if day1 == 'F' and day2 == 'S':
		ans -= 1
if ans > 0:
	print('YES')
else:
	print('NO')


x = int(input())
a = input()
fgh = 0
dfg = 0
for i in range(x - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		fgh += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		dfg += 1
if fgh > dfg:
	print('YES')
else:
	print('NO')


input()
s = ''
for c in input():
	if not s or s[-1] != c:
		s += c
s = s[1:]
print('YES' if s.count('F') > s.count('S') else 'NO')


no_of_days = int(input())
stay = input()

def count_flights(stay, travel):
	return stay.count(travel)
if count_flights(stay, 'SF') > count_flights(stay, 'FS'):
	print('YES')
else:
	print('NO')


days = int(input())
string = input()
sf_count = string.count('SF')
fs_count = string.count('FS')
if sf_count > fs_count:
	print('YES')
else:
	print('NO')


input()
t = input()
print('YES' if t.count('SF') > t.count('FS') else 'NO')


_ = input()
s = input()
if (s[0], s[-1]) == ('S', 'F'):
	print('YES')
else:
	print('NO')


class CodeforcesTask867ASolution:

	def __init__(self):
		self.result = ''
		self.flights = ''

	def read_input(self):
		input()
		self.flights = input()

	def process_task(self):
		s_to_f = self.flights.count('SF')
		f_to_s = self.flights.count('FS')
		if s_to_f > f_to_s:
			self.result = 'YES'
		else:
			self.result = 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask867ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
s = input()
sp = []
sp += s
seat = 0
san = 0
st = ''
st1 = ''
for i in range(n):
	st += sp[i]
	if len(st) == 2:
		if st == 'SF':
			san += 1
		elif st == 'FS':
			seat += 1
		st = sp[i]
if seat >= san:
	print('NO')
elif seat < san:
	print('YES')


days = input()
sch = input()
cnt1 = 0
cnt2 = 0
s = sch[0]
for i in sch:
	if i != s and i == 'F':
		cnt1 += 1
		s = i
	if i != s and i == 'S':
		cnt2 += 1
		s = i
if cnt1 > cnt2:
	print('Yes')
else:
	print('NO')


input()
s = input()
s.upper()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


number = int(input())
seq = input()
f_s = 0
s_f = 0
previous = seq[0]
for i in seq[1:]:
	if i != previous:
		if i == 'S':
			f_s += 1
		else:
			s_f += 1
	previous = i
if s_f > f_s:
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
cnt = 0
other = 0
for a in range(1, len(cities)):
	if cities[a] == 'F' and cities[a - 1] == 'S':
		cnt += 1
	elif cities[a] == 'S' and cities[a - 1] == 'F':
		other += 1
if cnt > other:
	print('YES')
else:
	print('NO')


n = int(input())
str = str(input())
sum = 0
for file in range(1, len(str)):
	i = str[file - 1]
	if i == 'S' and i == str[file]:
		continue
	elif i == 'S' and str[file] != 'S':
		sum += 1
	elif i == 'F' and str[file] != 'F':
		sum -= 1
if sum <= 0:
	print('NO')
else:
	print('YES')


n = int(input())
Reise = str(input())
SF = 0
FS = 0
for i in range(n - 1):
	if Reise[i] == 'S' and Reise[i + 1] == 'F':
		SF += 1
	elif Reise[i] == 'F' and Reise[i + 1] == 'S':
		FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


a = int(input())
s = input()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


import re
n = int(input())
x = input()
pt1 = 'SF'
pt2 = 'FS'
a = re.findall(pt1, x)
b = re.findall(pt2, x)
if len(a) > len(b):
	print('YES')
else:
	print('NO')


t = int(input())
n = input()
(v, c) = (0, 0)
for i in range(0, len(n) - 1):
	if n[i] == 'F' and n[i] != n[i + 1]:
		v += 1
	if n[i] == 'S' and n[i] != n[i + 1]:
		c += 1
if c > v:
	print('YES')
else:
	print('NO')


n = int(input().strip())
s = input()
a = [0, 0]
a[0] = s.count('SF')
a[1] = s.count('FS')
print('YES') if a[0] > a[1] else print('NO')


_ = input()
str = input()
print('YES' if str.count('SF') > str.count('FS') else 'NO')


n = int(input())
s = input()
l = list(s)
cout = 0
cout2 = 0
for i in range(len(l) - 1):
	c1 = l[i]
	c2 = l[i + 1]
	if c1 == 'S' and c2 == 'F':
		cout = cout + 1
	if c1 == 'F' and c2 == 'S':
		cout2 = cout2 + 1
if cout > cout2:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
sfs = 0
ssf = 0
i = 0
while i < n - 1:
	if a[i] == 'F' and a[i + 1] == 'S':
		sfs += 1
	elif a[i] == 'S' and a[i + 1] == 'F':
		ssf += 1
	i += 1
if ssf > sfs:
	print('YES')
else:
	print('NO')


n = int(input())
str_n = input().upper()
count_sf = 0
count_fs = 0
for i in range(len(str_n) - 1):
	if str_n[i] == 'S' and str_n[i + 1] == 'F':
		count_sf += 1
	elif str_n[i] == 'F' and str_n[i + 1] == 'S':
		count_fs += 1
if count_sf > count_fs:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
a = 0
b = 0
for i in range(n - 1):
	if string[i] != string[i + 1]:
		if string[i] == 'S':
			a += 1
		else:
			b += 1
if a > b:
	print('YES')
else:
	print('NO')


num = int(input(''))
string1 = input('')
SanFrancisco = string1.count('SF')
Seattle = string1.count('FS')
if SanFrancisco > Seattle:
	print('YES')
else:
	print('NO')


n = int(input())
ch = input()
if ch[0] == 'S' and ch[len(ch) - 1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
d = input()
f = d.count('SF')
s = d.count('FS')
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
s1 = string
s2 = string
cnt1 = 0
cnt2 = 0
for i in range(len(string)):
	if 'SF' in s1:
		s1 = s1[:s1.index('SF')] + s1[s1.index('SF') + 2:]
		cnt1 += 1
	if 'FS' in s2:
		s2 = s2[:s2.index('FS')] + s2[s2.index('FS') + 2:]
		cnt2 += 1
if cnt1 > cnt2:
	print('YES')
else:
	print('NO')


n = int(input())
str = input()
dom = str.count('SF')
sub = str.count('FS')
if dom > sub:
	print('YES')
else:
	print('NO')


n = int(input())
s_f = f_s = 0
string = input()
for i in range(1, n):
	if string[i - 1] == 'S' and string[i] == 'F':
		s_f += 1
	if string[i - 1] == 'F' and string[i] == 'S':
		f_s += 1
if s_f > f_s:
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
sumfs = 0
sumsf = 0
i = 0
while i < n - 1:
	if st[i] == 'S' and st[i + 1] == 'F':
		sumsf += 1
		i += 1
	elif st[i] == 'F' and st[i + 1] == 'S':
		sumfs += 1
		i += 1
	else:
		i += 1
if sumsf > sumfs:
	print('YES', end='')
else:
	print('NO', end='')


(len, string) = (int(input()), input())
count = 0
for (i, j) in zip(string[:-1], string[1:]):
	if i == 'F' and j == 'S':
		count -= 1
	elif i == 'S' and j == 'F':
		count += 1
if count > 0:
	print('YES')
else:
	print('NO')


n = int(input())
k = 0
a = input()
for i in range(n - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		k = k + 1
	if a[i] == 'F' and a[i + 1] == 'S':
		k = k - 1
if k > 0:
	print('YES')
else:
	print('NO')


num_days = int(input())
travel_iten = input()
travel_SF = 0
travel_FS = 0
for i in range(num_days - 1):
	if travel_iten[i] == 'S' and travel_iten[i + 1] == 'F':
		travel_SF += 1
	elif travel_iten[i] == 'F' and travel_iten[i + 1] == 'S':
		travel_FS += 1
if travel_SF > travel_FS:
	print('YES')
else:
	print('NO')


def solve(test):
	n = int(input())
	s = input()
	S = 0
	F = 0
	for i in range(1, n):
		if s[i] != s[i - 1]:
			if s[i - 1] == 'S':
				S += 1
			else:
				F += 1
	print('YES' if S > F else 'NO')
t = 1
for _ in range(t):
	solve(_ + 1)


days = input()
offices = input()
(fs, sf) = (0, 0)
for i in range(len(offices) - 1):
	if offices[i:i + 2] == 'FS':
		fs += 1
	elif offices[i:i + 2] == 'SF':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


def main():
	_ = input()
	(s, *_, f) = input()
	print(('NO', 'YES')[f < s])
main()


n = int(input())
s = str(input())
a = s.count('SF')
b = s.count('FS')
if a > b:
	print('YES')
else:
	print('NO')


a = input()
l = input()
q = 0
w = 0
for i in range(len(l))[1:]:
	if l[i - 1] == 'S' and l[i] == 'F':
		q += 1
	if l[i - 1] == 'F' and l[i] == 'S':
		w += 1
print('YES' if q > w else 'NO')


import math

def main():
	n = int(input())
	place = input()
	last = place[0]
	SToF = 0
	FToS = 0
	for i in range(1, len(place)):
		if last == 'S' and place[i] == 'F':
			SToF += 1
		elif last == 'F' and place[i] == 'S':
			FToS += 1
		last = place[i]
	if SToF > FToS:
		print('YES')
	else:
		print('NO')
main()


def main():
	n = int(input())
	line = input()
	FS = 0
	SF = 0
	for i in range(n - 1):
		if line[i] != line[i + 1]:
			if line[i] == 'S':
				SF += 1
			else:
				FS += 1
	if SF > FS:
		return 'YES'
	else:
		return 'NO'
print(main())


n1 = int(input())
s = input()
n = []
for i in s:
	n.append(i)
(count, count1) = (0, 0)
for i in range(len(n) - 1):
	if n[i] == 'S' and n[i + 1] == 'F':
		count += 1
	elif n[i + 1] == 'S' and n[i] == 'F':
		count1 += 1
if count > count1:
	print('YES')
else:
	print('NO')


n = input()
n = int(n)
d = input()
counter = 1
gdeya = d[0]
vteplo = 0
vholod = 0
while counter < n:
	if d[counter] != gdeya:
		if gdeya == 'F':
			vholod = vholod + 1
		else:
			vteplo = vteplo + 1
	gdeya = d[counter]
	counter = counter + 1
if vteplo > vholod:
	print('YES')
else:
	print('NO')


input()
a = input()
if (a[0] == 'S' and a[-1] == 'F') and a[0] != a[-1]:
	print('\nYES')
else:
	print('\nNO')


input()
flights = input()
print('YES' if flights.count('SF') > flights.count('FS') else 'NO')


n = int(input())
s = input()
if s[0] == s[-1]:
	print('NO')
elif s[0] == 'S':
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
num1 = 0
num2 = 0
for i in range(n - 1):
	if s[i] != s[i + 1]:
		if s[i] == 'S':
			num1 += 1
		else:
			num2 += 1
if num1 > num2:
	print('YES')
else:
	print('NO')


input()
s = input()
(se, sf, l) = (0, 0, len(s))
for i in range(l - 1):
	if s[i] == 'S':
		if s[i + 1] == 'F':
			sf += 1
	elif s[i + 1] == 'S':
		se += 1
if sf > se:
	print('YES')
else:
	print('NO')


n = int(input())
m = str(input())
sum = 0
count = 0
for i in range(n - 1):
	if m[i] == 'S' and m[i + 1] == 'F':
		sum = sum + 1
for i in range(n - 1):
	if m[i] == 'F' and m[i + 1] == 'S':
		count += 1
if sum > count:
	print('yes')
else:
	print('no')


n = int(input())
g = input()
x = g.count('z')
(s, f) = (0, 0)
for i in range(1, n):
	if g[i] == 'S' and g[i - 1] == 'F':
		s += 1
	if g[i] == 'F' and g[i - 1] == 'S':
		f += 1
if f > s:
	print('YES')
else:
	print('NO')


N = int(input())
S = input()
prefer = 0
hate = 0
now = S[0]
for i in range(1, N):
	if now != S[i]:
		if now == 'S':
			prefer += 1
		else:
			hate += 1
		now = S[i]
if prefer > hate:
	print('YES')
else:
	print('NO')


import math
n = int(input())
sch = input()
if sch.count('SF') > sch.count('FS'):
	print('YES')
else:
	print('NO')


input()
s = 0
f = 0
txt = input()
p = txt[0]
for i in txt:
	if p != i:
		if i == 'S':
			f += 1
		else:
			s += 1
	p = i
if s > f:
	print('YES')
else:
	print('NO')


n = input()
s = input()
fs = 0
ff = 0
i = 0
while i < len(s):
	if s[i] == 'F':
		j = i + 1
		while j < len(s):
			if s[j] == 'S':
				ff += 1
				break
			else:
				j += 1
	elif s[i] == 'S':
		j = i + 1
		while j < len(s):
			if s[j] == 'F':
				fs += 1
				break
			else:
				j += 1
	i = j
if fs > ff:
	print('YES')
else:
	print('NO')


count = 0
days = input()
log = input()
incount = 0
outcount = 0
for i in range(len(log) - 1):
	matcher = log[i:i + 2]
	if matcher == 'SF':
		incount += 1
	elif matcher == 'FS':
		outcount += 1
if outcount >= incount:
	print('NO')
else:
	print('YES')


a = int(input())
d = input()
s1 = 0
s2 = 0
for q in range(a - 1):
	if d[q] == 'S' and d[q + 1] == 'F':
		s1 += 1
	if d[q] == 'F' and d[q + 1] == 'S':
		s2 += 1
if s1 > s2:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
if s[0] == 'S' and s[-1] == 'F':
	print('YES')
else:
	print('No')


days = int(input())
f = list(map(str, input()))
SF = 0
FS = 0
for i in range(days - 1):
	if f[i] == 'S' and f[i + 1] == 'F':
		SF += 1
	if f[i] == 'F' and f[i + 1] == 'S':
		FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
schedule = input()
if schedule.count('SF') > schedule.count('FS'):
	print('YES')
else:
	print('NO')


a = int(input())
s = input()
cf = s.count('SF')
cs = s.count('FS')
print('YNEOS'[cf <= cs::2])


m = int(input())
a = str(input())
l = list(a)
if l[0] == 'S' and l[m - 1] == 'F':
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
b = b.lower()
print('YES') if b[0] == 's' and b.count('sf') > b.count('fs') else print('NO')


n = int(input())
a = input()
s = a[0]
c = 0
t = 0
for i in range(1, n):
	if s == a[i]:
		pass
	elif a[i] == 'S':
		t += 1
		s = a[i]
	else:
		c += 1
		s = a[i]
if t >= c:
	print('NO')
else:
	print('YES')


n = int(input())
s = input()
(cnt1, cnt2) = (s.count('FS'), s.count('SF'))
print('YES' if cnt2 > cnt1 else 'NO')


aw = input()
wa = input()
if wa.count('SF') > wa.count('FS'):
	print('YES')
else:
	print('No')


(n, s) = (input(), input())
(fs, sf) = (sum([s[i] == 'F' and s[i + 1] == 'S' for i in range(len(s) - 1)]), sum([s[i] == 'S' and s[i + 1] == 'F' for i in range(len(s) - 1)]))
print(['NO', 'YES'][sf > fs])


input()
days = input()
m = {}
m['SF'] = 0
m['FS'] = 0
loc = days[0]
for d in days:
	if loc != d:
		m[loc + d] += 1
		loc = d
if m['SF'] > m['FS']:
	print('YES')
else:
	print('NO')


def fly1(string):
	SF = 0
	FS = 0
	current = None
	for letter in string:
		if current == None:
			current = letter
		if current != letter:
			if letter == 'F':
				SF += 1
			else:
				FS += 1
	return SF > FS

def fly(string):
	s = 0
	f = 0
	if string[0] == string[-1]:
		return False
	else:
		if string[0] == 'S' and string[-1] == 'F':
			return True
		return False
while True:
	try:
		input()
		case = input()
		if fly(case):
			print('YES')
		else:
			print('NO')
	except EOFError:
		break


def main():
	n = int(input())
	s = input()
	count1 = 0
	for i in range(n - 1):
		if s[i] == 'S' and s[i + 1] == 'F':
			count1 += 1
		elif s[i] == 'F' and s[i + 1] == 'S':
			count1 -= 1
	if count1 > 0:
		print('YES')
	else:
		print('NO')
main()


sf = int(input())
sf = fs = 0
s = input()
i = 0
while i < len(s) - 1:
	if s[i] == 'S' and s[i + 1] == 'F':
		sf += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		fs += 1
	i += 1
print(['NO', 'YES'][sf > fs])


n = int(input())
r = 0
stroka = input()
k = 0
for i in range(n - 1):
	if stroka[i] == 'S' and stroka[i + 1] == 'F':
		k += 1
	if stroka[i] != stroka[i + 1]:
		r += 1
if k > r / 2:
	print('YES')
else:
	print('NO')


class Solver:

	def main(self):
		_ = input()
		flights = input().strip()
		print(['No', 'Yes'][int(flights.count('SF') > flights.count('FS'))])
Solver().main()


input()
y = input()
print('YES' if y.count('SF') > y.count('FS') else 'NO')


no = input()
nos = input()
nos = list(nos)
no1 = 0
no2 = 0
for i in range(int(no) - 1):
	if nos[i] == 'S' and nos[i + 1] == 'F':
		no1 += 1
	elif nos[i] == 'F' and nos[i + 1] == 'S':
		no2 += 1
if no1 > no2:
	print('YES')
else:
	print('NO')


n = int(input())
L = str(input())
if L.count('SF') > L.count('FS'):
	print('Yes')
else:
	print('No')


(len, string) = (int(input()), input())
s = 0
f = 0
pre = None
for i in range(1, len):
	if string[i] != string[i - 1]:
		if string[i - 1] == 'S':
			f += 1
		else:
			s += 1
if f > s:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
A = 0
B = 0
for i in range(n - 1):
	if s[i:i + 2] == 'SF':
		A += 1
	elif s[i:i + 2] == 'FS':
		B += 1
if A > B:
	print('YES')
else:
	print('NO')


def input_func():
	days_num = int(input())
	stays = input()
	return (days_num, list(stays))

def check_func(days_num, list_stays):
	s_to_f = 0
	f_to_s = 0
	for i in range(days_num - 1):
		if list_stays[i] == 'S' and list_stays[i + 1] == 'F':
			s_to_f += 1
		elif list_stays[i] == 'F' and list_stays[i + 1] == 'S':
			f_to_s += 1
	if s_to_f > f_to_s:
		print('YES')
	else:
		print('NO')
(days_num, list_stays) = input_func()
check_func(days_num, list_stays)


k = int(input())
j = input()
y = 0
n = 0
for i in range(0, len(j) - 1):
	if j[i] == 'S' and j[i + 1] == 'F':
		y += 1
	elif j[i] == 'F' and j[i + 1] == 'S':
		n += 1
if y <= n:
	print('NO')
else:
	print('YES')


x = int(input())
y = input()
k = 0
j = 0
for i in range(x):
	if i == x - 1:
		break
	if y[i] == 'S' and y[i + 1] == 'F':
		k = k + 1
	if y[i] == 'F' and y[i + 1] == 'S':
		j = j + 1
if k > j:
	print('Yes')
else:
	print('No')


d = int(input())
v = input()
i = 0
vs = 0
vf = 0
while i < d - 1:
	if v[i] == 'F' and v[i + 1] == 'F':
		i = i + 1
	elif v[i] == 'S' and v[i + 1] == 'S':
		i = i + 1
	elif v[i] == 'S' and v[i + 1] == 'F':
		vs = vs + 1
		i = i + 1
	elif v[i] == 'F' and v[i + 1] == 'S':
		vf = vf + 1
		i = i + 1
if vf >= vs:
	print('NO')
else:
	print('YES')


n = int(input())
cities = input()
SF = 0
FS = 0
current_city = cities[0]
for city in cities[1:]:
	if current_city != city:
		if current_city == 'S':
			SF = SF + 1
		else:
			FS = FS + 1
	current_city = city
if SF > FS:
	print('YES')
else:
	print('NO')


R = lambda : [*map(int, input().split())]
n = R()
s = input()
S = s.count('FS')
F = s.count('SF')
if S < F:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
t = p = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		t += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		p += 1
if t > p:
	print('YES')
else:
	print('NO')


useless = input()
inp = input()
if inp.count('SF') > inp.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
p = input()
f = 0
s = 0
for i in range(0, n - 1):
	if p[i] != p[i + 1]:
		if p[i] == 'S':
			f += 1
		else:
			s += 1
if f > s:
	print('YES')
else:
	print('NO')


input()
istr = input()
if istr[0] == 'S' and istr[-1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
x = 0
y = 0
prev = s[0]
for curr in s[1:]:
	if prev == 'S' and curr == 'F':
		x += 1
	elif prev == 'F' and curr == 'S':
		y += 1
	prev = curr
if x > y:
	print('YES')
else:
	print('NO')


n = int(input())
str = input()
sf = 0
fs = 0
for i in range(n - 1):
	if str[i:i + 2] == 'FS':
		fs += 1
	if str[i:i + 2] == 'SF':
		sf += 1
print(sf > fs and 'YES' or 'NO')


s = 0
f = 0
i = 1
n = int(input())
d = input()
while i < n:
	td = d[i]
	pd = d[i - 1]
	if td == 'S' and pd == 'F':
		s = s + 1
	if td == 'F' and pd == 'S':
		f = f + 1
	i = i + 1
if s < f:
	print('YES')
else:
	print('NO')


N = int(input())
line = input()
print('YES') if line[0] == 'S' and line[-1] == 'F' else print('NO')


a = int(input())
b = input()
(c, d) = (0, 0)
for i in range(a):
	if i != a - 1:
		if 'S' in b[i] and 'F' in b[i + 1]:
			c -= -1
		elif 'F' in b[i] and 'S' in b[i + 1]:
			d -= -1
		elif 'SS' in b[i]:
			pass
		elif 'FF' in b[i]:
			pass
	elif i == a - 1:
		break
if c > d:
	print('YES')
elif c <= d:
	print('NO')


n = int(input())
s = list(str(input()))
fToS = 0
sToF = 0
for i in range(n - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		fToS += 1
	elif s[i] == 'S' and s[i + 1] == 'F':
		sToF += 1
if sToF > fToS:
	print('YES')
else:
	print('NO')


def solve(n):
	s = f = 0
	for i in range(len(n)):
		try:
			if n[i] == 'S' and n[i + 1] == 'F':
				s += 1
			elif n[i] == 'F' and n[i + 1] == 'S':
				f += 1
		except:
			if s > f:
				return 'YES'
			return 'NO'
input()
n = input()
print(solve(n))


n = input()
w = 0
d = input()
for i in range(len(d) - 1):
	if d[i] == 'S' and d[i + 1] != d[i]:
		w += 1
	elif d[i] == 'F' and d[i + 1] != d[i]:
		w -= 1
print(['NO', 'YES'][w > 0])


k = int(input())
mas = list(input())
i = 0
SF = 0
FS = 0
while i < k - 1:
	if mas[i] == 'S' and mas[i + 1] == 'F':
		SF += 1
	if mas[i] == 'F' and mas[i + 1] == 'S':
		FS += 1
	i += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input())
k = 0
p = 0
for i in range(len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		k += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		p += 1
if k > p:
	print('yes')
else:
	print('no')


n = int(input())
s = input().upper()
if s[0] == 'S' and s[-1] == 'F':
	print('Yes')
else:
	print('No')


def betweenOffices(n, places):
	StoF = 0
	FtoS = 0
	for i in range(n - 1):
		if places[i] == 'S' and places[i + 1] == 'F':
			StoF += 1
		if places[i] == 'F' and places[i + 1] == 'S':
			FtoS += 1
	if FtoS < StoF:
		return 'YES'
	return 'NO'
n = int(input())
places = input()
print(betweenOffices(n, places))


n = int(input())
s = input()
cnsf = 0
cnfs = 0
for i in range(len(s) - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		cnfs += 1
	elif s[i] == 'S' and s[i + 1] == 'F':
		cnsf += 1
if cnsf > cnfs:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
SF = 0
FS = 0
for i in range(n - 1):
	if string[i] != string[i + 1]:
		if string[i] == 'S' and string[i + 1] == 'F':
			SF += 1
		else:
			FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
k = list(input())
flag = 0
count = 0
for i in range(n - 1):
	if k[i] == k[i + 1]:
		continue
	elif k[i] != k[i + 1]:
		if k[i] == 'F':
			flag += 1
		else:
			count += 1
if count > flag:
	print('Yes')
else:
	print('No')


n = input()
n = int(n)
s = input()
flag1 = 0
flag2 = 0
for i in range(n - 1):
	if s[i] == 'S':
		if s[i] != s[i + 1]:
			flag1 += 1
	if s[i] == 'F':
		if s[i] != s[i + 1]:
			flag2 += 1
if flag1 > flag2:
	print('Yes')
else:
	print('No')


input()
mas = [i for i in input()]

def SF(mas):
	if len(mas) > 1:
		if mas[0] == 'S' and mas[1] == 'F':
			return 1 + SF(mas[1:])
		else:
			return SF(mas[1:])
	else:
		return 0

def FS(mas):
	if len(mas) > 1:
		if mas[0] == 'F' and mas[1] == 'S':
			return 1 + FS(mas[1:])
		else:
			return FS(mas[1:])
	else:
		return 0
print('Yes' if SF(mas) > FS(mas) else 'No')


input()
a = input().lower()
print('YES' if a.count('sf') > a.count('fs') else 'no')


n = int(input())
m = str(input())
a = list(m)
stof = 0
ftos = 0
for i in range(0, len(a) - 1):
	if a[i] == 'F' and a[i + 1] == 'S':
		ftos += 1
	elif a[i] == 'S' and a[i + 1] == 'F':
		stof += 1
if stof > ftos:
	print('YES')
else:
	print('NO')


input()
sche = input()
if sche.count('SF') > sche.count('FS'):
	print('YES')
else:
	print('NO')


N = int(input())
U = input()
S = 0
F = 0
for i in range(1, N):
	if U[i - 1] != U[i]:
		if U[i] == 'S':
			S += 1
		else:
			F += 1
if S < F:
	print('YES')
else:
	print('NO')


n = input()
lst = list(input())
frontier = lst[0]
fromSan = 0
fromSea = 0
for char in lst:
	if char != frontier:
		if frontier == 'F':
			fromSan += 1
		else:
			fromSea += 1
		frontier = char
print('YES' if fromSea > fromSan else 'NO')


n = int(input().split()[0])
ss = input()
(i, a, b) = (0, 0, 0)
while i + 1 < n:
	if ss[i] == 'F' and ss[i + 1] == 'S':
		a = a + 1
	elif ss[i] == 'S' and ss[i + 1] == 'F':
		b = b + 1
	i = i + 1
if a >= b:
	print('NO')
else:
	print('YES')


n = int(input())
f = input()
curr = f[0]
fs = 0
sf = 0
for i in range(1, n):
	if curr == 'F':
		if f[i] != curr:
			fs += 1
		curr = f[i]
	if curr == 'S':
		if f[i] != curr:
			sf += 1
		curr = f[i]
print('YES') if sf > fs else print('NO')


n = int(input())
s = input()
cs = 0
cns = 0
s = list(s)
if n == len(s):
	for (i, j) in zip(range(0, len(s) - 1), range(1, len(s))):
		if s[i] == 'S':
			if s[j] == 'F':
				cs += 1
			else:
				continue
		elif s[i] == 'F':
			if s[j] == 'S':
				cns += 1
			else:
				continue
if cs > cns:
	print('YES')
elif cns >= cs:
	print('NO')


n = int(input())
l = list(input())
f = 0
s = 0
i = 0
while i < n - 1:
	if l[i] == 'F':
		if l[i + 1] == 'S':
			f = f + 1
	if l[i] == 'S':
		if l[i + 1] == 'F':
			s = s + 1
	i = i + 1
if s > f:
	print('YES')
else:
	print('NO')


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
n = int(input())
s = str(input())
c1 = 0
c2 = 0
i = 0
while i < n:
	if s[i:i + 2] == 'SF':
		c1 += 1
	elif s[i:i + 2] == 'FS':
		c2 += 1
	i += 1
if c1 > c2:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
a = s.count('SF')
b = s.count('FS')
if a > b:
	print('yes')
else:
	print('no')


import sys

def solve():
	n = int(input())
	stri = input()
	SF = 0
	FS = 0
	for i in range(len(stri)):
		if stri[i:i + 2] == 'FS':
			FS += 1
		elif stri[i:i + 2] == 'SF':
			SF += 1
	if SF > FS:
		return 'YES'
	else:
		return 'NO'
ans = solve()
print(ans)


input()
s = list(input())
(c, d) = (0, 0)
for i in range(len(s) - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		c += 1
	elif s[i] == 'S' and s[i + 1] == 'F':
		d += 1
	else:
		continue
if d > c:
	print('YES')
else:
	print('NO')


x = int(input())
a = input()
StoF = 0
FtoS = 0
for i in range(x - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		StoF = StoF + 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		FtoS = FtoS + 1
if StoF > FtoS:
	print('YES')
else:
	print('NO')


read = lambda : map(int, input().split())
n = int(input())
f = input()
rt = 0
for i in range(n - 1):
	if f[i] == 'S' and f[i + 1] == 'F':
		rt += 1
	elif f[i] == 'F' and f[i + 1] == 'S':
		rt -= 1
if rt > 0:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(input())
u = len(l)
s = 0
v = 0
for i in range(u - 1):
	if l[i] == 'F':
		if l[i] != l[i + 1]:
			s = s + 1
	if l[i] == 'S':
		if l[i] != l[i + 1]:
			v = v + 1
if v > s:
	print('YES')
else:
	print('NO')


def solver(n, array):
	sf = 0
	fs = 0
	for idx in range(1, int(n)):
		transfer = array[idx - 1] + array[idx]
		if transfer == 'SF':
			sf += 1
		elif transfer == 'FS':
			fs += 1
	return 'YES' if sf > fs else 'NO'
n = input()
a = input()
print(solver(n, a))


def Offices(n, s):
	if s.count('SF') > s.count('FS'):
		return 'YES'
	else:
		return 'NO'
n = int(input())
s = input()
print(Offices(n, s))


x = int(input())
p = input()
sea = 0
fran = 0
for i in range(len(p) - 1):
	if p[i] != p[i + 1] and p[i + 1] == 'S':
		sea += 1
	if p[i] != p[i + 1] and p[i + 1] == 'F':
		fran += 1
if fran > sea:
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
(seasan, sansea) = (0, 0)
for i in range(len(st) - 1):
	if st[i] == 'F' and st[i + 1] == 'S':
		sansea += 1
	elif st[i] == 'S' and st[i + 1] == 'F':
		seasan += 1
if seasan > sansea:
	print('yes')
else:
	print('no')


N = int(input())
SAN_FRANCISCO = 'F'
SIETTLE = 'S'
towns = input()
s_to_f = 0
f_to_s = 0
for i in range(1, len(towns)):
	if towns[i - 1] == SIETTLE and towns[i] == SAN_FRANCISCO:
		s_to_f += 1
	elif towns[i - 1] == SAN_FRANCISCO and towns[i] == SIETTLE:
		f_to_s += 1
print('YES' if s_to_f > f_to_s else 'NO')


while 1:
	try:
		input()
		x = input()
	except:
		break
	re = 0
	to = 0
	for i in range(len(x) - 1):
		if x[i] == 'F' and x[i + 1] == 'S':
			re += 1
		elif x[i] == 'S' and x[i + 1] == 'F':
			to += 1
	if to > re:
		print('YES')
	else:
		print('NO')


Flights = input()
Location = input()
if Location[0] == 'S' and Location[-1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
(s, f) = (0, 0)
a = list(x)
for i in range(n - 1):
	if a[i] != a[i + 1] and a[i] == 'S':
		s += 1
	elif a[i] != a[i + 1] and a[i] == 'F':
		f += 1
if s > f:
	print('Yes')
else:
	print('No')


def office(s):
	cor = 0
	wor = 0
	i = 1
	while i < len(s):
		if s[i - 1] == 'S' and s[i] == 'F':
			cor += 1
		elif s[i - 1] == 'F' and s[i] == 'S':
			wor += 1
		i += 1
	if cor > wor:
		return 'YES'
	return 'NO'
n = int(input())
s = input()
print(office(s))


a = int(input())
S = input()
k = 0
k1 = 0
for i in range(len(S) - 1):
	if S[i] != S[i + 1] and S[i] == 'S':
		k += 1
	elif S[i] != S[i + 1] and S[i] == 'F':
		k1 += 1
if k > k1:
	print('YES')
else:
	print('NO')


input()
S = list(input())
FS = 0
SF = 0
SW = S[0]
for i in S:
	if i != SW:
		if SW == 'F':
			FS += 1
		else:
			SF += 1
		SW = i
if SF > FS:
	print('yes')
else:
	print('no')


n = int(input())
m = input()
fre = {'sf': 0, 'fs': 0}
for j in range(len(m) - 1):
	if m[j] == 'S' and m[j + 1] == 'F':
		fre['sf'] += 1
	if m[j] == 'F' and m[j + 1] == 'S':
		fre['fs'] += 1
if fre['sf'] > fre['fs']:
	print('YES')
else:
	print('NO')


import sys, math
n = int(input())
a = list(input())
q = 0
w = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		q = q + 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		w = w + 1
if q > w:
	print('YES')
else:
	print('NO')


n = int(input())
word = input()
if word.count('SF') > word.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
print('YES') if s.count('SF') - s.count('FS') > 0 else print('NO')


n = int(input())
city = input()
s2f = 0
f2s = 0
for i in range(n - 1):
	if city[i] == 'S' and city[i + 1] == 'F':
		s2f += 1
	elif city[i] == 'F' and city[i + 1] == 'S':
		f2s += 1
print('YES' if s2f > f2s else 'NO')


n = int(input())
a = list(map(str, input().split()))
c = 0
d = 0
for i in range(n - 1):
	if a[0][i] == 'S' and a[0][i + 1] == 'F':
		c += 1
	if a[0][i] == 'F' and a[0][i + 1] == 'S':
		d += 1
if c > d:
	print('YES')
else:
	print('NO')


_ = input()
nights = input()
ans = 'YES' if nights[0] == 'S' and nights[-1] == 'F' else 'NO'
print(ans)


n = int(input())
places = input()
it = iter(places)
prev_city = next(it)
(sf, fs) = (0, 0)
for city in it:
	if prev_city != city:
		if city == 'F':
			sf += 1
		else:
			fs += 1
	prev_city = city
if sf > fs:
	print('YES')
else:
	print('NO')


import sys
n = int(sys.stdin.readline())
n_string = sys.stdin.readline()

def offices(n, n_string):
	s_to_f = 0
	f_to_s = 0
	for i in range(len(n_string) - 1):
		if n_string[i] == 'S' and n_string[i + 1] == 'F':
			s_to_f += 1
		elif n_string[i] == 'F' and n_string[i + 1] == 'S':
			f_to_s += 1
	if s_to_f > f_to_s:
		print('YES')
	else:
		print('NO')
offices(n, n_string)


def fr(r, s):
	return s[:s.find(r)] + s[s.find(r) + len(r):]

def f(r, s):
	a = 0
	while r in s:
		(s, a) = (fr(r, s), a + 1)
	return a
(n, s) = (int(input()), input())
print('YES' if f('SF', s) > f('FS', s) else 'NO')


n = int(input())
s = input()
StoFcount = 0
FtoScount = 0
for i in range(1, n):
	if s[i - 1] == 'F' and s[i] == 'S':
		FtoScount += 1
	elif s[i - 1] == 'S' and s[i] == 'F':
		StoFcount += 1
if StoFcount > FtoScount:
	print('YES')
else:
	print('NO')


def answer():
	n = int(input())
	a = input()
	i = 0
	happy = 0
	curr = a[0]
	while i < len(a):
		if i < len(a) - 1 and a[i] == 'S' and (a[i + 1] == 'F') and (curr == 'S'):
			happy += 1
			curr = 'F'
			i += 1
		elif i < len(a) - 1 and a[i] == 'F' and (a[i + 1] == 'S') and (curr == 'F'):
			happy -= 1
			curr = 'S'
			i += 1
		else:
			i += 1
	if happy > 0:
		print('YES')
	else:
		print('NO')
answer()


n = int(input())
s = input()
last = ''
sf = 0
fs = 0
for c in s:
	if last + c == 'FS':
		fs += 1
	elif last + c == 'SF':
		sf += 1
	last = c
if sf > fs:
	print('YES')
else:
	print('NO')


import sys
import math
import bisect

def main():
	ns = 0
	nf = 0
	n = int(input())
	s = input()
	for i in range(n):
		if i:
			if s[i - 1] == 'S' and s[i] == 'F':
				nf += 1
			if s[i - 1] == 'F' and s[i] == 'S':
				ns += 1
	if nf > ns:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = input()
si = 0
fr = 0
last_day = a[0]
for i in range(n):
	if last_day + a[i] == 'SF':
		fr += 1
	elif last_day + a[i] == 'FS':
		si += 1
	last_day = a[i]
if fr > si:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
inS = 0
inF = 0
for i in range(n - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		inF += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		inS += 1
if inF > inS:
	print('YES')
else:
	print('NO')


def main():
	N = int(input())
	S = input()
	s = S.count('SF')
	f = S.count('FS')
	if s > f:
		print('YES')
	else:
		print('NO')
main()


a = int(input())
b = input()
cnt = 0
d = 0
for i in range(a - 1):
	if b[i] == 'S' and b[i + 1] == 'F':
		cnt += 1
	elif b[i] == 'F' and b[i + 1] == 'S':
		d += 1
if cnt > d:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
x = []
duo = []
for i in s:
	x.append(i)
for i in range(0, n - 1):
	duo.append(x[i] + x[i + 1])
SF = duo.count('SF')
FS = duo.count('FS')
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
place = input()
sf = 0
fs = 0
for i in range(0, n - 1):
	if place[i] == 'S':
		if place[i + 1] == 'F':
			sf += 1
		else:
			pass
	elif place[i + 1] == 'S':
		fs += 1
	else:
		pass
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sf = 0
fs = 0
t = range(n)[:-1]
for k in t:
	if s[k:k + 2] == 'SF':
		sf += 1
	elif s[k:k + 2] == 'FS':
		fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
s = 0
s2 = 0
for i in range(n - 1):
	if a[i:i + 2] == 'SF':
		s = s + 1
	if a[i:i + 2] == 'FS':
		s2 = s2 + 1
if s > s2:
	print('YES')
else:
	print('NO')


_ = input()
s = input()
print('YES' if s.count('SF') > s.count('FS') else 'NO')


import sys
b = sys.stdin.readline()
a = int(b)
line = sys.stdin.readline()
c = line[0]
m = 0
for i in range(1, a):
	if line[i] != line[i - 1]:
		m = m + 1
m = m % 2
if c == 'S' and m == 1:
	print('YES')
else:
	print('NO')


import re
input()
print('YES' if re.match('^S.*F$', input()) else 'NO')


input()
s = input()
p = s[0]
a = 0
b = 0
for i in s:
	if i != p:
		if i == 'F':
			a += 1
		else:
			b += 1
	p = i
if a > b:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
first = 0
second = 0
for i in range(1, n):
	if s[i] == 'S' and s[i - 1] == 'F':
		second += 1
	elif s[i] == 'F' and s[i - 1] == 'S':
		first += 1
if first > second:
	print('YES')
else:
	print('NO')


n = int(input())
flights = input()
stsf = 0
sfts = 0
for i in range(len(flights)):
	if i > 0:
		if flights[i] == 'F' and flights[i - 1] == 'S':
			stsf += 1
		elif flights[i] == 'S' and flights[i - 1] == 'F':
			sfts += 1
if stsf > sfts:
	print('YES')
else:
	print('NO')


n = int(input())
chars = input()
prev = chars[0]
s = 0
f = 0
for i in range(1, len(chars)):
	if prev == 'S' and chars[i] == 'F':
		s += 1
	if prev == 'F' and chars[i] == 'S':
		f += 1
	prev = chars[i]
if s > f:
	print('YES')
else:
	print('NO')


total_days = int(input())
days = input()
previous_day = days[0]
flight_counts = {'S': 0, 'F': 0}
for i in range(1, total_days):
	if days[i] is not previous_day:
		flight_counts[days[i]] = flight_counts[days[i]] + 1
		previous_day = days[i]
if flight_counts['F'] > flight_counts['S']:
	print('YES')
else:
	print('NO')


n = int(input())
st = input()
pre = '0'
sc = 0
fc = 0
for i in st:
	if i == 'S' and pre == 'F':
		fc += 1
	elif i == 'F' and pre == 'S':
		sc += 1
	pre = i
if sc > fc:
	print('YES')
else:
	print('NO')


N = int(input())
S = input().strip()
S_counter = 0
F_counter = 0
for i in range(N - 1):
	if S[i] != S[i + 1]:
		if S[i] == 'F':
			S_counter += 1
		else:
			F_counter += 1
if S_counter >= F_counter:
	print('NO')
else:
	print('YES')


n = int(input())
places = input()
count = 0
for index in range(n - 1):
	if places[index] == 'F' and places[index + 1] == 'F' or (places[index] == 'S' and places[index + 1] == 'S'):
		continue
	count = count + 1 if places[index] == 'S' and places[index + 1] == 'F' else count - 1
print('NO' if count <= 0 else 'YES')


n = int(input())
city = input()
sfs = 0
seattle = 0
for i in range(1, n):
	if city[i] == 'F' and city[i - 1] == 'S':
		sfs += 1
	elif city[i] == 'S' and city[i - 1] == 'F':
		seattle += 1
if sfs > seattle:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(input())
cf = 0
cs = 0
for i in range(1, n):
	if s[i] == 'F' and s[i - 1] == 'S':
		cf += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		cs += 1
if cf > cs:
	print('Yes')
else:
	print('No')


_ = input()
schedule = input()
Francisco_to_Seattle = schedule.count('FS')
Seattle_to_Francisco = schedule.count('SF')
if Seattle_to_Francisco > Francisco_to_Seattle:
	print('YES')
else:
	print('NO')


n = int(input())
flights = input().upper()
f = 0
s = 0
for i in range(n - 1):
	if flights[i] == 'S' and flights[i + 1] == 'F':
		f += 1
	if flights[i] == 'F' and flights[i + 1] == 'S':
		s += 1
if f > s:
	print('YES')
else:
	print('NO')


z = int(input())
y = str(input())
sea = 0
fra = 0
for i in range(z):
	if i + 1 <= z - 1:
		if y[i] == 'S':
			if y[i + 1] == 'F':
				sea += 1
		elif y[i] == 'F':
			if y[i + 1] == 'S':
				fra += 1
if sea > fra:
	print('YES')
else:
	print('NO')


n = int(input())
string = input().lower()
(sf, fs) = (0, 0)
for i in range(n - 1):
	if string[i] + string[i + 1] == 'fs':
		fs += 1
	elif string[i] + string[i + 1] == 'sf':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
kf = 0
ks = 0
temp = s[0]
for i in range(1, len(s)):
	if temp != s[i] and s[i] == 'F':
		temp = s[i]
		kf += 1
	elif temp != s[i] and s[i] == 'S':
		temp = s[i]
		ks += 1
if kf > ks:
	print('YES')
else:
	print('NO')


n = input('')
travels = str(input(''))
s2f = 0
f2s = 0
for i in range(len(travels) - 1):
	if travels[i] == 'S' and travels[i + 1] == 'F':
		s2f += 1
	elif travels[i] == 'F' and travels[i + 1] == 'S':
		f2s += 1
	else:
		continue
if s2f > f2s:
	print('YES')
else:
	print('NO')


n = int(input())
days = str(input())
if len(days) != n:
	print('error')
s = 0
f = 0
days = days.upper()
for i in range(0, n - 1):
	if days[i] == 'F' and days[i + 1] == 'S':
		f = f + 1
	if days[i] == 'S' and days[i + 1] == 'F':
		s = s + 1
if s > f:
	print('YES')
else:
	print('NO')


aaaaaaaaaaaaa = int(input())
a = input()
g = 0
for i in range(1, len(a)):
	if a[i] == 'S' and a[i - 1] == 'F':
		g -= 1
	if a[i] == 'F' and a[i - 1] == 'S':
		g += 1
if g > 0:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(str, input()))
ll = []
for i in range(len(l) - 1):
	ll.append([l[i], l[i + 1]])
if ll.count(['S', 'F']) > ll.count(['F', 'S']):
	print('YES')
else:
	print('NO')


input()
string = input()
print('YES' if string.count('SF') > string.count('FS') else 'NO')


length = input()
temp = input()
if temp[0] == 'S' and temp[-1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
prev = string[0]
StoF = 0
FtoS = 0
for i in range(1, len(string)):
	if string[i] != prev:
		if prev == 'S':
			StoF += 1
		else:
			FtoS += 1
	prev = string[i]
if StoF > FtoS:
	print('YES')
else:
	print('NO')


x = int(input())
y = input()
l = k = 0
for n in range(len(y) - 1):
	if y[n] == 'F' and y[n + 1] == 'S':
		l += 1
	elif y[n] == 'S' and y[n + 1] == 'F':
		k += 1
if k > l:
	print('YES')
else:
	print('NO')


n = int(input())
r = input()
i = 0
sf = 0
fs = 0
while i < len(r) - 1:
	if r[i] == 'S' and r[i + 1] == 'F':
		sf += 1
	elif r[i] == 'F' and r[i + 1] == 'S':
		fs += 1
	i += 1
print('YES' if sf > fs else 'NO')


a = int(input())
b = input()
cptS = cptF = 0
for i in range(1, a):
	if b[i] != b[i - 1]:
		if b[i] == 'S':
			cptS += 1
		else:
			cptF += 1
print(['YES', 'NO'][cptS >= cptF])


n = int(input())
string = list(map(str, input()))[:n]
f_s = 0
s_f = 0
for i in range(0, n - 1):
	if string[i] == 'F' and string[i + 1] == 'S':
		f_s += 1
	elif string[i] == 'S' and string[i + 1] == 'F':
		s_f += 1
if s_f > f_s:
	print('YES')
else:
	print('NO')


s = int(input())
a = input()
k1 = 0
k2 = 0
for i in range(s - 1):
	if a[i] == 'F' and a[i + 1] == 'S':
		k1 += 1
	elif a[i] == 'S' and a[i + 1] == 'F':
		k2 += 1
if k2 > k1:
	print('YES')
else:
	print('NO')


num = int(input())
n = input()
Sfly = 0
Ffly = 0
for i in range(0, len(n) - 1):
	if n[i] == 'S':
		if n[i] != n[i + 1]:
			Sfly += 1
	elif n[i] != n[i + 1]:
		Ffly += 1
if Sfly > Ffly:
	print('YES')
else:
	print('NO')


n = int(input())
stat = list(input())
flag = stat[0]
f = s = 0
for i in stat[1:]:
	if i != flag and i == 'F':
		f += 1
		flag = 'F'
	elif i != flag and i == 'S':
		s += 1
		flag = 'S'
print('YES' if f > s else 'NO')


n = int(input())
counter = 0
m = str(input())
for i in range(0, n - 1):
	if m[i] == 'S' and m[i + 1] == 'F':
		counter += 1
	if m[i] == 'F' and m[i + 1] == 'S':
		counter -= 1
if counter > 0:
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
a1 = b.count('SF')
a2 = b.count('FS')
if a1 > a2:
	print('YES')
else:
	print('NO')


n = int(input())
cities = [char for char in input()]
if cities[0] == 'S' and cities[-1] == 'F':
	print('YES')
else:
	print('NO')


x = int(input())
li = list(input())
current_stay = li[0]
f_to_s = 0
s_to_f = 0
for i in range(1, len(li)):
	if current_stay == 'F' and li[i] == 'S':
		f_to_s += 1
	elif current_stay == 'S' and li[i] == 'F':
		s_to_f += 1
	current_stay = li[i]
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
f = 0
s = 0
for i in range(n - 1):
	if a[i] != a[i + 1]:
		if a[i + 1] == 'F':
			f += 1
		else:
			s += 1
if f > s:
	print('Yes')
else:
	print('No')


q = int(input())
inp = input()
c = 0
for i in range(1, q):
	if inp[i] != inp[i - 1]:
		if inp[i] == 'F':
			c += 1
		else:
			c -= 1
if c > 0:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	s = input()
	flights = {'SF': 0, 'FS': 0}
	for i in range(1, n):
		if s[i] != s[i - 1]:
			direction = s[i - 1:i + 1]
			flights[direction] += 1
	print('YES' if flights['SF'] > flights['FS'] else 'NO')
main()


n = int(input())
l = list(input())
(a, b) = (0, 0)
for i in range(len(l) - 1):
	if l[i] == 'S' and l[i + 1] == 'F':
		a += 1
	elif l[i] == 'F' and l[i + 1] == 'S':
		b += 1
print('YES' if a > b else 'NO')


def solve():
	n_days = input()
	cities = input()
	last_city = cities[0]
	out = 0
	for city in cities[1:]:
		if city != last_city:
			if city == 'F':
				out += 1
			else:
				out -= 1
		last_city = city
	if out > 0:
		print('YES')
	else:
		print('NO')
while True:
	try:
		solve()
	except:
		break


input()
of = input()
l = of[0]
sf = 0
fs = 0
for i in of[1:]:
	if i == l:
		continue
	if l == 'S':
		sf += 1
	else:
		fs += 1
	l = i
if sf > fs:
	print('YES')
else:
	print('NO')


str_len = int(input())
string = input()
sf = 0
fs = 0
for (i, s) in enumerate(string):
	if i < len(string) - 1:
		if s == 'S' and string[i + 1] == 'F':
			sf += 1
		elif s == 'F' and string[i + 1] == 'S':
			fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sf = s.replace('SF', '1')
fs = s.replace('FS', '0')
if sf.count('1') > fs.count('0'):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input())
(ans_f, ans_s) = (0, 0)
for i in range(n - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		ans_s += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		ans_f += 1
if ans_s > ans_f:
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
a1 = x.count('SF')
a2 = x.count('FS')
if a1 > a2:
	print('YES')
else:
	print('NO')


a = int(input())
b = list(input())
count1 = 0
count2 = 0
for i in range(a - 1):
	if b[i] == 'S' and b[i + 1] == 'F':
		count1 = count1 + 1
	if b[i] == 'F' and b[i + 1] == 'S':
		count2 = count2 + 1
if count2 < count1:
	print('YES')
else:
	print('NO')


n = int(input())
position = input()
print('YES' if position.count('SF') > position.count('FS') else 'NO')


i = int(input())
t = str(input())
j = 0
fs = 0
sf = 0
while j < i - 1:
	a = t[j]
	b = t[j + 1]
	txt = '' + a + b
	if txt == 'FS':
		fs += 1
		j += 1
	elif txt == 'SF':
		sf += 1
		j += 1
	else:
		j += 1
if sf > fs:
	print('YES')
else:
	print('NO')


_ = input()
n = input()
n1 = 0
n2 = 0
j = n[0]
for i in n[1:]:
	if i == 'S' != j:
		n2 += 1
	elif i == 'F' != j:
		n1 += 1
	j = i
if n1 > n2:
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
sanf = 0
seat = 0
for i in range(1, n):
	prev = x[i - 1]
	now = x[i]
	if (prev == 'F') & (now == 'S'):
		seat += 1
	if (prev == 'S') & (now == 'F'):
		sanf += 1
print('YES' if sanf > seat else 'NO')


n = eval(input())
t = input()
i = 0
c = 0
w = 0
while i < n - 1:
	if t[i] == 'F' and t[i + 1] == 'S':
		c += 1
	if t[i] == 'S' and t[i + 1] == 'F':
		w += 1
	i += 1
if c >= w:
	print('No')
else:
	print('Yes')


n = int(input())
a = input()
s = 0
f = 0
for i in range(n - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		s += 1
for j in range(n - 1):
	if a[j] == 'F' and a[j + 1] == 'S':
		f += 1
if s > f:
	print('YES')
else:
	print('NO')


x = int(input())
s = input()
c = 0
f = {}
a = []
f['sf'] = 0
f['fs'] = 0
for i in range(x - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		f['sf'] += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		f['fs'] += 1
if f['sf'] > f['fs']:
	print('yes')
else:
	print('no')


n = int(input())
string = input()
s = string.count('SF')
f = string.count('FS')
r = 'YES' if s > f else 'NO'
print(r)


n = int(input())
s = input()
s = list(s)
c = 0
b = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		c += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		b += 1
if c > b:
	print('yes')
else:
	print('no')


import re
x = int(input())
y = input()
c = re.findall('SF', y)
d = re.findall('FS', y)
if len(c) <= len(d):
	print('NO')
else:
	print('YES')


a = int(input())
b = input()
sf = 0
g = 0
fs = 0
for i in b:
	if i == 'S' and g == 'F':
		fs += 1
	elif i == 'F' and g == 'S':
		sf += 1
	g = i
if sf > fs:
	print('YES')
else:
	print('NO')


t = int(input())
s = input()
s = list(s)
c = k = 0
for i in range(0, len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		c = c + 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		k = k + 1
if c > k:
	print('YES')
else:
	print('NO')


day = int(input())
stat = input()
if len(stat) > day:
	print('Wrong input')
elif stat.count('SF') > stat.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
c = 0
d = 0
for i in range(0, n - 1):
	if x[i] == 'S' and x[i + 1] == 'F':
		c = c + 1
	elif x[i] == 'F' and x[i + 1] == 'S':
		d = d + 1
	else:
		i = i + 1
if c > d:
	print('Yes')
else:
	print('No')


data = input()
data = int(data)
line = input()
if line.count('SF') > line.count('FS'):
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	s = S()
	stof = 0
	ftos = 0
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			if s[i] == 'S':
				stof += 1
			else:
				ftos += 1
	if stof > ftos:
		return 'YES'
	return 'NO'
print(main())


n = map(int, input())
s = input()
f = s
s = s.split('SF')
f = f.split('FS')
if len(s) > len(f):
	print('YES')
else:
	print('NO')


m = int(input())
n = list(input())
a = []
b = []
for i in range(m - 1):
	if n[i] + n[i + 1] == 'SF':
		a.append('ab')
	elif n[i] + n[i + 1] == 'FS':
		b.append('cd')
if len(a) > len(b):
	print('Yes')
else:
	print('No')


a = int(input())
b = input()
sf = 0
fs = 0
i = 1
for i in range(1, a):
	if b[i - 1] != b[i]:
		if b[i - 1] == 'S':
			sf += 1
		else:
			fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
p = s.count('SF')
q = s.count('FS')
if p > q:
	print('YES')
else:
	print('NO')


n = int(input())
f = str(input())
S2F = 0
F2S = 0
for i in range(n - 1):
	tmp = f[i:i + 2]
	if tmp == 'SF':
		S2F += 1
	if tmp == 'FS':
		F2S += 1
if S2F > F2S:
	print('YES')
else:
	print('NO')


days = int(input())
string = input()
last = ''
(sf, fs) = (0, 0)
for x in string:
	if last == 'S' and x == 'F':
		sf += 1
	elif last == 'F' and x == 'S':
		fs += 1
	last = x
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
y = input()
h = y.count('FS')
k = y.count('SF')
if k > h:
	print('YES')
else:
	print('NO')


n = int(input())
city = str(input())
if city[0] == 'S' and city[len(city) - 1] == 'F':
	print('YES')
else:
	print('NO')


N = int(input())
s = input()
cnt = 0
for i in range(N - 1):
	if s[i:i + 2] == 'FS':
		cnt -= 1
	elif s[i:i + 2] == 'SF':
		cnt += 1
if cnt > 0:
	print('YES')
else:
	print('NO')


n = int(input())
line = input()
count_s = 0
count_f = 0
current = line[0]
for c in range(1, len(line)):
	if line[c] == current:
		current = current
	elif current is 'S':
		count_s += 1
		current = line[c]
	else:
		count_f += 1
		current = line[c]
if count_s > count_f:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	x = [i for i in input()]
	result = 0
	for i in range(1, n):
		if x[i - 1] == 'S' and x[i] == 'F':
			result += 1
		if x[i - 1] == 'F' and x[i] == 'S':
			result -= 1
	if result > 0:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
st = input()
count = 0
count2 = 0
for i in range(len(st) - 1):
	if st[i] != st[i + 1] and st[i] == 'S':
		count += 1
	elif st[i] != st[i + 1] and st[i] == 'F':
		count2 += 1
	else:
		pass
if count > count2:
	print('YES')
else:
	print('NO')


x = int(input())
y = input()
z = []
for c in range(x):
	z.append(y[c])
count = 0
for c in range(1, x):
	if z[c - 1] + z[c] == 'SF':
		count = count + 1
	if z[c - 1] + z[c] == 'FS':
		count = count - 1
if count > 0:
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
s = ''
for i in range(1, len(x)):
	if x[i] != x[i - 1]:
		s += x[i]
if s.count('F') > s.count('S'):
	print('YES')
else:
	print('NO')


num = int(input())
list = []
list = input()
str = []
for n in range(0, num):
	str.append(list[n])
if num == 1:
	print('no')
else:
	count = 0
	for m in range(0, num - 1):
		if str[m] == 'F':
			if str[m + 1] == 'S':
				count = count - 1
		elif str[m + 1] == 'F':
			count = count + 1
	if count > 0:
		print('yes')
	else:
		print('no')


n = int(input())
cities = input()
cities = list(cities)
count = 0
var = 0
i = 1
while i <= len(cities) - 1:
	if cities[i] == 'F' and cities[i - 1] == 'S':
		count += 1
	if cities[i] == 'S' and cities[i - 1] == 'F':
		var += 1
	i += 1
if count > var:
	print('YES')
else:
	print('NO')


N = int(input())
s = input()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


import sys
_ = sys.stdin.readline()
s = sys.stdin.readline()

def comparator(x, y):
	if x == 'F' and y == 'S':
		return -1
	elif x == 'S' and y == 'F':
		return 1
	else:
		return 0
print('YES' if sum(map(lambda t: comparator(t[0], t[1]), zip(s, s[1:]))) > 0 else 'NO')


num = input()
cities = input()
if cities[0] == 'F':
	print('NO')
else:
	swaps = 0
	for (c1, c2) in zip(cities[:-1], cities[1:]):
		if c1 != c2:
			swaps += 1
	if swaps % 2:
		print('YES')
	else:
		print('NO')


def toSF(previous, current):
	return previous == 'S' and current == 'F'
days = int(input())
locations = input()
prev = ''
count = 0
for location in locations:
	if prev == '':
		prev = location
		continue
	if prev != location:
		if toSF(prev, location):
			count += 1
		else:
			count -= 1
		prev = location
if count > 0:
	print('YES')
else:
	print('NO')


t = int(input())
cS = 0
cF = 0
city = input()
for i in range(1, t):
	if city[i - 1] == 'F' and city[i] == 'S':
		cF += 1
	elif city[i - 1] == 'F' and city[i] == 'F':
		continue
	elif city[i - 1] == 'S' and city[i] == 'S':
		continue
	else:
		cS += 1
if cS > cF:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
count1 = 0
count2 = 0
for i in range(len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		count1 += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		count2 += 1
if count1 > count2:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
num = 0
(F, S) = (0, 0)
pre = s[0]
for i in range(n):
	if s[i] != pre:
		if s[i] == 'S':
			F += 1
			pre = 'S'
		else:
			S += 1
			pre = 'F'
if F < S:
	print('YES')
else:
	print('NO')


length = int(input())
string1 = input()
if string1[0] == 'F':
	print('No')
elif string1[0] == 'S' and string1[length - 1] == 'S':
	print('No')
else:
	print('Yes')


t = int(input())
n = input()
if 'SF' not in n:
	print('NO')
elif n.count('SF') > n.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
sf = 0
fs = 0
for (i, x) in enumerate(s):
	if i != len(s) - 1:
		if x == 'S' and s[i + 1] == 'F':
			sf += 1
		if x == 'F' and s[i + 1] == 'S':
			fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


input()
x = input()
y = x[0]
si = 0
san = 0
for i in x:
	if i != y:
		y = i
		if i == 'F':
			san += 1
		else:
			si += 1
if san > si:
	print('YES')
else:
	print('NO')


from sys import stdin
number = stdin.readline()
liste = list(stdin.readline().strip())
f = 0
s = 0
for i in range(len(liste) - 1):
	if liste[i] != liste[i + 1]:
		if liste[i] == 'F':
			f += 1
		else:
			s += 1
if s > f:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
s = []
for i in a:
	s.append(i)
(c, c1) = (0, 0)
for i in range(len(s)):
	if i + 1 == len(s):
		break
	if s[i] == 'S' and s[i + 1] == 'F':
		c += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		c1 += 1
if c > c1:
	print('YES')
else:
	print('NO')


import re
input()
sls = input().rstrip()
x = re.findall('SF', sls)
y = re.findall('FS', sls)
if len(x) > len(y):
	print('YES')
else:
	print('NO')


import math
import os
import random
import re
import sys
m = int(input())
s = str(input())
a = s.count('SF')
b = s.count('FS')
if a > b:
	print('YES')
else:
	print('NO')


n = int(input())
SF = str(input())
SF_start = str(SF[0])
i = SF_start
for i in range(0, n):
	if SF[i] == SF_start:
		continue
	else:
		SF_start = SF[i]
if SF_start != SF[0] and SF[0] == 'S':
	print('YES')
else:
	print('NO')


x = input()
string = input()
a = 0
b = 0
for i in range(len(string) - 1):
	if string[i] is 'F' and string[i + 1] is 'S':
		a += 1
	elif string[i] is 'S' and string[i + 1] is 'F':
		b += 1
if b > a:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
if a[0] + a[-1] == 'SF':
	exit(print('YES'))
print('NO')


n = int(input())
a = input()
(c1, c2) = (0, 0)
for i in range(1, n):
	if a[i] == a[i - 1]:
		continue
	elif a[i - 1] == 'F' and a[i] == 'S':
		c2 += 1
	else:
		c1 += 1
if c1 > c2:
	print('YES')
else:
	print('NO')


a = int(input())
b = str(input())
k = 0
f = 0
i = 0
for i in range(0, a - 1):
	if b[i] != b[i + 1] and b[i] == 'S':
		k = k + 1
	if b[i] != b[i + 1] and b[i] == 'F':
		f = f + 1
if k > f:
	print('YES')
else:
	print('NO')


b = int(input())
a = list(str([i for i in input().split()]))
x = 0
y = 0
for i in range(0, len(a) - 1):
	if a[i] == 'F' and a[i + 1] == 'S':
		x += 1
	if a[i] == 'S' and a[i + 1] == 'F':
		y += 1
if x < y:
	print('YES')
else:
	print('NO')


a = int(input())
string = list(input())
(s, f) = (0, 0)
for i in range(1, a):
	if string[i - 1] == 'F' and string[i] == 'S':
		s += 1
	elif not string[i - 1] == 'F' and string[i] == 'F':
		f += 1
if f > s:
	print('YES')
else:
	print('NO')


t = int(input())
cities = input()
my_list = []
fs = 0
sf = 0
for char in cities:
	my_list.append(char)
for i in range(t - 1):
	if my_list[i + 1] == 'S' and my_list[i] == 'F':
		fs += 1
	if my_list[i + 1] == 'F' and my_list[i] == 'S':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


a = int(input())
b = list(input())
s = 0
f = 0
for i in range(1, a):
	if b[i] != b[i - 1] and b[i] == 'F':
		f += 1
	elif b[i] != b[i - 1] and b[i] == 'S':
		s += 1
if f <= s or (f == 0 and s == 0):
	print('NO')
else:
	print('YES')


n = int(input())
s = list(input())
si = 0
fr = 0
for i in range(1, n):
	if s[i] != s[i - 1]:
		if s[i] == 'S':
			fr += 1
		else:
			si += 1
if si > fr:
	print('YES')
else:
	print('NO')


n = input()
letters = input()
current = letters[0]
s_to_f = 0
f_to_s = 0
for char in letters:
	if not char == current:
		if current == 'S':
			s_to_f += 1
		else:
			f_to_s += 1
		current = char
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


n = input()
city = input()
if city.count('SF') > city.count('FS'):
	print('Yes')
else:
	print('No')


(sf, st) = (0, 0)
n = int(input())
s = input()
c = s[0]
for i in s[1:]:
	if c != i:
		if i == 'S':
			st += 1
		else:
			sf += 1
	c = i
if sf > st:
	print('YES')
else:
	print('NO')


x = int(input())
y = input()
f = list(y)
li1 = []
li2 = []

def g(c):
	if c == 'F':
		c = 1
	else:
		c = 0
	return c
F = list(map(g, f))
z = 0
for i in range(x - 1):
	if F[z] - F[z + 1] == 0:
		z += 1
	elif F[z] - F[z + 1] == 1:
		li1.append(z)
		z += 1
	else:
		li2.append(z)
		z += 1
if len(li1) < len(li2):
	print('YES')
else:
	print('NO')


n = int(input())
s = input().strip()
if s[0] == 'S' and s[-1] == 'F':
	print('YES')
else:
	print('NO')


class Main:
	n = int(input())
	places = input()
	sf = places.count('SF')
	fs = places.count('FS')
	print('YES') if sf > fs else print('NO')
Main()


import sys
sys.stdin.readline().strip()
s = sys.stdin.readline().strip()
print('YES' if s.count('SF') > s.count('FS') else 'NO')


n = input()
a = str(input())
f = 0
s = 0
t = 1
while t < len(a):
	if a[t] != a[t - 1]:
		if a[t] == 'S':
			s += 1
		else:
			f += 1
	t += 1
if f <= s:
	print('NO')
else:
	print('YES')


n = int(input())
c = str(input())
if len(c) != n:
	print('it must be equal')
elif c[0] == 'S' and c[-1] == 'F':
	print('YES')
else:
	print('NO')


(t, n, w) = (int(input()), input(), 0)
for i in range(0, len(n)):
	if i != len(n) - 1:
		if n[i] + n[i + 1] == 'SF':
			w += 1
		elif n[i] + n[i + 1] == 'FS':
			w -= 1
if w > 0:
	print('YES')
else:
	print('NO')


N = int(input())
C = [c for c in input()]
last = C[0]
(S, F) = (0, 0)
for i in range(1, N):
	if C[i] != last:
		if last == 'S':
			S += 1
		elif last == 'F':
			F += 1
		last = C[i]
if S > F:
	print('YES')
else:
	print('NO')


n = int(input())
fly_di = list(input())
fly_di1 = ''.join(fly_di)
a = fly_di1.count('SF')
b = fly_di1.count('FS')
if a > b:
	print('YES')
else:
	print('NO')


n = input()
t = input()
n = 0
l = t.count('SF')
n = 0
n = t.count('FS')
print('YES' if l > n and (l > 0 or n > 0) else 'NO')


n = int(input())
s = input()
sd = fd = 0
for i in range(n - 1):
	if s[i] == 'S':
		if s[i + 1] == 'F':
			sd += 1
	elif s[i + 1] == 'S':
		fd += 1
if sd > fd:
	print('YES')
else:
	print('NO')


import re
input()
a = input()
b = re.sub('FS', '.', a)
c = re.sub('SF', ' ', a)
if c.count(' ') > b.count('.'):
	print('YES')
else:
	print('NO')


input()
s = input()
print('NYOE S'[s[-1] != s[0] == 'S'::2])


n = int(input())
n1 = input()
if n1.count('SF') > n1.count('FS'):
	print('YES')
else:
	print('NO')


import math
import collections
import bisect

def cint():
	return list(map(int, input().split()))

def cstr():
	return list(map(str, input().split(' ')))

def solve():
	n = int(input())
	word = input()
	counter1 = 0
	counter2 = 0
	prev = ''
	for i in range(n):
		if i == 0:
			prev = word[i]
		elif prev == 'F' and word[i] == 'S':
			counter1 += 1
			prev = 'S'
		elif prev == 'S' and word[i] == 'F':
			counter2 += 1
			prev = 'F'
	if counter2 > counter1:
		print('YES')
	else:
		print('NO')
t = 1
while t != 0:
	solve()
	t -= 1


days = input()
offices = input()
current = offices[0]
f_to_s = s_to_f = 0
for _ in offices[1:]:
	if current == 'F' and _ == 'S':
		f_to_s += 1
	elif current == 'S' and _ == 'F':
		s_to_f += 1
	current = _
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


st = input()
st = input()
print('YES' if st.count('SF') > st.count('FS') else 'NO')


n = int(input())
s = input()
good = 0
bad = 0
for i in range(n - 1):
	if s[i] + s[i + 1] == 'FS':
		bad += 1
	if s[i] + s[i + 1] == 'SF':
		good += 1
if good > bad:
	print('YES')
else:
	print('NO')


l = int(input())
n = input()
print('YNEOS'[n.count('SF') <= n.count('FS')::2])


q = int(input())
s = str(input())
f = 0
si = 0
for i in range(len(s) - 1):
	if s[i + 1] == 'F' and s[i] == 'S':
		f += 1
	elif s[i + 1] == 'S' and s[i] == 'F':
		si += 1
if f > si:
	print('YES')
else:
	print('NO')


n = int(input())
loc = list(input())
(SF, FS) = (0, 0)
for i in range(len(loc) - 1):
	if loc[i] == 'S' and loc[i + 1] == 'F':
		SF += 1
	elif loc[i] == 'F' and loc[i + 1] == 'S':
		FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
str = str(input())
i = 0
while i < n:
	if str[i] != 'S' and str[i] != 'F':
		print('error')
		exit()
	i = i + 1
i = 0
count_S = 0
count_F = 0
i = int(i)
while i < n:
	if i + 1 < n and (str[i] == 'S' and str[i + 1] == 'F'):
		count_S += 1
	elif i + 1 < n and (str[i] == 'F' and str[i + 1] == 'S'):
		count_F += 1
	i += 1
if count_S > count_F:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
seattleToFrancisco = s.count('SF')
franciscoToSeattle = s.count('FS')
if seattleToFrancisco > franciscoToSeattle:
	print('YES')
else:
	print('NO')


input()
line = input()
print('YES' if line.count('SF') > line.count('FS') else 'NO')


import sys
numCases = int(input())
flights = input()
numSF = 0
numFS = 0
count = 1
while count < numCases:
	if flights[count - 1] == 'S' and flights[count] == 'F':
		numSF += 1
	elif flights[count - 1] == 'F' and flights[count] == 'S':
		numFS += 1
	count += 1
if numSF > numFS:
	print('YES')
else:
	print('NO')


n = int(input())
if 2 <= n <= 100:
	st = input()
	a = 0
	b = 0
	i = 0
	while i < n - 1:
		if st[i] == 'F' and st[i + 1] == 'S':
			a += 1
		elif st[i] == 'S' and st[i + 1] == 'F':
			b += 1
		i += 1
	if a > b:
		print('NO')
	if a < b:
		print('YES')
	if a == b:
		print('NO')


a = int(input())
b = input()
c = 0
k = 0
for i in range(a - 1):
	if b[i:i + 2] == 'SF':
		c += 1
	elif b[i:i + 2] == 'FS':
		k += 1
if c > k:
	print('YES')
else:
	print('NO')


numDays = int(input())
flightInfo = input()
seattle_to_sf = 0
sf_to_seattle = 0
for i in range(1, len(flightInfo)):
	if flightInfo[i] == 'S' and flightInfo[i - 1] == 'F':
		sf_to_seattle += 1
	elif flightInfo[i] == 'F' and flightInfo[i - 1] == 'S':
		seattle_to_sf += 1
if seattle_to_sf > sf_to_seattle:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
F_to_S = s.count('FS')
S_to_F = s.count('SF')
if S_to_F > F_to_S:
	print('YES')
else:
	print('NO')


class betweenTheOffices:

	def __init__(self, str1, lenStr1):
		self.str1 = str1
		self.lenStr1 = lenStr1
		self.flewMoreTimes(str1, lenStr1)

	def flewMoreTimes(self, str1, lenStr1):
		if str1[0] == 'S' and str1[lenStr1 - 1] == 'F':
			print('YES')
		else:
			print('NO')
noDays = int(input())
if 2 <= noDays and noDays <= 100:
	pass
else:
	exit()
str1 = input().upper()
if len(str1) > noDays:
	exit()
betweenTheOfficesObj = betweenTheOffices(str1, len(str1))


n = int(input())
stroka = input()
SF = 0
FS = 0
plusiki = 0
while plusiki < n - 1:
	if stroka[plusiki] == 'S' and stroka[plusiki + 1] == 'F':
		SF = SF + 1
	if stroka[plusiki] == 'F' and stroka[plusiki + 1] == 'S':
		FS = FS + 1
	plusiki = plusiki + 1
if SF > FS:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
c = str(input())
if list(c)[0] == 'S' and list(c)[n - 1] == 'F':
	print('YES')
else:
	print('NO')


a = int(input())
s = input()
if s[0] == 'F':
	print('NO')
elif s[a - 1] == 'F':
	print('YES')
else:
	print('NO')


a = input()
a = input()
if a.count('S') == 0 | a.count('F') == 0:
	print('NO')
	exit(0)
if a[0] == 'S' and a[-1] == 'F':
	print('YES')
	exit(0)
print('NO')


n = int(input(''))
sf = list(input(''))
s2f = 0
f2s = 0
for i in range(1, n):
	s2f += 1 if sf[i - 1] == 'S' and sf[i] == 'F' else 0
	f2s += 1 if sf[i - 1] == 'F' and sf[i] == 'S' else 0
print('YES' if s2f > f2s else 'NO')


number = input('')
airport = input('')
if airport[0] == 'S' and airport[-1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
flights = input()
(f_to_s, s_to_f) = (0, 0)
for i in range(n - 1):
	if flights[i] == 'S' and flights[i + 1] == 'F':
		s_to_f += 1
	elif flights[i] == 'F' and flights[i + 1] == 'S':
		f_to_s += 1
if s_to_f > f_to_s:
	print('YES')
else:
	print('NO')


x = int(input())
y = input()
f_to_s = 0
f_to_f = 0
for i in range(x - 1):
	if y[i] != y[i + 1]:
		if y[i] == 'S':
			f_to_f += 1
		else:
			f_to_s += 1
if f_to_f > f_to_s:
	print('YES')
else:
	print('NO')


import sys, math, statistics as ss, collections as cc
n = int(input())
a = list(input())
q = 0
w = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		q = q + 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		w = w + 1
if q > w:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
i = 1
f = 0
k = 0
while i < len(a):
	if a[i - 1] == 'S' and a[i] == 'F':
		f += 1
	if a[i - 1] == 'F' and a[i] == 'S':
		k += 1
	i += 1
if f > k:
	print('YES')
else:
	print('NO')


n = int(input())
ls = input()
print(['NO', 'YES'][ls[0] == 'S' and ls[-1] == 'F'])


n = int(input())
city = input()
SF = 0
FS = 0
for i in range(n):
	if i > 0:
		if city[i - 1] + city[i] == 'SF':
			SF += 1
		elif city[i - 1] + city[i] == 'FS':
			FS += 1
if SF > FS:
	print('YES')
else:
	print('NO')


a = input()
s = input()
i = 0
far = 0
seat = 0
while i < len(s) - 1:
	if s[i] == 'S' and s[i + 1] == 'F':
		far += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		seat += 1
	i += 1
if seat < far:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(input())
cf = 0
cs = 0
for x in range(len(s) - 1):
	if s[x] == 'F' and s[x + 1] == 'S':
		cf += 1
	elif s[x] == 'S' and s[x + 1] == 'F':
		cs += 1
if cs > cf:
	print('YES')
else:
	print('NO')


input()
a = input()
print('NYOE S'[a[0] == 'S' and a[-1] == 'F'::2])


trips = int(input())
location = list(input())
if location[0] == 'S' and location[trips - 1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
fromS = fromF = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		fromS += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		fromF += 1
if fromS > fromF:
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input()).upper()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


def go(data):
	sf = 0
	fs = 0
	for i in range(1, len(data)):
		if data[i] not in ['S', 'F']:
			return 'NO'
		if data[i - 1] == 'F' and data[i] == 'S':
			fs += 1
		if data[i - 1] == 'S' and data[i] == 'F':
			sf += 1
	return 'YES' if sf > fs else 'NO'
n = int(input())
data = str(input())
if len(data) == n:
	result = go(data)
print(result)


n = int(input())
s = input()
flights_to_s = 0
flights_to_f = 0
i = 0
for i in range(len(s)):
	if i + 2 <= len(s):
		if s[i] != s[i + 1]:
			if s[i] == 'F' and s[i + 1] == 'S':
				flights_to_s = flights_to_s + 1
			elif s[i] == 'S' and s[i + 1] == 'F':
				flights_to_f = flights_to_f + 1
if flights_to_f > flights_to_s:
	print('YES')
else:
	print('NO')


input()
a = input()
print(('YES', 'NO')[a.count('FS') >= a.count('SF')])


n = int(input())
s = list(input())
fran = 0
sea = 0
for i in range(n - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		fran += 1
	elif s[i] == 'S' and s[i + 1] == 'F':
		sea += 1
if sea > fran:
	print('Yes')
else:
	print('No')


x = int(input())
n = input()
if n.count('SF') > n.count('FS'):
	print('YES')
elif n.count('SF') <= n.count('FS'):
	print('NO')


a = int(input())
q = input()
(countSF, countFS) = (0, 0)
for i in range(len(q) - 1):
	if q[i] == 'S' and q[i + 1] == 'F':
		countSF += 1
	elif q[i] == 'F' and q[i + 1] == 'S':
		countFS += 1
if countSF > countFS:
	print('YES')
else:
	print('NO')


n = int(input().strip())
s = input().strip()
s = iter(s)
prev = next(s)
f2s = 0
s2f = 0
for c in s:
	if c != prev:
		if c == 'S':
			f2s += 1
		elif c == 'F':
			s2f += 1
	prev = c
if f2s < s2f:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(input())
S = 0
SF = 0
for i in range(1, n):
	if arr[i] != arr[i - 1]:
		if arr[i] == 'S':
			S += 1
		else:
			SF += 1
if S < SF:
	print('YES')
else:
	print('NO')


n = input()
word = input()
SF = 0
FS = 0
for i in range(0, int(n) - 1):
	if word[i] + word[i + 1] == 'SF':
		SF += 1
	elif word[i] + word[i + 1] == 'FS':
		FS += 1
if SF > FS:
	print('yes')
else:
	print('no')


n = int(input())
f = input()
sf = 0
fs = 0
for i in range(n - 1):
	if f[i] == 'S' and f[i + 1] == 'F':
		sf = sf + 1
	elif f[i] == 'F' and f[i + 1] == 'S':
		fs = fs + 1
if sf - fs >= 1:
	print('yes')
else:
	print('no')


s = int(input())
n = input()
q = 0
p = 0
if n[0] == 'S' and n[s - 1] == 'F':
	print('YES')
else:
	print('NO')


x = input('')
x = int(x)
days = input('')
if days[0] != days[-1]:
	if days[0] == 'S':
		print('YES')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
c = 0
c1 = 0
c2 = 0
s = input()
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		c = c + 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		c1 = c1 + 1
	else:
		c2 = c2 + 1
if c > c1 or c > c2:
	print('yes')
else:
	print('no')


days = str(input())
cities = str(input())
days = int(days)
toSF = 0
toSEA = 0
i = 0
while True:
	if i == days - 1:
		break
	if cities[i] == cities[i + 1]:
		i += 1
		continue
	if cities[i] == 'F':
		toSEA += 1
	if cities[i] == 'S':
		toSF += 1
	i += 1
	if i >= days - 1:
		break
if toSF > toSEA:
	print('YES')
if toSF <= toSEA:
	print('NO')


n = int(input())
loc = list(input())
if loc[0] == 'S' and loc[n - 1] == 'F':
	print('YES')
else:
	print('NO')


n = int(input())
s = list(input())
mas = []
k = None
for i in range(n):
	if s[i] != k:
		k = s[i]
		mas.append(k)
mas = ''.join(mas)
a = mas.count('SF')
b = mas.count('FS')
if a > b:
	print('YES')
else:
	print('NO')


from string import *
(a, s) = (int(input()), input())
print('YES' if s.count('SF') > s.count('FS') else 'NO')


(numInput, places) = (int(input()), input())
(flewToSanFrancisco, flewToSeattle) = (0, 0)
for i in range(len(places) - 1):
	flewToSanFrancisco += places[i] == 'S' and places[i + 1] == 'F'
	flewToSeattle += places[i] == 'F' and places[i + 1] == 'S'
print('YES' if flewToSanFrancisco > flewToSeattle else 'NO')


a = int(input())
b = input()
i = 0
countf = 0
counts = 0
while i + 1 < a:
	if b[i] == 'F' and b[i + 1] == 'S':
		countf += 1
	elif b[i] == 'S' and b[i + 1] == 'F':
		counts += 1
	i += 1
if counts > countf:
	print('YES')
else:
	print('NO')


input()
l = list(input())
bef = l[0]
s = 0
f = 0
for i in range(1, len(l)):
	if bef == 'F' and l[i] == 'S':
		f += 1
		bef = 'S'
		continue
	elif bef == 'S' and l[i] == 'F':
		s += 1
		bef = 'F'
		continue
	bef = l[i]
print('YES' if s > f else 'NO')


n = int(input())
arr = input()
print('YES' if arr.count('SF') > arr.count('FS') else 'NO')


input()
s = input()
print('NYOE S'[s.count('SF') > s.count('FS')::2])


n = int(input())
l = input()
b = 0
c = 0
for i in range(n - 1):
	if l[i] != l[i + 1]:
		if l[i] == 'S':
			b += 1
		else:
			c += 1
if b > c:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
current_city = a[0]
to_francisco = 0
to_seatle = 0
for i in a[1:]:
	if i != current_city:
		if i == 'F':
			to_francisco += 1
		else:
			to_seatle += 1
		current_city = i
if to_francisco > to_seatle:
	print('YES')
else:
	print('NO')


n = int(input())
t = input()
a = []
for x in range(n - 1):
	if t[x] == 'S' and t[x + 1] == 'F':
		a.append(1)
	elif t[x] == 'F' and t[x + 1] == 'S':
		a.append(0)
if a.count(1) > a.count(0):
	print('Yes')
else:
	print('No')


n = int(input())
string = input()
s = f = 0
for i in range(n - 1):
	if string[i] == 'S' and string[i + 1] == 'F':
		s += 1
	elif string[i] != string[i + 1]:
		f += 1
res = 'YES' if s > f else 'NO'
print(res)


n = int(input())
ch = input()
if ch.count('FS') < ch.count('SF'):
	print('yes')
else:
	print('no')


x = int(input())
n = input()
s = 0
d = 0
ar = []
for i in n:
	ar.append(i)
for j in range(1, x):
	if ar[j] == 'F' and ar[j - 1] == 'S':
		s = s + 1
	elif ar[j] == 'S' and ar[j - 1] == 'F':
		d = d + 1
if s > d:
	print('YES')
else:
	print('NO')


n = int(input())
l = input()
d = {}
d['SS'] = 0
d['SF'] = 0
d['FS'] = 0
d['FF'] = 0
for val in range(len(l) - 1):
	d[l[val] + l[val + 1]] += 1
if d['SF'] > d['FS']:
	print('YES')
else:
	print('NO')


N = int(input())
days = str(input())
if days[0] + days[-1] == 'SF':
	print('YES')
else:
	print('NO')


n = int(input())
k = str(input())
n = 0
y = 0
for i in range(len(k) - 1):
	if i != len(k):
		if k[i] == 'S' and k[i + 1] == 'F':
			y += 1
		elif k[i] == 'F' and k[i + 1] == 'S':
			n += 1
	else:
		n = n
		y = y
if y > n:
	print('yes')
else:
	print('NO')


import sys
n = int(sys.stdin.readline())
locations = sys.stdin.readline()
seattle_to_sf = 0
sf_to_seattle = 0
for i in range(n - 1):
	if locations[i] == 'S' and locations[i + 1] == 'F':
		seattle_to_sf += 1
	elif locations[i] == 'F' and locations[i + 1] == 'S':
		sf_to_seattle += 1
if seattle_to_sf > sf_to_seattle:
	print('yes')
else:
	print('no')


def main():
	input()
	print(more_from_seattle(input()))

def more_from_seattle(cities):
	from_seattle = 0
	from_san = 0
	current = cities[0]
	for c in cities[1:]:
		if current == c:
			continue
		if current == 'S':
			from_seattle += 1
		else:
			from_san += 1
		current = c
	if from_seattle > from_san:
		return 'YES'
	return 'NO'
main()


from sys import exit as sys_return
amount = int(input())
(to_disco, to_dota) = (0, 0)
cities = str(input())
for i in range(1, amount):
	if cities[i - 1] == 'F' and cities[i] == 'S':
		to_dota += 1
	if cities[i - 1] == 'S' and cities[i] == 'F':
		to_disco += 1
if to_disco > to_dota:
	print('YES')
else:
	print('NO')


n = int(input())
cities = input()
print(('NO', 'YES')[cities[0] == 'S' and cities[-1] == 'F'])


sf = 0
fs = 0
n = int(input())
c = input()
n -= 1
d = c[0]
s = c[1:]
for t in s:
	if d == 'S' and t == 'F':
		sf += 1
	elif d == 'F' and t == 'S':
		fs += 1
	d = t
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
flights = input()
x = 0
for i in range(len(flights) - 1):
	if flights[i] == 'S' and flights[i + 1] == 'F':
		x += 1
	if flights[i] == 'F' and flights[i + 1] == 'S':
		x -= 1
if x > 0:
	print('YES')
else:
	print('NO')


import re
n = int(input())
l = str(input())
a = 0
b = 0
if 2 <= n <= 100 and n == int(len(l)):
	f = re.findall('SF', l)
	r = re.findall('FS', l)
	if len(f) > len(r):
		print('YES')
	else:
		print('NO')


n = int(input())
S = input()
S = list(S)
sf = 0
fs = 0
for (i, s) in enumerate(S):
	if i + 1 < n:
		if (S[i] == 's' or S[i] == 'S') and (S[i + 1] == 'f' or S[i + 1] == 'F'):
			sf += 1
		elif i + 1 < n:
			if (S[i] == 'f' or S[i] == 'F') and (S[i + 1] == 's' or S[i + 1] == 'S'):
				fs += 1
if sf > fs:
	print('YES')
else:
	print('NO')


input()
s = input()
cur = s[0]
StoF = 0
FtoS = 0
for c in s:
	if c != cur:
		cur = c
		if c == 'F':
			StoF += 1
		else:
			FtoS += 1
if StoF > FtoS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
Fr = Se = 0
prev = s[0]
for i in range(1, n):
	if s[i] != prev:
		if s[i] == 'F':
			Fr += 1
		else:
			Se += 1
	prev = s[i]
print('YES' if Fr > Se else 'NO')


def main():
	n = input()
	iv = input()
	cur = iv[0]
	sf = 0
	fs = 0
	for c in iv[1:]:
		if cur == 'F' and c != 'F':
			fs += 1
			cur = 'S'
		elif cur == 'S' and c != 'S':
			sf += 1
			cur = 'F'
	print('YES' if sf > fs else 'NO')
main()


n = int(input())
s = input().strip()
s1 = 0
s2 = 0
for i in range(1, len(s)):
	if s[i] != s[i - 1]:
		if s[i - 1] == 'S':
			s1 += 1
		else:
			s2 += 1
if s1 > s2:
	print('YES')
else:
	print('NO')


def solution():
	n = int(input())
	s = list(input())
	ans = 0
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			if s[i] == 'S' and s[i + 1] == 'F':
				ans += 1
			else:
				ans -= 1
	print('YES' if ans > 0 else 'No')
solution()


n = int(input())
s = input()
F_S = 0
S_F = 0
previous = ''
for i in s:
	if i == 'F':
		if previous == 'S':
			S_F += 1
	elif i == 'S':
		if previous == 'F':
			F_S += 1
	previous = i
if F_S >= S_F:
	print('NO')
else:
	print('YES')


y = input()
x = input()
i = 1
a = 0
b = 0
while i < len(x):
	if x[i] == 'F' and x[i - 1] == 'S':
		a += 1
	if x[i] == 'S' and x[i - 1] == 'F':
		b += 1
	i += 1
if a > b:
	print('YES')
else:
	print('NO')


(n, data, one, other) = (int(input()), input(), 0, 0)
for i in range(n - 1):
	if data[i] == 'S' and data[i + 1] == 'F':
		one += 1
	elif data[i] == 'F' and data[i + 1] == 'S':
		other += 1
if one > other:
	print('YES')
else:
	print('NO')


def main():
	n = input()
	s = input()
	sf = s.replace('SF', '')
	fs = s.replace('FS', '')
	if len(sf) < len(fs):
		print('YES')
	else:
		print('NO')
main()


a = input()
string = input()
no = string.count('FS')
yes = string.count('SF')
print('YES' if yes > no else 'NO')


n = int(input())
s = input()
c = 0
co = 0
for i in range(1, len(s)):
	if s[i - 1] + s[i] == 'SF':
		c += 1
	elif s[i - 1] + s[i] == 'FS':
		co += 1
if c > co:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
go = 0
come = 0
for i in range(0, n - 1):
	if s[i] == 'S':
		if s[i + 1] == 'F':
			go += 1
	elif s[i + 1] == 'S':
		come += 1
if go > come:
	print('YES')
else:
	print('NO')


num = int(input())
cities = input()
score = 0
for i in range(len(cities) - 1):
	flight = cities[i:i + 2]
	if flight == 'SF':
		score += 1
	elif flight == 'FS':
		score -= 1
if score > 0:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
count = 0
num = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		count += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		num += 1
if count > num:
	print('YES')
else:
	print('NO')


n = int(input())
city = list(input())
yes_count = 0
no_count = 0
for i in range(1, n):
	if city[i - 1] == 'F' and city[i] == 'S':
		no_count += 1
	elif city[i - 1] == 'S' and city[i] == 'F':
		yes_count += 1
if yes_count > no_count:
	print('YES')
elif yes_count <= no_count:
	print('NO')


n = input()
s = input()
a = []
for c in s:
	a.append(c)
sf = 0
ff = 0
for i in range(len(a) - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		sf += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		ff += 1
if sf > ff:
	print('YES')
else:
	print('NO')


numOfDays = int(input())
travelD = input()
counterSF = 0
counterFS = 0
for i in range(numOfDays - 1):
	if travelD[i] == 'S' and travelD[i + 1] == 'F':
		counterSF += 1
	if travelD[i] == 'F' and travelD[i + 1] == 'S':
		counterFS += 1
if counterSF > counterFS:
	print('YES')
else:
	print('NO')


useless = int(input())
data = list(input().strip().upper())
(seatle, francisco, count) = (0, 0, 0)
while count < useless - 1:
	if data[count] == 'S' and data[count + 1] == 'F':
		seatle += 1
	elif data[count] == 'F' and data[count + 1] == 'S':
		francisco += 1
	count += 1
if seatle > francisco:
	print('YES')
else:
	print('NO')


d = input()
n = input()
if len(n.split('SF')) > len(n.split('FS')):
	print('YES')
else:
	print('NO')


a = int(input())
b = input()
stf = 0
fts = 0
for i in range(0, a):
	if b[i:i + 2] == 'SF':
		stf += 1
	if b[i:i + 2] == 'FS':
		fts += 1
if fts < stf:
	print('Yes')
else:
	print('No')


no_of_days = int(input(''))
places = input('')
S_to_F = 0
F_to_S = 0
for day in range(0, no_of_days - 1):
	if places[day] != places[day + 1]:
		if places[day] == 'S':
			S_to_F += 1
		else:
			F_to_S += 1
if S_to_F > F_to_S:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
n = int(input())
stof = 0
ftos = 0
s = input()
prev = s[0]
for i in s[1:]:
	if i == 'F' and prev == 'S':
		prev = 'F'
		stof += 1
	elif i == 'S' and prev == 'F':
		prev = 'S'
		ftos += 1
if stof > ftos:
	print('YES')
else:
	print('NO')


n = int(input())
t = input()
count = 0
count1 = 0
for i in range(n - 1):
	if t[i] + t[i + 1] == 'SF':
		count += 1
	elif t[i] + t[i + 1] == 'FS':
		count1 += 1
if count > count1:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
if s[0] == 'S' and s[-1] == 'F':
	print('yes')
else:
	print('no')


n = int(input())
s = input()
F = s.count('SF')
S = s.count('FS')
if F > S:
	print('YES')
else:
	print('NO')


q = input()
a = input()
print(['NO', 'YES'][a[0] == 'S' and a[-1] == 'F'])


n = int(input())
str = input()
countw = 0
countl = 0
for i in range(n):
	if str[i:i + 2] == 'SF':
		countw += 1
	elif str[i:i + 2] == 'FS':
		countl += 1
if countw > countl:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
if s[0] == 'F':
	print('NO')
else:
	d = False
	for i in range(1, len(s)):
		if s[i - 1] != s[i]:
			d = not d
	if d:
		print('YES')
	else:
		print('NO')


_ = input()
inp = input()
inp = list(inp)
prev = inp[0]
sfcount = 0
fccount = 0
for x in inp[1:]:
	if prev == 'S' and x == 'F':
		sfcount += 1
		prev = x
	if prev == 'F' and x == 'S':
		fccount += 1
		prev = x
	else:
		prev = x
print('YES' if sfcount > fccount else 'NO')


n = int(input())
line = input()
count = 0
count2 = 0
l = len(line)
for i in range(0, l - 1):
	if line[i] == 'S' and line[i + 1] == 'F':
		count = count + 1
	elif line[i] == 'F' and line[i + 1] == 'S':
		count2 = count2 + 1
if count > count2:
	print('YES')
else:
	print('NO')


ip_no_days = int(input())
data_diff_days = input()
countSF = 0
countFS = 0
for i in range(1, len(data_diff_days)):
	if data_diff_days[i - 1] == 'S' and data_diff_days[i] == 'F':
		countSF += 1
	elif data_diff_days[i - 1] == 'F' and data_diff_days[i] == 'S':
		countFS += 1
	else:
		continue
if countSF > countFS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
s2f = f2s = 0
for i in range(n - 1):
	if s[i:i + 2] == 'SF':
		s2f += 1
	elif s[i:i + 2] == 'FS':
		f2s += 1
print('YES' if s2f > f2s else 'NO')


n = int(input())
s = input()
cnt = [0, 0]
for i in range(n - 1):
	if s[i] != s[i + 1]:
		if s[i] == 'S':
			cnt[0] += 1
		else:
			cnt[0] -= 1
if cnt[0] > 0:
	print('Yes')
else:
	print('No')


def solve(offices):
	s2f = 0
	f2s = 0
	for i in range(1, len(offices)):
		if offices[i] != offices[i - 1]:
			if offices[i - 1] == 'S':
				s2f += 1
			else:
				f2s += 1
	if s2f > f2s:
		return 'YES'
	else:
		return 'NO'

def main():
	_ = int(input())
	offices = input()
	print(solve(offices))
main()


n = int(input())
string = str(input())
new = []
for i in string:
	if i == 'F':
		new.append(1)
	else:
		new.append(0)
F = 0
S = 0
for i in range(1, n):
	if new[i] - new[i - 1] < 0:
		F += 1
	elif new[i] - new[i - 1] > 0:
		S += 1
if F < S:
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input())
seatle_F = 0
france_S = 0
for i in range(1, n):
	if s[i - 1] == 'S' and s[i] == 'F':
		seatle_F += 1
	elif s[i - 1] == 'F' and s[i] == 'S':
		france_S += 1
if seatle_F > france_S:
	print('YES')
else:
	print('NO')


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : li(ent())
n = iinp()
cadena = inp()
san = sea = 0
for i in range(1, n):
	if cadena[i - 1] == 'S' and cadena[i] == 'F':
		sea += 1
	elif cadena[i - 1] == 'F' and cadena[i] == 'S':
		san += 1
if sea > san:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
x = s.split('SF')
y = s.split('FS')
x = len(x) - 1
y = len(y) - 1
if x > y:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
s_f = f_s = 0
for idx in range(1, n):
	if s[idx] == 'F' and s[idx - 1] == 'S':
		s_f += 1
	if s[idx] == 'S' and s[idx - 1] == 'F':
		f_s += 1
print('YES' if s_f > f_s else 'NO')


t = 1
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	sf = 0
	sea = 0
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			if s[i] == 'S':
				sf += 1
			else:
				sea += 1
	if sea >= sf:
		print('NO')
	else:
		print('YES')


def rahul(word):
	return [char for char in word]
a = int(input())
b = rahul(input())
c = list()
d = 0
r = 0
while r < a - 1:
	if b[r] != b[r + 1]:
		c.append(1)
	r = r + 1
r = 0
while r < len(c):
	d = d + c[r]
	r = r + 2
if d > len(c) - d:
	if b[0] == 'S':
		print('YES')
	else:
		print('NO')
elif d == len(c) - d:
	print('NO')
elif b[0] == 'S':
	print('NO')
else:
	print('YES')


number = int(input())
flights = input()
print('YES') if len(flights.split('SF')) > len(flights.split('FS')) else print('NO')


input()
a = input()
print('YES' if a.count('SF') > a.count('FS') else 'NO')


(_, s) = (input(), input())
print('YNEOS'[s.count('SF') <= s.count('FS')::2])


n = int(input())
s = input()
for i in range(n):
	if s[0] == 'S' and s[n - 1:n] == 'F':
		print('YES')
		break
	elif s[0] == 'F' or (s[0] == 'S' and s[n - 1:n] == 'S'):
		print('NO')
		break


n = int(input())
pos = input()
S = pos.count('SF')
F = pos.count('FS')
if S > F:
	print('YES')
else:
	print('No')


a = int(input())
d = input()
s = 0
f = 0
now = d[0]
for i in range(1, a):
	if d[i] == 'S':
		if now != d[i]:
			now = d[i]
			f += 1
	elif now != d[i]:
		now = d[i]
		s += 1
	now = d[i]
if s > f:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
k = ''
for i in s:
	if i == 'F':
		k = k + '1'
	else:
		k = k + '0'
l = len(k)
a = 0
b = 0
for i in range(0, l - 1):
	for j in range(1, l):
		if k[i] == '1' and k[j] == '0':
			a = a + 1
		elif k[i] == '0' and k[j] == '1':
			b = b + 1
z = b - a
if z > 0:
	print('YES')
else:
	print('NO')


n = int(input())
days = input()
s_count = 0
f_count = 0
for _ in range(n - 1):
	if days[_] == 'S' and days[_ + 1] != days[_]:
		s_count += 1
	elif days[_] == 'F' and days[_ + 1] != days[_]:
		f_count += 1
if s_count > f_count:
	print('YES')
else:
	print('NO')


i = input()
s = input()
if s.count('SF') > s.count('FS'):
	print('YES')
else:
	print('NO')


input()
my_str = input()
SF = my_str.count('SF')
FS = my_str.count('FS')
if SF > FS:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
good = 0
bad = 0
for i in range(1, n):
	if s[i] == 'F' and s[i - 1] == 'S':
		good += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		bad += 1
if good > bad:
	print('YES')
else:
	print('NO')


n = int(input())
string = input()
a = b = 0
for i in range(n - 1):
	if string[i] == 'S' and string[i + 1] == 'F':
		a += 1
	elif string[i] == 'F' and string[i + 1] == 'S':
		b += 1
if a > b:
	print('YES')
	exit()
print('NO')


n = map(int, input())
st = input()
sf = st.count('SF')
fs = st.count('FS')
if sf > fs:
	print('YES')
else:
	print('NO')


num_flights = int(input())
flight = input()
numSF = 0
numFS = 0
for x in range(1, len(flight)):
	if flight[x - 1] == 'S' and flight[x] == 'F':
		numSF += 1
	if flight[x - 1] == 'F' and flight[x] == 'S':
		numFS += 1
if numSF > numFS:
	print('YES')
else:
	print('NO')


n = int(input())
stri = list(input())
(s, f) = (0, 0)
for j in range(0, n - 1):
	if stri[j] == 'S' and stri[j + 1] == 'F':
		s += 1
	elif stri[j] == 'F' and stri[j + 1] == 'S':
		f += 1
x = print('YES') if s > f else print('NO')


list = []
i = 0
seattle = 0
francisco = 0
n = int(input())
s = input()
for char in s:
	list.append(char)
while i < len(s) - 1:
	if list[i] == 'S' and list[i + 1] == 'F':
		seattle += 1
	elif list[i] == 'F' and list[i + 1] == 'S':
		francisco += 1
	i += 1
if seattle > francisco:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
stf = 0
fts = 0
for i in range(n - 1):
	if a[i] == 'S' and a[i + 1] == 'F':
		stf += 1
	elif a[i] == 'F' and a[i + 1] == 'S':
		fts += 1
if stf > fts:
	print('YES')
else:
	print('NO')


n = int(input())
flight = input()
seattle = 0
francisco = 0
for i in range(0, n - 1):
	if flight[i] == 'F' and flight[i + 1] == 'S':
		francisco += 1
	if flight[i] == 'S' and flight[i + 1] == 'F':
		seattle += 1
if seattle > francisco:
	print('YES')
else:
	print('NO')


from collections import deque

def foo(x, s):
	count = 0
	for (a, b) in zip(s, s[1:]):
		if a == 'S' and b == 'F':
			count += 1
		elif a == 'F' and b == 'S':
			count -= 1
	return 'YES' if count > 0 else 'NO'
test = int(input())
first = input()
print(foo(test, first))


day = int(input())
road = input()
if road.count('SF') > road.count('FS'):
	print('YES')
else:
	print('NO')


n = int(input())
s = str(input())
r = 0
p = 0
for i in range(n - 1):
	if s[i] == 'F' and s[i + 1] == 'S':
		r = r + 1
	if s[i] == 'S' and s[i + 1] == 'F':
		p = p + 1
if p > r:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
e = 0
e1 = 0
for i in range(n - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		e += 1
	elif s[i] == 'F' and s[i + 1] == 'S':
		e1 += 1
if e > e1:
	print('YES')
else:
	print('NO')


num = int(input())
lst = list(input())
ans = ''
for i in range(num):
	if i + 1 == num:
		break
	if lst[i] != lst[i + 1]:
		ans += lst[i]
if ans.count('S') > ans.count('F'):
	print('YES')
else:
	print('NO')


a = int(input())
e = 0
b = input()
j = 0
for i in range(a):
	if i + 1 < a:
		if b[i] == 'S' and b[i + 1] == 'F':
			e += 1
		if b[i] == 'F' and b[i + 1] == 'S':
			j += 1
if e > j:
	print('YES')
else:
	print('NO')


n = int(input())
days = input()
(yesterday, today, SF, FS) = (days[0], '', 0, 0)
for i in range(1, n):
	today = days[i]
	if today == yesterday:
		continue
	elif today == 'S':
		FS += 1
	else:
		SF += 1
	yesterday = today
print('YES') if SF > FS else print('NO')


n = int(input())
w = input()
print('YES' if w.count('SF') > w.count('FS') else 'NO')


t = int(input())
days = input()
(stof, ftos) = (0, 0)
for x in range(1, len(days)):
	if days[x - 1] == 'F' and days[x] == 'S':
		ftos += 1
	elif days[x - 1] == 'S' and days[x] == 'F':
		stof += 1
print('YES' if stof > ftos else 'NO')


n = int(input())
s = input()
scount = 0
fcount = 0
for i in range(len(s) - 1):
	if s[i] + s[i + 1] == 'SF':
		scount += 1
	elif s[i] + s[i + 1] == 'FS':
		fcount += 1
if scount > fcount:
	print('YES')
else:
	print('NO')


n = int(input())
x = list(input().lower())
(fs, sf) = (0, 0)
for i in range(len(x) - 1):
	if x[i] == 'f' and x[i + 1] == 's':
		fs += 1
	if x[i] == 's' and x[i + 1] == 'f':
		sf += 1
print('YES' if sf > fs else 'NO')


n = input()
s = input()
countS = 0
countF = 0
for i in range(1, len(s)):
	if s[i] == 'F' and s[i - 1] == 'S':
		countS += 1
	elif s[i] == 'S' and s[i - 1] == 'F':
		countF += 1
if countS > countF:
	print('YES')
else:
	print('NO')


n = int(input())
s = input()
res1 = 0
res2 = 0
for i in range(0, len(s) - 1):
	if s[i] == 'S' and s[i + 1] == 'F':
		res1 += 1
	if s[i] == 'F' and s[i + 1] == 'S':
		res2 += 1
print('Yes' if res1 > res2 else 'No')


n = int(input())
a = input().lower()
(f, s) = (0, 0)
sf = a.count('sf')
fs = a.count('fs')
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
k = input()

def split_char(str):
	return [char for char in str]
travels = split_char(k)
san = True if travels[0] == 'F' else False
present = travels[0]
san_count = 0
for travel in travels:
	if present != travel:
		if san:
			san_count -= 1
			san = False
		else:
			san_count += 1
			san = True
	present = travel
if san_count > 0:
	print('Yes')
else:
	print('No')


n = int(input())
f = list(str(input()))
v = 0
for i in range(n - 1):
	if f[i] != f[i + 1]:
		if f[i] == 'S':
			v += 1
		else:
			v -= 1
if v > 0:
	print('YES')
else:
	print('NO')


n = int(input())
last = ''
f = s = 0
l = list(input())
for i in range(n):
	x = l[i]
	if i == 0:
		if x == 'S':
			s -= 1
		else:
			f -= 1
	if x != last and x == 'S':
		s += 1
	elif x != last and x == 'F':
		f += 1
	last = x
print(['NO', 'YES'][f > s])


a = input()
a = list(input())
(fs, sf) = (0, 0)
for i in range(len(a) - 1):
	if a[i] == 'F' and a[i + 1] == 'S':
		fs += 1
	elif a[i] == 'S' and a[i + 1] == 'F':
		sf += 1
if sf > fs:
	print('YES')
else:
	print('NO')


n = int(input())
S = input()
A = S.count('SF')
B = S.count('FS')
if A > B:
	print('YES')
else:
	print('NO')


def count(s, n):
	ctr = 0
	ctr_1 = 0
	for i in range(n - 1):
		if s[i] + s[i + 1] == 'FS':
			ctr += 1
		elif s[i] + s[i + 1] == 'SF':
			ctr_1 += 1
	if ctr_1 > ctr:
		print('YES')
	else:
		print('NO')
n = input()
n = int(n)
s = input()
count(s, n)


n = int(input())
offices = input()
francisco_seattle = 0
seattle_francisco = 0
for i in range(1, len(offices)):
	if offices[i - 1] != offices[i]:
		if offices[i - 1] == 'S':
			seattle_francisco += 1
		else:
			francisco_seattle += 1
if seattle_francisco > francisco_seattle:
	print('YES')
else:
	print('NO')


num = int(input())
n = list(str(input()))

def flight(num, n):
	i = 0
	S = 0
	F = 0
	for x in range(num - 1):
		if n[i] == n[i + 1]:
			i += 1
		elif n[i] == 'S':
			S += 1
			i += 1
		else:
			F += 1
			i += 1
	if S > F:
		print('YES')
	else:
		print('NO')
flight(num, n)