import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Siddhraj
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int county = 0, countn = 0;
            for (int i = 1; i < n; i++) {
                if (s.charAt(i - 1) == 'S' && s.charAt(i) == 'F')
                    county++;
                if (s.charAt(i - 1) == 'F' && s.charAt(i) == 'S')
                    countn++;
            }
            if (county > countn)
                out.println("YES");
            else
                out.println("NO");
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;

/**
 *
 * @author haroldmc
 */
public class BetweenTheOffices {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

         int quant = sc.nextInt();
         sc.nextLine();
         String temp = sc.nextLine();
         String[] flew = temp.split("");
         int b= flew.length;

        if(flew[0].equals("S") && flew[b-1].equals("F"))
        {
            System.out.println("YES");
        }
        else
        {
             System.out.println("NO");
        }

    }

}

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class seattle {

    public static void main(String[] args) throws IOException {
    	Scanner input = new Scanner (System.in);
    	int r = input.nextInt();
    	String y = input.next() ;
    	int nf=0,ns=0;
    	for (int i=0;i<y.length()-1;i++) {
    		char c,b;
    		c=y.charAt(i);
    		b=y.charAt(i+1);
    		if (c=='F'&& b=='S') {
    			ns ++;
    		}
    		if (c=='S'&& b =='F') {
    			nf ++;
    		}

    	}
    	if (nf > ns ) {System.out.println("YES");}
    	else {System.out.println("NO");}

    }
}

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class seattle {

    public static void main(String[] args) throws IOException {
    	Scanner input = new Scanner (System.in);
    	int mkm = input.nextInt();
    	String y = input.next() ;
    	int nf=0,ns=0;
    	for (int i=0;i<y.length()-1;i++) {
    		char c,b;
    		c=y.charAt(i);
    		b=y.charAt(i+1);
    		if (c=='F'&& b=='S') {
    			ns ++;
    		}
    		if (c=='S'&& b =='F') {
    			nf ++;
    		}

    	}
    	if (nf > ns ) {System.out.println("YES");}
    	else {System.out.println("NO");}

    }
}

import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    sc.nextLine();
        String vuelos = sc.nextLine();
        int S=0, F=0, C=0;
        for(int i=0; i<n-1; i++)
        {
            int j=i+1;
            if(vuelos.charAt(i)=='F' && vuelos.charAt(j) == 'S')
                F++;
            if(vuelos.charAt(i)=='S' && vuelos.charAt(j) == 'F')
                S++;
            /*if(vuelos.charAt(i)=='F' && vuelos.charAt(i+1) == 'F')
            {
                C++;
            }
            if(vuelos.charAt(i)=='S' && vuelos.charAt(i+1) == 'S')
            {
                C++;
            }*/
        }
        if(S>F)
            System.out.print("YES");
        else if(F>=S)
            System.out.print("NO");

	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        scan.nextLine();
        String s = scan.nextLine();
        char[] chars = s.toCharArray();
        int sietl = 0;
        int franc = 0;
        for (int i = 1; i < n; i++) {
            if (chars[i - 1] == 'S' && chars[i] == 'F'){
                ++sietl;
            }else if (chars[i - 1] == 'F' && chars[i] == 'S'){
                ++franc;
            }
        }
        if (sietl > franc){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		String str = cin.next();
		int a = 0;
		for (int i = 1; i < str.length(); i++)
			if (str.charAt(i) == 'F' && str.charAt(i-1) == 'S') a++;
			else if (str.charAt(i) == 'S' && str.charAt(i-1) == 'F') a--;
		System.out.println(a > 0 ? "YES" : "NO");
	}
}

import java.util.Scanner;
public class Solution {

	private static Scanner s;

	public static void main(String[] args) {
		s = new Scanner(System.in);
		int n=s.nextInt();
		String string=s.next();
		char current_location=string.charAt(0);
		int i=1;
		int s_to_f=0;
		int f_to_s=0;
		while (i<string.length())
		{
			char c=string.charAt(i);
			if (c==current_location)
			{
				i++;
			}
			else if(current_location=='S' && c=='F')
			{
				s_to_f++;
				i++;
				current_location='F';
			}
			else
			{
				current_location='S';
				f_to_s++;
				i++;
			}
		}

		if (s_to_f>f_to_s)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

}

import java.util.Scanner;
public class main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		String destino = input.next();
		int tam = destino.length();
		int ac1 = 0,ac2 = 0;
		int j=0;
		for(int i=1;i<tam;i++){
			char letra1 = destino.charAt(j);
			char letra2 = destino.charAt(i);
			if(letra1 == 'S' && letra2 == 'F'){
				ac1++;
			}
			else if(letra1 == 'F' && letra2 == 'S'){
				ac2++;
			}
			j++;
		}
		if(ac1 > ac2){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}

}

// 1508128427531

import java.util.Scanner;
public class Ofice
{
    public static Scanner scan=new Scanner(System.in);
    public static void main(String args[])
    {
        int num;
        num=scan.nextInt();
        vector(num);
    }

    static public void vector(int num)
    {   String pal;
        pal=scan.next();
        int fs=0,sf=0;
        for(int i=0; i<num-1;i++)
        {
            if(pal.charAt(i)=='F'&&pal.charAt(i+1)=='S')
            {
                fs++;
            }

            if(pal.charAt(i)=='S'&&pal.charAt(i+1)=='F')
            {
                sf++;
            }
        }
        if(sf>fs)
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class Problem {

    public static void main(String [] args) {

        Scanner scanner  = new Scanner(System.in);

        StringBuilder sb1 = new StringBuilder(scanner.nextLine());
        StringBuilder sb2 = new StringBuilder(scanner.nextLine());
        int StoF = 0;
        int FtoS = 0;

        for(int i = 1 ; i < Integer.valueOf(sb1.toString()) ; i++)
        {
            if(sb2.substring(i-1,i+1).equals("SF"))
            {
                StoF++;
            }
            if(sb2.substring(i-1,i+1).equals("FS"))
            {
                FtoS++;
            }
        }
        scanner.close();
        if(StoF>FtoS)
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }

    }
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sn=new Scanner(System.in);
		int n=sn.nextInt();
		String str=sn.next();
		int c=0,c1=0;

		for(int i=0;i<n-1;i++)
		{
		    if(str.charAt(i)=='S' && str.charAt(i+1)=='F') c++;
		    if(str.charAt(i)=='F' && str.charAt(i+1)=='S') c1++;
		}
		if(c>c1)
		    System.out.println("YES");
		else
		    System.out.println("NO");
	}
}

//867A - Between the Offices

import java.util.Scanner;

public class Offices{
    public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        if(s.charAt(0) == 'S' && s.charAt(s.length() - 1) == 'F'){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

    }
}

import java.util.Scanner;
public class App {

    public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        if(s.charAt(0) == 'S' && s.charAt(s.length() - 1) == 'F'){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();
        String inp=sc.next();
        char[] arr=inp.toCharArray();
        int f=0;
        int s=0;
        for(int i=0;i<n-1;i++){
            if(arr[i]=='F' && arr[i+1]=='S')
                f++;
            if(arr[i]=='S' && arr[i+1]=='F')
                s++;
        }
        if(s>f)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.Scanner;

public class BetweenTheOffices {

	public static void main(String[] args) {
		try {
			BetweenTheOffices bto = new BetweenTheOffices();
			bto.run();
		}catch(Exception e) {
			e.printStackTrace();
		}
	}

	public void run() {
		Scanner scan = new Scanner(System.in);
		int str_num = scan.nextInt();
		String str = scan.next();
		str = str.toUpperCase();
		scan.close();

		if(str_num == str.length()) {
			int seattle=0, francisco=0;

			for(int i=1; i<str.length(); i++) {
				if(str.charAt(i-1) != str.charAt(i)) {
					if(str.charAt(i-1) == 'F')
						seattle++;
					else
						francisco++;
				}
			}

			if(francisco > seattle)
				System.out.println("YES");
			else
				System.out.println("NO");
		}else
			System.exit(0);
	}

}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String ch = sc.next();
	       String str = sc.next();
	       int f = 0, s = 0;

	       if(str.charAt(0) == 'F') {f = 0;}
	       if(str.charAt(0) == 'S') {s = 0;}

	       for(int i = 0; i < str.length() - 1; i++) {
				if(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {
					f++;
				}
				if(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {
					s++;
				}
			}

	       if(s > f) {
	    	   System.out.print("YES");
	       }
	       if(s < f) {
	    	   System.out.print("NO");
	       }
	       if(s == f) {
	    	   System.out.print("NO");
	       }
	}
}

import java.util.Scanner;

public class Doller {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x=sc.nextInt();
    String s = sc.next();

    int countS=0;
    int countF=0;

    for (int i=0; i<s.length()-1; i++){
        if(s.charAt(i)=='F'&&s.charAt(i+1)=='S')
            countS++;
        else if(s.charAt(i)=='S'&&s.charAt(i+1)=='F')
            countF++;}

    if(countF<=countS)
        System.out.print("NO");
    else System.out.print("YES");

}}

import java.util.*;

public class Solution2{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        scan.nextLine();

        String _travel = scan.nextLine();

        char[] travel= _travel.toCharArray();
        int i=0,j=1;
        int countSF=0,countFS=0;
        while(j<n){

                if(travel[i]=='S' && travel[j]=='F')
                countSF++;
                if(travel[i]=='F'&&travel[j]=='S')
                countFS++;
                i++;
                j++;

        }

        if(countSF>countFS){
            System.out.print("YES");
        }
        else{
            System.out.print("NO");
        }
    }

}

import java.util.Scanner;

public class Offices{

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n;
		int andata, ritorno;
		andata = ritorno = 0;
		String s = new String();

		n = in.nextInt();
		in.nextLine();
		s = in.nextLine();

		for (int i=0; i<n-1; i++) {
			if (s.charAt(i) == 'S' && s.charAt(i+1) == 'F') andata++;
			else if (s.charAt(i) == 'F' && s.charAt(i+1) == 'S') ritorno++;
		}

		System.out.println(andata > ritorno ? "YES" : "NO");

		in.close();
	}

}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

  private void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    String s = in.next();
    if (s.startsWith("S")) {
      out.println(s.endsWith("F") ? "YES" : "NO");
    } else {
      out.println("NO");
    }
  }

  public static void main(String[] args) throws FileNotFoundException {
    new Main().run();
  }

  private void run() throws FileNotFoundException {

    //new FileInputStream(new File("input.txt"))
    //
    try (InputReader in = new InputReader(System.in);
         PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }

  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {
    }
  }

}

import java.lang.*;
import java.util.Scanner;

public class Codeforces1 {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n, count = 0, count1 = 0;
        n = sc.nextInt();
        String s = new String();
        s = sc.next();
        for(int i = 0;i<s.length();i++)
        {
            if(i < (s.length()-1))
            {
                if(s.charAt(i) == 'S' && s.charAt(i+1) == 'F')
                {
                    count++;
                    // i++;
                }
                else if(s.charAt(i) == 'F' && s.charAt(i+1) == 'S')
                {
                    count1++;
                    // i++;
                }
            }
        }
        if(count > count1)
            System.out.print("Yes");
        else
            System.out.print("No");
    }
}

import static java.lang.Math.*;
import static java.util.Arrays.* ;

import java.util.*;
import java.io.*;

public class K
{

    void main() throws Exception
    {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt() ;
        char [] s = sc.next().toCharArray() ;
        int cnt []= new int [2] ;
        for(int i = 0 ; i < n  - 1; i ++)
        {
            if(s[i] == 'S' && s[i + 1] == 'F')
                cnt[0] ++ ;
            else if(s[i] == 'F' && s[i + 1] == 'S')
                cnt[1] ++ ;
        }
        if(cnt[0] > cnt[1])
            System.out.println("YES");
        else
            System.out.println("NO");

        out.flush();
        out.close();
    }

    class Scanner
    {
        BufferedReader br;
        StringTokenizer st;

        Scanner(InputStream in)
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws Exception
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        String nextLine() throws Exception
        {
            return br.readLine() ;
        }
        int nextInt() throws Exception { return Integer.parseInt(next()); }

        long nextLong() throws Exception { return Long.parseLong(next()); }

        double nextDouble() throws Exception { return Double.parseDouble(next());}
    }

    public static void main (String [] args) throws Exception
    {
        new K().main();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Date;
import java.util.HashMap;
import java.util.Map ;
import javafx.util.converter.IntegerStringConverter;
    public class Codeforces {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
          FastReader console = new FastReader () ;
          int n = console.nextInt() ;
          String x = console.next() ;
          String s = "" ;
          int counts = 0 ;
          int countf = 0 ;
         for (int i=0 ; i+1<n ; i++)
         {
             s+=x.charAt(i) ;
             s+=x.charAt(i+1) ;
             if (s.length()==2)
             {
                 if (s.equals("SF"))
                 {
                     counts ++ ;
                     s="" ;
                 }
                 else if (s.equals("FS"))
                 {
                     countf ++ ;
                     s="" ;
                 }
                 else
                 {
                     s="" ;
                 }
             }
         }
         if (counts>countf)
         {
             System.out.println("YES");
         }
         else
         {
             System.out.println("NO");
         }
       }
 }
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;
 public class prob{
     public static void main(String args[]){

  int fs=0;
  int sf=0;
   Scanner sc=new Scanner(System.in);
  int k=sc.nextInt();
  String d;
  d=sc.next();

  for(int m=0;m<d.length()-1;m++)
  {
      if((d.charAt(m)=='F')&&(d.charAt(m+1)=='S'))
      {
       fs++;
      }
      if((d.charAt(m)=='S')&&(d.charAt(m+1)=='F'))
      {
          sf++;
      }
  }
  if(sf>fs)
  {
      System.out.println("Yes");
  }
  else
  {
      System.out.println("NO");
  }
 }
}

import java.util.Scanner;
public class BetweenTheOffices {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		if(n==1){System.out.println("NO");}
		else{
		if(str.charAt(0)=='S'&&str.charAt(n-1)=='F'){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		sc.close();
	}
	}
}

import java.util.Scanner;

public class A {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String c =sc.next();
        int san=0;
        int sie=0;
        for (int i = 0; i < n-1; i++) {
            char cur = c.charAt(i);
            char nex = c.charAt(i+1);
            if(cur=='F'&&nex=='S') san++;
            if(cur=='S'&&nex=='F') sie++;
        }
        if(san<sie) System.out.println("YES");
        else System.out.println("NO");
    }
}

import java.util.*;
import java.io.*;

public class Solution {

	static int countFreq(String pat, String txt) {
        int M = pat.length();
        int N = txt.length();
        int res = 0;

        for (int i = 0; i <= N - M; i++) {
        	int j;
            for (j = 0; j < M; j++) {
                if (txt.charAt(i + j) != pat.charAt(j)) {
                    break;
                }
            }

            if (j == M) {
                res++;
                j = 0;
            }
        }
        return res;
    }

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		String str = scan.next();

		int sf = countFreq("SF",str);
		int fs = countFreq("FS",str);

		if(sf > fs)
			System.out.println("YES");
		else
			System.out.println("NO");

		scan.close();
	}
}

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String args[]) throws FileNotFoundException {
        //Scanner in = new Scanner(new File("testcase.txt"));
    	Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    	int n = in.nextInt();
    	String s = in.next();
    	//The answer is "YES" if the first character of the given string is 'S' and the last character is 'F', otherwise it's "NO".
    	if(s.charAt(0) == 'S' && s.charAt(s.length()-1) == 'F') {
    		System.out.println("YES");
    	}
    	else {
    		System.out.println("NO");
    	}
    }
}

import java.util.Scanner;

public class A867 {
    public static void main(String q[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String seq=sc.next();
        int prev=seq.charAt(0);
        int sf=0,fs=0;
        for (int i=1;i<n;i++){
            if(prev==seq.charAt(i))
                continue;
            if(prev=='S' && seq.charAt(i)=='F')
                sf++;
            else
                fs++;
            prev=seq.charAt(i);
        }
        if(sf>fs)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.*;
final public class BetweenTheOffices
{
	public static void main(String args[])
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		String str=s.next();
		if(str.charAt(0)=='S'&&str.charAt(n-1)=='F')
			System.out.println("YES");
		else
			System.out.println("NO");
		s.close();
	}
}

//https://codeforces.com/problemset/problem/867/A

import java.io.PrintWriter;
import java.util.Scanner;

public class BetweenTheOffices {
    public static void main(String[] args) {
        // write your code here

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        in.nextLine();
        String str = in.nextLine();

        int count = 0;
        for (int i = 1; i < str.length(); i++) {
            if(str.charAt(i-1) == str.charAt(i)) continue;
            if(str.charAt(i-1) == 'S') count++;
            else count--;
        }

        if(count > 0) out.println("YES");
        else out.println("NO");

        in.close();
        out.close();
    }
}

import java.util.Scanner;

public class problem867A {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();//handle enter key;

        String s = input.nextLine();
        int x = 0;

        for (int i = 1; i < n; i++) {
            if ((s.charAt(i - 1) == 'S') && (s.charAt(i) == 'F')) {

                x++;

            } else if ((s.charAt(i - 1) == 'F') && (s.charAt(i) == 'S')) {
                x--;
            }
        }
        //decide he is in home or not
        if (x > 0) {
            System.out.println("YES");
        } else {

            System.out.println("No");
        }

    }
}

import java.util.Scanner;

public class Near_Apllication {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		in.nextInt();
		String s=in.next();
		System.out.println((s.charAt(s.length()-1)=='F' && s.charAt(0)=='S')==true?"YES":"NO");
		/*System.out.println(s.charAt(0));
		System.out.println((s.charAt(s.length()-1)));*/
	}
}

import java.util.Scanner;

public class BetweentheOffices {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		String input = scn.next();
		int fCount = 0;
		int sCount = 0;
		for (int i = 0; i < n - 1; i++) {
			if (input.charAt(i) == 'F' && input.charAt(i + 1) == 'S') {
				fCount++;
			} else if (input.charAt(i) == 'S' && input.charAt(i + 1) == 'F') {
				sCount++;
			}
		}
		if (sCount > fCount)
			System.out.println("YES");
		else
			System.out.println("NO");

	}
}

import java.util.Scanner;
public class flightsfs {
	public static void main(String [] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String[] c = s.next().split("");

		int FS = 0;//SF to seattle
		int SF = 0;//seattle to SF

		for (int i = 0; i < n - 1; i++) {
			if (c[i].equals("S") && c[i + 1].equals("F")) SF++;
			else if (c[i].equals("F") && c[i + 1].equals("S")) FS++;
		}

		if (SF>FS) System.out.println("YES"); else System.out.println("NO");

	}
}

import java.util.*;
public class P867A
{
  public static void main(String[] args) {

    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    String s = in.next();
    int S = 0,F = 0;
    for(int i=0;i<n-1;i++)
    {
      if(s.charAt(i) == 'S' && s.charAt(i+1) == 'F')
        S++;
      else if(s.charAt(i) == 'F' && s.charAt(i+1) == 'S')
        F++;
    }

    if(S>F)
      System.out.println("YES");
    else
      System.out.println("NO");
  }
}

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.nextLine();
        char[] arr = sc.nextLine().toCharArray();

        char f = arr[0];
        int c = 0;
        int b = 0;
        for (int i = 1; i < arr.length; i++) {
            if(f == 'S' && arr[i] == 'F')
                c++;
            if(f == 'F' && arr[i] == 'S')
                b++;

            f = arr[i];

        }

        System.out.println(c>b ? "YES" :"NO");
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author viatsko
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();

      int sToF = 0;
      int fToS = 0;

      char state = ' ';

      String line = in.next();

      for (char ch : line.toCharArray()) {
        if (state == 'S' && ch == 'F') {
          sToF++;
        } else if (state == 'F' && ch == 'S') {
          fToS++;
        }

        state = ch;
      }

      out.print(sToF > fToS ? "YES" : "NO");
    }
  }
}

import java.util.Scanner;

public class Solution {

	int countS = 0;
	int countF = 0;

	void solve(Scanner in) {
		int n = in.nextInt();
		String s = in.next();
		for (int i = 1; i < n; ++i) {
			if (s.charAt(i - 1) != s.charAt(i)) {
				if (s.charAt(i - 1) == 'S') {
					countS++;
				} else {
					countF++;
				}
			}

		}
		if (countS <= countF)
			System.out.println("NO");
		else
			System.out.println("YES");

	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		new Solution().solve(in);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * BetweenTheOffices
 */
public class BetweenTheOffices {

  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    String s = br.readLine();
    int s_f = 0;
    int f_s = 0;
    for (int i = 1; i < n; i++) {
      if (s.charAt(i - 1) > s.charAt(i))
        s_f++;
      else if (s.charAt(i - 1) < s.charAt(i))
        f_s++;

    }
    if (s_f > f_s)
      System.out.println("YES");
    else
      System.out.println("NO");
  }
}

import java.util.Scanner;

public class BetweenTheOffices {

	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		int n = scan.nextInt();
		scan.nextLine();
		String s = scan.nextLine();
		int so=0,sf=0;
		for(int i=1;i<n;i++)
		{
			if(s.charAt(i)=='F' && s.charAt(i-1)=='S')
			{
				so++;
			}
			else if(s.charAt(i)=='S' && s.charAt(i-1)=='F')
			{
				sf++;
			}
		}
		if(so>sf)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

}

import java.util.*;

public class BetweenTheOffices {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    String line = s.next();
    char pos = line.charAt(0);
    int numFlightsToS = 0;
    int numFlightsToF = 0;
    for (int i = 1; i < line.length(); ++i) {
      if (line.charAt(i) != pos) {
        if (pos == 'F') {
          ++numFlightsToS;
        } else {
          ++numFlightsToF;
        }
        pos = line.charAt(i);
      }
    }
    System.out.println(numFlightsToF > numFlightsToS ? "YES" : "NO");
  }
}

import java.util.*;
public class offices
{
	public static void main(String arg[])
	{
		int n,se=0,f=0,i,l;
		String s;

		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		s=sc.next();
		l=s.length()-1;
		for(i=0;i<l;i++)
		{
			char ch = s.charAt(i);
			if(ch=='S')
			{
				char c = s.charAt(i+1);
				if(c=='F')
					se++;}

				else if(ch=='F')
				{
					char c=s.charAt(i+1);
					if(c=='S')
						f++;
				}
			}
				if(f<se)
			System.out.println("YES");
		else
		System.out.println("NO");

	}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner inputReader = new Scanner(System.in);
        int numberOfCharacters = Integer.parseInt(inputReader.nextLine());
        String inputString = inputReader.nextLine();
        int[] frequencyArray = new int[2]; //1st is from SF to SEA, 2nd is from SEA to SF
        char curChar = inputString.charAt(0);
        //System.out.println("curchar initial " + curChar);
        for (int i = 1; i < inputString.length(); i++) {
            if (curChar != inputString.charAt(i)) {
                if (curChar == 'F') {
                    frequencyArray[0]++;
                } else {
                    frequencyArray[1]++;
                }
                curChar = inputString.charAt(i);
            }

        }
        //System.out.println(frequencyArray[0] + " " + frequencyArray[1]);
        if (frequencyArray[1] > frequencyArray[0]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;

public class BetweenTheOffices {

	public static void main(String[] args) {
		new BetweenTheOffices().process();
	}

	private void process() {
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
			reader.readLine();

			char[] array = reader.readLine().toCharArray();
			int sf = 0;
			int fs = 0;

			int prev = array[0];
			for (int i = 1; i < array.length; i++) {
				if (array[i] != prev) {
					if (array[i] == 'S') {
						fs++;
					} else {
						sf++;
					}
					prev = array[i];
				}
			}

			if (sf > fs) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} catch (IOException e) {
			throw new UncheckedIOException(e);
		}
	}
}

import java.util.Scanner;

public class BetweenTheOffices {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int StoF = 0;
		int FtoS = 0;
		boolean moreStoF = false;
		String str = sc.next();

		char chr[] = new char[n];

		int len = str.length();

		for(int i =0; i<len; i++) {
			chr[i] = str.charAt(i);
		}
			for(int i=0; i<len-1; i++) {

				if(chr[i]== 'S') {
					if(chr[i+1]=='F') {
						StoF += 1;
					}
				}
					if(chr[i]== 'F') {
						if(chr[i+1]== 'S') {
							FtoS += 1;
						}
					}
			}
						if(StoF > FtoS) {
							moreStoF = true;
						}
								if(moreStoF) System.out.println("YES");
								else System.out.println("NO");
	}

}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String s = sc.nextLine();
        int sf = 0;
        int fs = 0;
        for (int i = 0; i < n - 1; i++) {
            if (s.charAt(i) == 'S' && s.charAt(i + 1) == 'F') {
                sf++;
            }
            if (s.charAt(i) == 'F' && s.charAt(i + 1) == 'S') {
                fs++;
            }
        }
        if (sf > fs) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    private static void solve(int[] a, int b, int idx) {
        int res = 0 ;
        Arrays.sort(a);
        int spend = 0;
        for(int i = 0; i < a.length; i++) {
            spend += a[i];
            if (spend <= b) {
                res++;
            } else {
                break;
            }
        }
        System.out.println("Case #"+idx+": " +res);
    }

}

/**
 * B W B
 * B W B
 * B W W
 * B W W
 *
 * 5 * (3 / 2 + 1
 * B W
 * B W
 * B B
 * B B
 *
 *
 * B W B W
 * W W B B
 * B W B B
 *
 * B W B W B
 * B W B W W
 * B W B W B
 *
 */

/**
 *
 *  1,2,3
 **/

import java.util.*;

public class Offices{
    public static void main(String[] args){

      Scanner yay = new Scanner(System.in);
      int days = yay.nextInt();
	  String offices = yay.next();
	  offices = offices.toUpperCase();
	  String temp = offices;
	  offices = offices.replace("SF","X");
	  temp = temp.replace("FS","Y");

	  int x = 0;
	  int y = 0;

	  for(int i = 0; i<offices.length(); i++){
	  	if(offices.charAt(i) == 'X'){
	  		x++;
	  	}
	  }
	  for(int i = 0; i<temp.length(); i++){
	  	if(temp.charAt(i) == 'Y'){
	  		y++;
	  	}
	  }

	if(x>y){
		System.out.println("YES");

	}else if(y > x){
		System.out.println("NO");

	}else{
		System.out.println("NO");
	}

    }
}

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        scan.nextLine();
        var locationOnDay = scan.nextLine().split("(?!^)");

        int count= 0;
        for(int day = 1; day < locationOnDay.length; day++){
            if(!locationOnDay[day].equals(locationOnDay[day -1])){
                count += locationOnDay[day].equals("S") ? -1 : 1;
            }
        }
        System.out.println(count > 0 ? "YES" : "NO");
    }
}

    import java.util.Scanner;

    /**
     *
     * @author Tareq
     */
    public class Code {
     public  static void p (int c){
         if(c>=1){
             System.out.println("YES");}else{

             System.out.println("NO");
         }

              }

        public static void main(String[] args) {
         Scanner sc = new Scanner(System.in);

         int n =sc.nextInt();

     sc.nextLine();
   String s =sc.nextLine();

     int c =0;
     int c1 =0;

     for(int i =0 ;i<s.length()-1;i++){

       if(s.charAt(i)=='S'&&s.charAt(i+1)=='F'){
           c++;
       }
       if(s.charAt(i)=='F'&&s.charAt(i+1)=='S'){
           c1++;
       }

     }
         if(c>c1){
             System.out.println("YES");
         }else{

             System.out.println("NO");
         }

        }}

import java.lang.reflect.Array;
import java.util.*;

public class div {
    private static Scanner sc = new Scanner(System.in);
    private static Map<Character, Integer> m = new HashMap<>();
    private static List<Integer> l = new ArrayList<>();

    public static void main(String[] args) {
        int n = sc.nextInt();
        int s = 0, f = 0;
        sc.nextLine();
        String str = sc.nextLine();

        for (int i = 0; i < str.length() - 1; i++) {
            if (str.charAt(i) == 'S' && str.charAt(i + 1) == 'F'){
                f++;
            }
            if (str.charAt(i) == 'F' && str.charAt(i + 1) == 'S'){
                s++;
            }

        }

        if (f > s) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.lang.*;
import java.util.*;
import java.io.*;
public class A{
    static class Reader
    {
        private BufferedReader br;
        private StringTokenizer stkz;
        public Reader()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
            stkz = null;
        }
        String next()
        {
            while (stkz == null || !stkz.hasMoreElements())
            {
                try
                {
                    stkz = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return stkz.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args){
        Reader in = new Reader();
        int n = in.nextInt();
        String str = in.nextLine();
        if(str.charAt(0) == 'S' && str.charAt(str.length()-1)=='F')
            System.out.println("YES");
        else
            System.out.println("NO");

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class codeforces
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String args[])
    {
FastReader fastReader=new FastReader();
int n=fastReader.nextInt();

{
    String s;
    s=fastReader.next();

    if(s.charAt(0)=='S'&&s.charAt(n-1)=='F')
    {
        System.out.println("YES");
    }
    else
    {
        System.out.println("NO");
    }
}

    }
}

import java.util.Scanner;

public class CF2
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        int SF = 0;
        int FS = 0;
        for(int i = 0; i < s.length() - 1; i++)
        {
            if(s.charAt(i) == 'S' && s.charAt(i + 1) == 'F')
                SF++;
            if(s.charAt(i) == 'F' && s.charAt(i + 1) == 'S')
                FS++;
        }
        if(SF > FS)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Created by fengp on 10/8/17.
 */
public class Main {

    public static void main(String[] args) {

        InputStream input = System.in;
        PrintStream output = System.out;
        if (args.length == 2) {
            try {
                input = Main.class.getClassLoader().getResourceAsStream(args[0]);
                output = new PrintStream(args[1]);
            } catch (IOException e) {
                e.printStackTrace();
                return;
            }
        }
        Scanner in = new Scanner(input);
        while (in.hasNextInt()) {
            int a;
            a = in.nextInt();
            String b;
            b = in.next();
            output.println(String.format("%s",b.startsWith("S")&&b.endsWith("F")?"YES":"NO"));
        }
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;

public class A {
	//author: Nagabhushan S Baddi

	private static int n;
	private static long[] a;
	private static long d;
	private static String s;
	private static HashMap<Integer, ArrayList<Integer>> g;

	public static void main(String[] args) {
		n = ini();
		s = ins();

		int count1 = 0;
		int count2 = 0;

		for(int i=1; i<n; i++) {
			if (s.charAt(i)=='S' && s.charAt(i-1)=='F') {
				count1++;
			} else if (s.charAt(i)=='F' && s.charAt(i-1)=='S') {
				count2++;
			}
		}

		println(count2>count1?"YES":"NO");

		out.flush();
		out.close();

	}

	//CONSTANTS
	private static final int MOD = (int) 1e9 + 7;

	//NONPROBLEM CODE

	private static InputReader in = new InputReader(System.in);
	private static PrintWriter out = new PrintWriter(System.out);

	private static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

	//SORT SHORTCUTS

	private static void sort(int[] a) {
		int n = a.length;
		Integer[] b = new Integer[n];
		for (int i = 0; i < n; i++) {
			b[i] = a[i];
		}

		Arrays.sort(b);

		for (int i = 0; i < n; i++) {
			a[i] = b[i];
		}
	}

	private static void sort(long[] a) {
		int n = a.length;
		long[] b = new long[n];
		for (int i = 0; i < n; i++) {
			b[i] = a[i];
		}

		Arrays.sort(b);

		for (int i = 0; i < n; i++) {
			a[i] = b[i];
		}
	}

	//INPUT SHORTCUTS

	private static int[] ina(int n) {
		int[] temp = new int[n];
		for (int i = 0; i < n; i++) {
			temp[i] = in.nextInt();
		}
		return temp;
	}

	private static int ini() {
		return in.nextInt();
	}

	private static long inl() {
		return in.nextLong();
	}

	private static String ins() {
		return in.readString();
	}

	//PRINT SHORTCUTS

	private static void println(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
		out.write("\n");
	}

	private static void pd(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
		out.flush();
		out.write("\n");
	}

	private static void print(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
	}

	//GRAPH SHORTCUTS

	private static HashMap<Integer, ArrayList<Integer>> intree(int n) {

		HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();
		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < n - 1; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			g.get(u).add(v);
			g.get(v).add(u);
		}

		return g;
	}

	private static HashMap<Integer, ArrayList<Integer>> ingraph(int n, int m) {
		HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();

		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < m; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			g.get(u).add(v);
			g.get(v).add(u);
		}

		return g;

	}

	private static HashMap<Integer, ArrayList<Edge>> inweightedgraph(int n, int m) {
		HashMap<Integer, ArrayList<Edge>> g = new HashMap<>();

		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < m; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			int w = ini();
			Edge edge = new Edge(u, v, w);
			g.get(u).add(edge);
			g.get(v).add(edge);
		}

		return g;

	}

	private static class Edge implements Comparable<Edge> {
		private int u, v;
		private long w;

		public Edge(int a, int b, long c) {
			u = a;
			v = b;
			w = c;
		}

		public int other(int x) {
			return (x == u ? v : u);
		}

		public int compareTo(Edge edge) {
			return Long.compare(w, edge.w);
		}
	}

	private static class Pair {
		private int u, v;

		public Pair(int a, int b) {
			u = a;
			v = b;
		}

		public int hashCode() {
			return u + v + u * v;
		}

		public boolean equals(Object object) {
			Pair pair = (Pair) object;
			return u == pair.u && v == pair.v;
		}
	}

	private static class Node implements Comparable<Node> {
		private int u;
		private long dist;

		public Node(int a, long b) {
			u = a;
			dist = b;
		}

		public int compareTo(Node node) {
			return Long.compare(dist, node.dist);
		}
	}

	//MATHS AND NUMBER THEORY SHORTCUTS

	private static int gcd(int a, int b) {
		//O(log(min(a,b)))
		if (b == 0)
			return a;

		return gcd(b, a % b);
	}

	private static long modExp(long a, long b) {
		if (b == 0)
			return 1;

		a %= MOD;

		long exp = modExp(a, b / 2);

		if (b % 2 == 0) {
			return (exp * exp) % MOD;
		} else {
			return (a * ((exp * exp) % MOD)) % MOD;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BtwTheOffice {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String s = br.readLine();
        int count1 = (s.split("SF", -1).length) - 1;
        int count2 = (s.split("FS", -1).length) - 1;
        if(count1>count2){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;
import java.util.Arrays;
public class Main
{
	public static void main(String[] args) {
	   Scanner s=new Scanner(System.in);
	   int n=s.nextInt();
	   String y=s.next();
	   if(y.charAt(0)=='S'&&y.charAt(y.length()-1)=='F')
	   System.out.println("yes");
	   else
	   System.out.println("no");}}

import java.util.Scanner;

/**
 *
 * @author Mahmoud
 */
public class Exc {

public static void main( String[] args )
 {

     Scanner sc =new Scanner(System.in);

     int x  = sc.nextInt();
     String s = sc.next();
     int sfIndex = 0, fsIndex = 0, sfCount = 0,fsCount = 0;
     while( sfIndex+1 < s.length())
     {
     sfIndex = s.indexOf("SF", sfIndex);
     fsIndex  = s.indexOf("FS", fsIndex);

     if(sfIndex != -1)
     {
     sfCount++;
     sfIndex+=2;
     }

     if(fsIndex != -1)
     {
     fsCount++;
     fsIndex+=2;
     }

     if(sfIndex == -1 && fsIndex == -1)
     {
     break;
     }

     }

     System.out.println((sfCount > fsCount)? "YES":"NO");

 }
}

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int f = 0, se = 0;
		for(int i=1; i<n; i++){
			if(s.charAt(i) == 'F' && s.charAt(i-1) == 'S')
				se++;
			else if(s.charAt(i) == 'S' && s.charAt(i-1) == 'F')
				f++;
		}
		if(f >= se)
			System.out.println("NO");
		else
			System.out.println("YES");
	}
}

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Solution {
  private static String hasMoreFlightsFromSeatleToFaransisco(String str){
    int SF = 0;
    int FS = 0;

    for(int i=0;i<str.length();i++){
      //char current = str.charAt(i);
      if(i !=0 && str.charAt(i) !=  str.charAt(i-1)){
        if(str.charAt(i) == 'F') SF++;
        else FS++;
      }
    }
    return SF > FS ? "YES":"NO";
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    sc.nextLine(); System.out.println(hasMoreFlightsFromSeatleToFaransisco(sc.nextLine()));
  }
}

import jdk.swing.interop.SwingInterOpUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class prac1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String a=br.readLine();
//        System.out.println(a);
        if(n==0)
        {
            System.out.println("NO");
        }
        else
        {
            int count=0;
            for(int i=1;i<n;i++)
            {
//                System.out.println("iter: "+(i+1));
                if(a.charAt(i)==a.charAt(i-1))
                    continue;
//                System.out.println("wrong");
                if(a.charAt(i)=='F')
                    count++;
                else
                    count--;
            }
            if(count>0)
                System.out.println("YES");
            else
                System.out.println("NO");
        }

    }
}

import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        int n = scanner.nextInt();
        scanner.nextLine();
        String input = scanner.nextLine();
        int[] counter = new int[2]; // index 0 for SF and 1 for Seattle
        char previous = input.charAt(0);
        int idx = previous == 'S' ? 0 : 1;
        for (int i = 1; i < n; i++) {
            char current = input.charAt(i);
            if (current != previous) {
                previous = current;
                counter[idx]++;
                idx = (idx + 1) % 2;
            }
        }
        System.out.println(counter[0] > counter[1] ? "YES" : "NO");

    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();

        String data = in.next();
        int result = 0;

        for (int i=0; i < num; i++){
            if(i!=0){
                if(data.charAt(i-1) == 'S' && data.charAt(i) == 'F'){
                    result++;
                }else if(data.charAt(i-1) == 'F' && data.charAt(i) == 'S'){
                    result = result -1;
                }
            }
        }

        if(result > 0){
            System.out.print("YES");
        }else {
            System.out.print("NO");
        }

    }
}

//package hiougyf;
import java.util.*;
//import java.lang.instrument.*;
import java.math.*;
import java.io.*;
public class codeforces {
	  public static void main  (String[] args)
	  	{
		  	Scanner sc =new Scanner(System.in);
		  	int n=sc.nextInt();
		    char a[]=new char[n];
		    String s=sc.next();
		    a=s.toCharArray();
		    int a1=0;
		    int a2=0;
		    Stack<Character> d=new Stack<>();
		    d.add(a[0]);
		    for(int i=1;i<n;i++) {
		    	if(a[i]!=d.peek()&&a[i]=='S') {
		    	    d.add(a[i]);
		    		a2++;
		    		continue;
		    	}
		    	if(a[i]!=d.peek()&&a[i]=='F') {
		    		a1++;
		    		d.add(a[i]);
		    		continue;
		    	}
		    	d.add(a[i]);
		    }
		    if(a1>a2) System.out.println("YES");
		    else System.out.println("NO");
		  	}

}

//problem: https://codeforces.com/problemset/problem/867/A

import java.util.Scanner;
public class BetweenOffice{
    public static void main(String[] args){
        Scanner sObj = new Scanner(System.in);
        int days = Integer.parseInt(sObj.nextLine());
        char[] cities = sObj.nextLine().toCharArray();
        char curr, prev = cities[0];
        int StoF=0;
        int FtoS=0;
        for(int i=1; i<days; i++){
            curr = cities[i];
            if(curr==prev){
                continue;
            }
            if(curr=='S' && prev=='F'){
                FtoS++;
            }
            else{
                StoF++;
            }
            prev = curr;
        }
        if(FtoS>=StoF){
            System.out.printf("No");
        }
        else{
            System.out.printf("Yes");
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String str = s.next();
        if (str.charAt(0) == 'S' && str.charAt(str.length() - 1) == 'F') {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException{
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
            int n=Integer.parseInt(br.readLine());
            String str=br.readLine();

            if(str.charAt(0)=='S' && str.charAt(str.length()-1)=='F')
                bw.write("YES\n");
            else
                bw.write("NO\n");
            /*int[] arr=new int[4];
           int n=Integer.parseInt(str[0]);
           int m=Integer.parseInt(str[1]);
              int k=Integer.parseInt(str[2]);
          if(n<=(int )Math.min(m,k))
            bw.write("YES\n");
            else
          bw.write("NO\n");

           */
             bw.flush();
	}

}

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int n,i,a=0,b=0;
		n=s.nextInt();
		String S=s.next();
		for(i=0;i<(n-1);i++)
		{
	if(S.charAt(i)=='S'&&S.charAt(i+1)=='F')
	a++;
	if(S.charAt(i)=='F'&&S.charAt(i+1)=='S')
	b++;
		}
		if(a>b)
		System.out.println("YES");
		else
		System.out.println("NO");
	}
}

import java.util.Scanner;

public class A_Between_the_Offices{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int yes = 0;
        int no = 0;
        String val = in.next();
        for(int i=0;i<val.length()-1;i++){
            if(val.charAt(i)=='S' && val.charAt(i+1)=='F')
                ++yes;
            else if(val.charAt(i)=='F' && val.charAt(i+1)=='S')
                ++no;
            else {
                continue;
            }
        }
        if(yes>no)
            System.out.println("YES");
        else
            System.out.println("NO");
        in.close();
    }
}

  import java.io.*;
            import java.util.*;

            public class BtoO
            {
                  public static void main(String[] args)
                  {
                        Scanner sc = new Scanner(System.in);

                        int n = sc.nextInt();
                        String s = sc.next();
                        char[] ch = s.toCharArray();

                        int fs = 0;
                        int sf = 0;

                        for(int i=0;i<s.length()-1;i++)
                        {
                              if(ch[i] == 'F' && ch[i+1] == 'S')
                              {
                                    fs++;
                              }
                              if(ch[i] == 'S' && ch[i+1] == 'F')
                              {
                                    sf++;
                              }
                        }

                        if(sf > fs)
                        {
                              System.out.println("YES");
                        }
                        else
                        {
                              System.out.println("NO");
                        }

                  }
            }

// 867A - Between the offices

import java.util.*;
public class betweenTheOffices {
	public static void main(String[] args) {
		int n = 0;
		String s = "";
		Scanner scan = new Scanner(System.in);

			String tempVar = scan.next();

			if (tempVar != null) {
				n = Integer.parseInt(tempVar);
			}

			String tempVar2 = scan.next();
			if (tempVar2 != null) {
				s = tempVar2;
			}

			int ans1 = 0;
			int ans2 = 0;

			for (int i = 1;i < n;i++) {

				if (s.charAt(i - 1) == 'S' && s.charAt(i) == 'F') {
					ans1++;
				}

				if (s.charAt(i - 1) == 'F' && s.charAt(i) == 'S') {
					ans2++;
				}
			}

			if (ans1 > ans2){
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        s.nextLine();
        int SF=0,FS=0;
        String t = s.nextLine();
        for(int i=0; i<x-1; i++){
            if(t.charAt(i)=='S'&&t.charAt(i+1)=='F') SF++;
            else if(t.charAt(i)=='F'&&t.charAt(i+1)=='S') FS++;
        }
        if(SF>FS) System.out.println("YES");
        else System.out.println("NO");
    }
}

import java.util.*;

public class solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String inp = sc.nextLine();
        int f = 0, s = 0;
        for (int i = 0; i < n; i++) {
            if (inp.charAt(i) == 'F') {
                if ((i != n - 1) && inp.charAt(i + 1) == 'S')
                    s++;

            } else {
                if ((i != n - 1) && inp.charAt(i + 1) == 'F')
                    f++;

            }

        }
        if (f > s)
            System.out.println("YES");
        else
            System.out.println("NO");

    }
}

/* JAVA TEMPLATE
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int cases = in.nextInt();
        String space = in.nextLine();

        // Solve each test case
        for (int i=1; i<cases+1; i++) {
            solve(i, in);
        }
    }

    public static void solve(int i, Scanner in) {

    }
}
*/

/* PROBLEM A
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int cases = in.nextInt();
        String space = in.nextLine();

        // Solve each test case
        for (int i=1; i<cases+1; i++) {
            solve(i, in);
        }
    }

    public static void solve(int i, Scanner in) {
     int num = in.nextInt();

     if (num < 3) {
         System.out.println(0);
         return;
     }

     int a, b;

     if (num % 2 == 0) {
         a = num / 2 + 1;
         b = num / 2 - 1;
     }
     else {
         a = (int) Math.floor(num / 2) + 1;
         b = (int) Math.floor(num / 2);
     }

     System.out.println(b);

    }
}
*/

/* PROBLEM B
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int cases = in.nextInt();
        String space = in.nextLine();

        // Solve each test case
        for (int i=1; i<cases+1; i++) {
            solve(i, in);
        }
    }

    public static void solve(int i, Scanner in) {
        int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), duplicates = a - b;

        ArrayList<Character> arr = new ArrayList<Character>();

        char currentChar = 'a';
        StringBuffer sb = new StringBuffer();

        for (int j=0; j<b; j++) {
            sb.append((char) (currentChar + j));
            arr.add((char) (currentChar + j));
        }

        for (int j=0; j<duplicates; j++) {
            sb.append((char) (currentChar + b - 1));
            arr.add((char) (currentChar + b - 1));
        }

        for (int j=a; j<n; j++) {
            char lastChar = arr.remove(0);
            sb.append(lastChar);
            arr.add(lastChar);
        }

        String str = sb.toString();
        System.out.println(str);
    }
}
*/

/* PROBLEM C
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int cases = in.nextInt();
        String space = in.nextLine();

        // Solve each test case
        for (int i=1; i<cases+1; i++) {
            solve(i, in);
        }
    }

    public static void solve(int i, Scanner in) {
        int students = in.nextInt();

        int scores[] = new int[students];

        for (int j=0; j<students; j++) {
            scores[j] = 0;
        }

        for (int j=0; j<students; j++) {
            int ability = in.nextInt();
            scores[ability - 1]++;
        }

        int maxDuplicates = 0;
        int unique = 0;

        for (int j=0; j<students; j++) {
            if (scores[j] > 0) {
                unique++;
                if (scores[j] > maxDuplicates) {
                    maxDuplicates = scores[j];
                }
            }
        }

        if (unique >= maxDuplicates) {
            unique--;
        }

        if (unique < maxDuplicates) {
            System.out.println(unique);
        } else {
            System.out.println(maxDuplicates);
        }
    }
}
*/

/* PROBLEM D
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int cases = in.nextInt();
        String space = in.nextLine();

        // Solve each test case
        for (int i=1; i<cases+1; i++) {
            solve(i, in);
        }
    }

    public static void solve(int i, Scanner in) {
        int sudoku[][] = new int[9][9];

        for (int j=0; j<9; j++) {
            String[] integerString = Integer.toString(in.nextInt()).split("");
            for (int k = 0; k < 9; k++) {
                sudoku[j][k] = Integer.parseInt(integerString[k]);
            }
        }
    }
}
*/

// import java.util.*;
// import java.io.*;

// public class Solution {
//     public static void main(String[] args) {
//         Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
//         int cases = in.nextInt();
//         String space = in.nextLine();

//         // Solve each test case
//         for (int i=1; i<cases+1; i++) {
//             solve(i, in);
//         }
//     }

//     public static void solve(int i, Scanner in) {
//         int n = in.nextInt();

//         int arr[] = new int[n];
//         int memory[] = new int[n];
//         Arrays.fill(memory, 0);

//         for (int j=0; j<n; j++) {
//             arr[j] = in.nextInt();
//             memory[arr[j]] = 1;
//         }

//         if (n < 3) {
//             System.out.println(1);
//             return;
//         }

//         int indexOne = 0, indexTwo = 1, count = 0, maxCount = 0;
//         while (indexOne < n - 1) {
//             while (indexTwo < n) {
//                 if (arr[indexOne] == arr[indexTwo]) {
//                     count += 2;
//                     indexOne++;
//                     indexTwo++;
//                 }
//             }
//             if (count > maxCount) {

//             }
//         }
//     }
// }

/* A. Between the Offices */
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        // int cases = in.nextInt();

        // // Solve each test case
        // for (int i=1; i<cases+1; i++) {
        //     solve(i, in);
        // }
        solve(1, in);
    }

    public static void solve(int i, Scanner in) {
        int size = in.nextInt();
        String letters[] = in.next().split("", size);
        String current = letters[0];

        int seattleToSF = 0, sfToSeattle = 0;
        for (int j=0; j<size-1; j++) {
            if (!current.equals(letters[j+1]) && current.equals("S")) {
                seattleToSF++;
                current = letters[j+1];
            } else if (!current.equals(letters[j+1]) && current.equals("F")) {
                sfToSeattle++;
                current = letters[j+1];
            }
        }
        if (seattleToSF > sfToSeattle) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = in.nextInt();
        String s = in.next();
        int sea=0;
        int feran=0;
        for(int i=0 ; i<count-1 ; i++){
            if(s.charAt(i)=='S' && s.charAt(i+1)=='F')
                sea++;
            else if(s.charAt(i)=='F' && s.charAt(i+1)=='S')
                feran++;
        }
        if(sea>feran)
            System.out.print("YES");
            else System.out.print("NO");
    }
}

import java.util.Scanner;

public class WS {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    input.nextLine();
    String s = input.nextLine();
    int count = 0;
    for(int i = 1; i < s.length(); i++) {
      char a = s.charAt(i-1);
      char b = s.charAt(i);
      if(a != b) {
        if(a == 'S' && b == 'F') {
          count++;
        } else {
          count--;
        }
      }
    }
    if(count > 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

import java.util.*;
public class offices
{
	public static void main(String arg[])
	{
		int n,se=0,f=0,i,l;
		String s;

		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		s=sc.next();
		l=s.length()-1;
		for(i=0;i<l;i++)
		{
			char ch = s.charAt(i);
			if(ch=='S')
			{
				char c = s.charAt(i+1);
				if(c=='F')
					se++;
				else
					f++;
			}
		}
		if(f<se)
			System.out.println("YES");
		else
		System.out.println("NO");

	}
}

import java.util.Scanner;
public class Solution {

	private static Scanner s;

	public static void main(String[] args) {
		s = new Scanner(System.in);
		int n=s.nextInt();
		String string=s.next();
		char current_location=string.charAt(0);
		int i=1;
		int s_to_f=0;
		int f_to_s=0;
		while (i<string.length())
		{
			char c=string.charAt(i);
			if (c==current_location)
			{
				i++;
			}
			else if(current_location=='S' && c=='F')
			{
				s_to_f++;
				i++;
			}
			else
			{
				f_to_s++;
				i++;
			}
		}

		if (s_to_f>f_to_s)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

}

import java.io.*;

public class A867 {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String n = in.readLine();
        char input[] = in.readLine().toCharArray();
        System.out.println((input[0] == 'S' && input[input.length-1] == 'F') || (input[0] == 'F' && input[input.length-1] == 'S') ? "YES" : "NO");
    }
}

import java.util.*;
public class PSG {
    public static void main(String args[]) {
        Scanner in =new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int a = 0; int b = 0;
        for(int i = 1;i < n;i++){
            if(s.charAt(i)=='S' && s.charAt(i-1)=='F'){
                a++;
            }
            if(s.charAt(i-1)=='S' && s.charAt(i)=='F'){
                b++;
            }
        }
        if(a > b){
            System.out.print("NO");
        }
        else{
            System.out.print("YES");
        }
    }
}

import java.util.Scanner;

/**
 *
 * @author Akhilesh
 */
public class BetweenOffices867A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        String str = scan.next();

        char a = str.charAt(0), b;
        int yes = 0, no = 0;
        for(int i = 1; i < n; i++){
            b = str.charAt(i);

            if(a != b){
                if(b == 'F'){
                    yes++;
                }else
                    no++;
            }
        }

        if(yes > no)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String ch = sc.next();
	       String str = sc.next();
	       int f = 0, s = 0;

	       if(str.charAt(0) == 'F') {f = 1;}
	       if(str.charAt(0) == 'S') {s = 1;}

	       for(int i = 0; i < str.length() - 1; i++) {
				if(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {
					f++;
				}
				if(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {
					s++;
				}
			}

	       if(s < f) {
	    	   System.out.print("YES");
	       }
	       if(s > f) {
	    	   System.out.print("NO");
	       }
	       if(s == f) {
	    	   if(str.charAt(str.length()) == 'F') {System.out.print("NO");}
		       if(str.charAt(str.length()) == 'S') {System.out.print("YES");}
	       }
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Date;
import java.util.HashMap;
import java.util.Map ;
import javafx.util.converter.IntegerStringConverter;
    public class Codeforces {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
          FastReader console = new FastReader () ;
          int n = console.nextInt() ;
          String x = console.next() ;
          String s = "" ;
          int counts = 0 ;
          int countf = 0 ;
         for (int i=0 ; i<n ; i++)
         {
             s+=x.charAt(i) ;
             if (s.length()==2)
             {
                 if (s.equals("SF"))
                 {
                     counts ++ ;
                 }
                 else if (s.equals("FS"))
                 {
                     countf ++ ;
                 }
             }
             s="" ;
         }
         if (counts>countf)
         {
             System.out.println("YES");
         }
         else
         {
             System.out.println("NO");
         }
       }
 }
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforces;
import java.util.*;
/**
 *
 * @author Ashraf
 */
public class ContestPb1 {
    public static void main(String []args){
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        String receiveEnter=input.nextLine();
        String s=input.nextLine();
        char c[]=new char[120];
        char store;
        int flag1=0,flag2=0;
        c=s.toCharArray();
           store=c[0];
           for(int i=1;i<c.length;i++){
               if(c[i]==store) continue;
               else if(c[i]=='F'&&c[i]!=store){
                    flag1++;
               }
               else {
                   flag2++;
               }
           }
           if(flag1>flag2) System.out.println("YES");
           else System.out.println("NO");

        }
    }

import java.util.*;
public class Prog3
{
	public static void main(String[] main)
	{
		Scanner kbd = new Scanner(System.in);
		int n = 0, x = 0, y = 0;
		String length = "";
		n = Integer.parseInt(kbd.next());
		length = kbd.next();

		for(int i = 0; i < n-1; i++)
		{
			char temp = length.charAt(i);
			if(length.charAt(i+1) == '\0')
			{
				break;
			}
			else if((length.charAt(i) == 'F' || length.charAt(i) == 'f') && temp != length.charAt(++i))
			{
				y++;
			}
			else if((length.charAt(i) == 'S' || length.charAt(i) == 's') && temp != length.charAt(++i))
			{
				x++;
			}
			else
			{
			    continue;
			}

		}
		if(x>y)
		{
			System.out.println("YES");
		}
		else
		{
			System.out.println("NO");
		}
	}
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		String str;
		str = cin.nextLine();
		int a = 0;
		for (int i = 1; i <  str.length() ; i++)
			if (str.charAt(i) == 'F' && str.charAt(i-1) == 'S') a++;
			else if (str.charAt(i) == 'S' && str.charAt(i-1) == 'F') a--;
		System.out.println(a > 0 ? "YES" : "NO");
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

  private void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    String s = in.next();
    s = s.replaceAll("S+", "S");
    s = s.replaceAll("F+", "F");
    if (s.startsWith("S")) {
      out.println(s.length() % 2 == 0 ? "YES" : "NO");
    } else {
      out.println(s.length() % 2 == 0 ? "YES" : "NO");
    }
  }

  public static void main(String[] args) throws FileNotFoundException {
    new Main().run();
  }

  private void run() throws FileNotFoundException {

    //new FileInputStream(new File("input.txt"))
    //
    try (InputReader in = new InputReader(System.in);
         PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }

  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {
    }
  }

}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String ch = sc.next();
	       String str = sc.next();
	       int f = 0, s = 0;

	       if(str.charAt(0) == 'F') {f = 1;}
	       if(str.charAt(0) == 'S') {s = 1;}

	       for(int i = 0; i < str.length() - 1; i++) {
				if(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {
					f++;
				}
				if(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {
					s++;
				}
			}

	       if(str.charAt(str.length() - 1) == 'F') {f++;}
	       if(str.charAt(str.length() - 1) == 'S') {s++;}

	       if(s > f) {
	    	   System.out.print("YES");
	       }
	       if(s < f) {
	    	   System.out.print("NO");
	       }
	       if(s == f) {
	    	   System.out.print("NO");
	       }
	}
}

import java.util.Scanner;

public class BetweentheOffices {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str;
        int n = sc.nextInt();
        str = sc.next();
        char ch[] = str.toCharArray();
         int c=0 ;
        for(int i=0; i<(ch.length-1);i++){

            int j =(i+1);
            if(ch[i]== 'S' && ch[j]=='F'){
            if( (ch[i]=='S')){
               c++;
            }
             }

        }

        if(c>1){
            System.out.println("YES");
        }
        else if(c==1 && n == 2){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }

    }

}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Scanner ss = new Scanner(System.in);
		String str = ss.nextLine();
		System.out.print(str);

	}
}

import java.util.*;
public class test{
    static String bwOffices(String s){
int count=0;
        int len=s.length();
        for(int i=0;i<len;i++){
            if(i+1<len && s.charAt(i)=='S' && s.charAt(i+1)=='F'){
                count++;
            }else if(i+1<len && s.charAt(i)=='F' && s.charAt(i+1)=='S'){
                count--;
            }
        }
        return count>0?"YES":"NO";
    }

    public static void main(String[]args){
        Scanner scn = new Scanner(System.in);
        int n=scn.nextInt();
        String str=scn.nextLine();
        System.out.println(bwOffices(str));
    }

}

import java.util.Scanner;
 public class prob{
     public static void main(String args[]){

  int k;
  int fs=0;
  int sf=0;
   Scanner sc=new Scanner(System.in);
 k=sc.nextInt();
  String d;
  d=sc.next();

  for(int m=0;m<d.length()-1;m++)
  {
      if((d.charAt(m)=='F')&&(d.charAt(m+1)=='S'))
      {
       fs++;
      }
      if((d.charAt(m)=='S')&&(d.charAt(m+1)=='F'))
      {
          sf++;
      }
  }
  if(sf>fs)
  {
      System.out.println("Yes");
  }
 }
}

import java.util.*;
public class BetweenTheOffices{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String a = s.next();
        int y = 0;
        int no = 0;
        for(int i = 0; i < n-1; i++){
            int in1 = a.charAt(i);
            int in2 = a.charAt(i + 1);
            if(in1 == in2){
                continue;
            }else if(in1 < in2){
                no++;
            }else if(in1 > in2){
                y++;
            }
        }
        System.out.println((y>n)?"Yes":"NO");
    }
}

import java.util.*;
public class arr{

    static String memsql(String s){
    int count=0;
    int len=s.length();
    for(int i=0;i<len;i++){
        if(s.charAt(i)=='S')count--;
        else count++;
    }
return count>0?"YES":"NO";
    }
    public static void main(String[] args){

Scanner scn = new Scanner(System.in);
int n=scn.nextInt();
String str=scn.nextLine();
System.out.println(memsql(str));
// abccbaabccba
}

}

import java.util.Scanner;
public class Problem867a {
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=null;
		for(int i=0;;i++)
		{
			str=sc.nextLine();
			if(str.length()==n)
			{
				break;
			}
		}
		int s=0,f=0;
		for(int i=0;i<n;i++)
		{
			if((str.charAt(0)=='s')||(str.charAt(0)=='S'))
				s++;
			else
				f++;
		}
		if(s>f)
			System.out.print("YES");
		else
			System.out.print("NO");

	}

}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String str = sc.next();
	       String str1 = sc.next();

	       System.out.println(str);

	}
}

import java.util.Scanner;
public class CodeForces867A{
  public static void main(String [] args){
    Scanner sc = new Scanner (System.in);
    int n = sc.nextInt();
    char [] h = new char [n];
    String a =sc.next();
    int f = 0;
    int s = 0;
    if(n<=100 && n>=2){
      for(int i = 0; i<h.length; i++){
        h[i]=a.charAt(i);
      }
      for(int i = 1; i<h.length; i++){
        if(h[i] == 'S'){
          s++;
        }
        else f++;
      }
      if((s<f) && (s>0 || h[0] == 'S')) System.out.println("Yes");
      else System.out.println("No");
    }
  }
}

import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
          int n=sc.nextInt();
            String str =sc.next();
        char[] st1 = str.toCharArray();
        int count1=0,count2=0;
        int temp=0;
      //  int temp1=0;

        for(int i=0;i<str.length()-1;i++)
        {
       if( st1[i]=='S' && st1[i+1]=='F')
       {
           count1++;
        //   temp=1;
       } else {
       }
       if(st1[i]=='F' && st1[i+1]=='s')
       {
           count2++;
         //  temp=0;

       }

        }
           if(count1>=count2)
        {
            System.out.println("Yes");
        }
           else{

               System.out.println("No");

           }
          // System.out.println(count1);

        }

    }

import java.util.*;
public class PSG {
    public static void main(String args[]) {
        Scanner in =new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int a = 0; int b = 0;
        for(int i = 1;i < n;i++){
            if(s.charAt(i)=='S' && s.charAt(i)=='F'){
                a++;
            }
            if(s.charAt(i-1)=='S' && s.charAt(i)=='F'){
                b++;
            }
        }
        if(a > b){
            System.out.print("NO");
        }
        else{
            System.out.print("YES");
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Date;
import java.util.HashMap;
import java.util.Map ;
import javafx.util.converter.IntegerStringConverter;
    public class Codeforces {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
          FastReader console = new FastReader () ;
          int n = console.nextInt() ;
          String x = console.next() ;
          String s = "" ;
          int counts = 0 ;
          int countf = 0 ;
         for (int i=0 ; i<n ; i++)
         {
             s+=x.charAt(i) ;
             if (s.length()==2)
             {
                 if (s.equals("SF"))
                 {
                     counts ++ ;
                     s="" ;
                 }
                 else if (s.equals("FS"))
                 {
                     countf ++ ;
                     s="" ;
                 }
             }
         }
         if (counts>countf)
         {
             System.out.println("YES");
         }
         else
         {
             System.out.println("NO");
         }
       }
 }
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;
public class MainActivity3 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Scanner ss = new Scanner(System.in);
		int a = 0, d = 0;
		String ch1 = ss.next();
		String ch = ss.next();

		for(int i = 0; i < ch.length(); i++) {
			if(ch.charAt(i) == 'A') {
				a++;
			}
			if(ch.charAt(i) == 'D') {
				d++;
			}

		}

		if(a > d) {
			System.out.print("Anton");
		}
		if(a < d) {
			System.out.print("Danik");
		}
		if(a == d) {
			System.out.print("Friendship");
		}
	}
}

import java.util.Scanner;

public class EX867A {
public static void main (String args [])
{
	EX867A ex = new EX867A();
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int yes =0  ;int no =0 ;
	String ch = sc.nextLine();ch = sc.nextLine();// remarque
	String tab []=ch.split("");
	for(int i = 1 ; i<n;i++)
	{
		if(tab[i].equals(tab[i-1])==false)
		{
			if (tab[i-1].equals("s"))yes++;else no++;
		}
	}
	if(yes>no)System.out.println("YES");else System.out.println("no");
}
}

import javax.swing.*;
import java.util.Scanner;

public class BetweenTheOffices {
    public static void main(String[]args)
    {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int count = 0;
        String str = s.next();
        int[] bin = new int[str.length()];
        for (int i=1;i < str.length(); i++)
        {
            if(str.substring(i-1, i).equals("S"))
            {
                bin[i-1] = 1;
            }
            else
                bin[i-1] = 0;
        }

        for (int i=0; i<n; i++)
        {
            if(i == n-1)
            {
                if(bin[i] == 0)
                {
                    count++;
                }
                break;
            }
            if(bin[i] + bin[i+1] == 1)
                count++;
            else
                count--;
        }
        if(count >= 1)
        {
            System.out.println("Yes");
        }
        else System.out.println("No");
    }
}

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String args[]) throws FileNotFoundException {
        //Scanner in = new Scanner(new File("testcase.txt"));
    	Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    	int n = in.nextInt();
    	String[] s = in.next().split("");
    	//System.out.println(Arrays.toString(s));
    	int toSF = 0;
    	int toSea = 0;
    	for(int i=1; i<s.length; i++)
    	{
    		if(s[i] == "S" && s[i-1] == "F") {
    			toSea++;
    		}
    		else if(s[i] == "F" && s[i-1]=="S") {
    			toSF++;
    		}
    	}
    	if(toSF > toSea) {
    		System.out.println("YES");
    	}
    	else {
    		System.out.println("NO");
    	}
    }
}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String ch = sc.next();
	       String str = sc.next();
	       int f = 0, s = 0;

	       if(str.charAt(0) == 'F') {f = 1;}
	       if(str.charAt(0) == 'S') {s = 1;}

	       for(int i = 0; i < str.length() - 1; i++) {
				if(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {
					f++;
				}
				if(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {
					s++;
				}
			}

	       if(s > f) {
	    	   System.out.print("YES");
	       }
	       if(s < f) {
	    	   System.out.print("NO");
	       }
	       if(s == f) {
	    	   System.out.print("NO");
	       }
	}
}

import java.util.*;
final public class BetweenTheOffices
{
	public static void main(String args[])
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		String str=s.next();
		if(str.charAt(0)==str.charAt(n-1))
			System.out.println("NO");
		else
			System.out.println("YES");
		s.close();
	}
}

import java.util.*;
public class PSG {
    public static void main(String args[]) {
        Scanner in =new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int a = 0; int b = 0;
        for(int i = 1;i < n;i++){
            if(s.charAt(i)=='S' && s.charAt(i-1)=='F'){
                a++;
            }
            if(s.charAt(i-1)=='S' && s.charAt(i)=='F'){
                b++;
            }
        }
        if(b < a){
            System.out.print("NO");
        }
        else{
            System.out.print("YES");
        }
    }
}

import java.util.*;
import java.util.regex.*;
public class TravellingStoF {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();

		String s=sc.next();
		Pattern p1=Pattern.compile("FS");
		Matcher m1=p1.matcher(s);
		int c1=0;
		while(m1.find())
			c1++;
		Pattern p2=Pattern.compile("SF");
		Matcher m2=p2.matcher(s);
		int c2=0;
		while(m2.find());
		c2++;
		//System.out.println(c1+" "+c2);
		if(c2>c1)
			System.out.println("YES");
		else
			System.out.println("NO");
		//sc.close();
	}
}

import java.util.Scanner;

public class Doller {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x=sc.nextInt();
    String s = sc.next();

    int countS=0;
    int countF=0;

    for (int i=1; i<s.length()-1; i++){
        if(s.charAt(i)=='F'&&s.charAt(i+1)=='S')
            countS++;
        else if(s.charAt(i)=='S'&&s.charAt(i+1)=='F')
            countF++;}

    if(countF<countS)
        System.out.print("YES");
    else System.out.print("NO");

}}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Date;
import java.util.HashMap;
import java.util.Map ;
import javafx.util.converter.IntegerStringConverter;
    public class Codeforces {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
          FastReader console = new FastReader () ;
          int n = console.nextInt() ;
          String x = console.next() ;
          String s = "" ;
          int counts = 0 ;
          int countf = 0 ;
         for (int i=0 ; i<n ; i++)
         {
             s+=x.charAt(i) ;
             if (s.length()==2)
             {
                 if (s.equals("SF"))
                 {
                     counts ++ ;
                     s="" ;
                 }
                 else if (s.equals("FS"))
                 {
                     countf ++ ;
                     s="" ;
                 }
             }
         }
         System.out.println(counts);
         System.out.println(countf);
         if (counts>countf)
         {
             System.out.println("YES");
         }
         else
         {
             System.out.println("NO");
         }
       }
 }
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;
import java.lang.*;

public class BetweenTheOffices {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String input;
		int numDays;

		System.out.print("");
		numDays = scan.nextInt();

		System.out.print("");
		input = scan.next();

		if (input.equals("SF")) {
			System.out.println("YES");

		}
		else {
			System.out.println("NO");
		} //end of if-statement
	}
} //end of BetweenTheOffices class

import java.util.*;
public class Prog2
{
	public static void main(String[] main)
	{
		Scanner kbd = new Scanner(System.in);
		int n = 0;
		int x = 0;
		int y = 0;
		String length = "";

		n = Integer.parseInt(kbd.next());
		length = kbd.next();

		for(int i = 0; i < n-1; i++)
		{
			char temp = length.charAt(i);

			if(length.charAt(i++) == '\0')
			{
				break;
			}
			else if((length.charAt(i) == 'F' || length.charAt(i) == 'f') && temp != length.charAt(i++))
			{
				x++;
			}
			else if((length.charAt(i) == 'S' || length.charAt(i) == 's') && temp != length.charAt(i++))
			{
				y++;
			}
			else
			{
			    continue;
			}

		}
		if(x>y)
		{
			System.out.print("YES");
		}
		else
		{
			System.out.print("NO");
		}
	}
}

import java.util.*;
public class Main
{
public static void main(String ar[])
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
String str=s.next();
int c=0,c1=0;
for(int i=0;i<n-1;i++)
{
if(str.charAt(i)=='S' && str.charAt(i+1)=='F')
c++;
else if(str.charAt(i+1)=='F' && str.charAt(i+1)=='S' )
   c1++;
}

if(c>=c1)
System.out.println("YES");
else
System.out.println("NO");
}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class codeforces
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String args[])
    {
FastReader fastReader=new FastReader();
int n=fastReader.nextInt();

{
    String s;
    s=fastReader.next();
    int f=0;
    int k=0;
    if(s.charAt(0)=='S') f++;
    else k++;
    for(int i=1;i<n;i++)
    {
        if(s.charAt(i)=='S'&&s.charAt(i-1)=='F')
    {
        f++;
    }
        if(s.charAt(i)=='F'&&s.charAt(i-1)=='S')
        {
            k++;
        }
    }
    if(f>=k)
    {
        System.out.println("YES");
    }
    else
    {
        System.out.println("NO");
    }
}

    }
}

import java.util.Scanner;

public class Solution {

	int countS = 0;
	int countF = 0;
	void solve(Scanner in) {
		int n = in.nextInt();
		String s = in.next();
		char[] ss = s.toCharArray();
		for(int i = 0; i < n; ++i) {

			if(ss[i] == 'S') {
				countS++;
			}
			if(ss[i] == 'F') {
				countF++;
			}
		}
		if(countS > countF || (countS == countF && ss[0] == 'F'))
		System.out.println("NO");
		else if(countS < countF || (countS == 1 && countF == 1 && ss[0] == 'S' ))
		System.out.println("YES");

	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		new Solution().solve(in);
	}

}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Scanner ss = new Scanner(System.in);
		String str = ss.nextLine();
		String number =  str.replaceAll("\\D+","");

		System.out.print("NO");
	}
}

import java.util.Scanner;

public class problem867A {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();//handle enter key;

        String s = input.nextLine();
        int x = 0;

        for (int i = 1; i < n; i++) {
            if ((s.charAt(i-1) == 'S')&& (s.charAt(i)=='F')) {

                x++;

            } else if ((s.charAt(i-1) == 'F')&& (s.charAt(i)=='S')){
                x--;
            }
        }
        //decide he is in home or not
        if (x> 0) {
                System.out.println("NO");
         } else {

            System.out.println("No");
        }

    }
}

import java.util.Scanner;

/**
 *
 * @author haroldmc
 */
public class BetweenTheOffices {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

         int quant = sc.nextInt();
         //sc = new Scanner(System.in);
         String temp = sc.nextLine();
         String[] flew = temp.split("");
         int b= flew.length;

        if(flew[0].equals("S") && flew[b-1].equals("F"))
        {
            System.out.println("YES");
        }
        else
        {
             System.out.println("NO");
        }

    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codeforces;
import java.util.*;
/**
 *
 * @author Ashraf
 */
public class ContestPb1 {
    public static void main(String []args){
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        String receiveEnter=input.nextLine();
        String s=input.nextLine();
        char c[]=new char[120];
        char store;
        int flag1=0,flag2=0;
        c=s.toCharArray();
        if(c[0]=='F'){
            System.out.println("NO");
        }
        else{
           store='S';
           for(int i=1;i<c.length;i++){
               if(c[i]==store) continue;
               else if(c[i]=='F'){
                   store='F';
                   flag1++;
               }
               else{
                   store='S';
                   flag2++;
               }
           }
           if(flag2>flag1)  System.out.println("NO");
           else  System.out.println("YES");
        }
    }
}

import java.util.Scanner;
public class JavaApplication17 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner (System.in);

        int f=0;
        int s=0;
        int n = in.nextInt();
        String vet = in.next();
        int TAM = vet.length();
        if(TAM != n){
            TAM = n;
        }
        for(int i=0; i<TAM; i++){
            char letra = vet.charAt(i);
            if(letra == 'F'){
                f++;
            }
            else{
                s++;
        }
      }
        if(f == s){
               if(vet.charAt(0) == 'F'){
                   System.out.println("NO");
               }
               else{
                   System.out.println("YES");
               }
           }
        else if(f>s){
            System.out.println("NO");
        }
        else{
            System.out.println("YES");
        }
    }
}
// 1507991185043

import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
          int n=sc.nextInt();
            String str =sc.next();
        char[] st1 = str.toCharArray();
        int count1=0,count2=0;
        int temp=0;
        int temp1=0;

        for(int i=0;i<str.length();i++)
        {
       if( st1[i]=='S' && temp==0)
       {
           count1++;
           temp=1;
       } else {
       }
       if(st1[i]=='F' && temp==1)
       {
           count2++;
           temp=0;

       }

        }
           if(count1>=count2)
        {
            System.out.println("Yes");
        }
           else{

               System.out.println("No");

           }

        }

    }

import java.util.Scanner;

public class problem867A {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();//handle enter key;

        String s = input.nextLine();
        int x = 1;
        int ss = 0, ff = 0;
        char lastChar = s.charAt(0);
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'S') {
                ss++;
            } else {
                ff++;
            }
        }

        System.out.println("ss " + ss);
        System.out.println("ff " + ff);
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == lastChar) {

            } else {
                x++;
                lastChar = s.charAt(i);
            }
        }
        //decide he is in home or not
        if (x % 2 == 0) {
            if(ff>ss){
                System.out.println("NO");
                return;
            }
            System.out.println("YES");
        } else {

            System.out.println("No");
        }

    }
}

import java.util.*;
public class test{
    static String bwOffices(String s){
int count=0;
        int len=s.length();
        for(int i=0;i<len;i++){
            if(i+1<len && s.charAt(i)=='S' && s.charAt(i+1)=='F'){
                count++;
            }else if(i+1<len && s.charAt(i)=='F' && s.charAt(i+1)=='S'){
                count--;
            }
        }
        return count>0?"YES":"NO";
    }

    public static void main(String[]args){
        Scanner scn = new Scanner(System.in);
        int n=scn.nextInt();
        String str=scn.nextLine();
        System.out.println(bwOffices(str));
    }

}

import java.util.Scanner;
public class BetweenTheOffices {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		if(n==1){}
		if(str.charAt(0)=='S'){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		sc.close();
	}

}

import java.util.Scanner;

public class BetweenTheOffices {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String input;
		int numDays;

		System.out.print("");
		numDays = scan.nextInt();

		System.out.print("");
		input = scan.next();

		if (input.equals("SF")) {
			System.out.println("YES");

		}
		else {
			System.out.println("NO");
		}
	}
}

import java.util.Scanner;
public class flightsfs {
	public static void main(String [] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String[] c = s.next().split("");

		int FS = 0;//SF to seattle
		int SF = 0;//seattle to SF

		for (int i = 0; i < n - 1; i++) {
			if (c[i].equals("S") && c[i + 1].equals("F")) SF++;
			else if (c[i].equals("F") && c[i + 1].equals("S")) SF++;
		}

		if (SF>FS) System.out.println("YES"); else System.out.println("NO");

	}
}

import java.util.*;
public class offices
{
	public static void main(String arg[])
	{
		int n,se=0,f=0,i,l;
		String s;

		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		s=sc.next();
		l=s.length()-1;
		for(i=0;i<l;i++)
		{
			char ch = s.charAt(i);
			if(ch=='S')
			{
				char c = s.charAt(i+1);
				if(c=='F')
					se++;
				else
					f++;
			}
		}
		if(f<se)
			System.out.println("YES");
		else
		System.out.println("NO");

	}
}

import java.util.Scanner;
public class MainActivity1 {
	public static void main(String[] args) {
	       Scanner sc = new Scanner(System.in);
	       String ch = sc.next();
	       String str = sc.next();
	       int f = 0, s = 0;

	       if(str.charAt(0) == 'F') {f = 1;}
	       if(str.charAt(0) == 'S') {s = 1;}

	       for(int i = 0; i < str.length() - 1; i++) {
				if(str.charAt(i) == 'F' && str.charAt(i + 1) == 'S') {
					f++;
				}
				if(str.charAt(i) == 'S' && str.charAt(i + 1) == 'F') {
					s++;
				}
			}

	       if(s > f) {
	    	   System.out.print("YES");
	       }
	       if(s < f) {
	    	   System.out.print("NO");
	       }
	       if(s == f) {
	    	   if(str.charAt(str.length()) == 'F') {System.out.print("NO");}
		       if(str.charAt(str.length()) == 'S') {System.out.print("YES");}
	       }

	}
}

import java.util.Scanner;
 public class prob{
     public static void main(String args[]){

  int fs=0;
  int sf=0;
   Scanner sc=new Scanner(System.in);

  String d;
  d=sc.next();

  for(int m=0;m<d.length()-1;m++)
  {
      if((d.charAt(m)=='F')&&(d.charAt(m+1)=='S'))
      {
       fs++;
      }
      if((d.charAt(m)=='S')&&(d.charAt(m+1)=='F'))
      {
          sf++;
      }
  }
  if(sf>fs)
  {
      System.out.println("Yes");
  }
 }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author viatsko
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();

      int sToF = 0;
      int fToS = 0;

      in.useDelimiter("");

      char state = ' ';

      while (n-- >= 0) {
        char ch = in.next().charAt(0);

        if (state == 'S' && ch == 'F') {
          sToF++;
        } else if (state == 'F' && ch == 'S') {
          fToS++;
        }

        state = ch;
      }

      out.print(sToF > fToS ? "YES" : "NO");
    }
  }
}

import java.util.Scanner;
public class Codeforces1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int d=0,a = input.nextInt();
        String c = input.next();
        char[] e = c.toCharArray();
        for(int i=0;i<a;i++)
        {
            if(i==a-1)
            {
                break;
            }
            if(e[i]=='S' && e[i+1]=='F' && i!=a-2)
            {
                d++;
                break;
            }
        }
        if(d>1)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.Scanner;

public class EX867A {
public static void main (String args [])
{
	EX867A ex = new EX867A();
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int yes =0  ;int no =0 ;
	String ch = sc.nextLine();ch = sc.nextLine();// remarque
	String tab []=ch.split("");
	for(int i = 1 ; i<n;i++)
	{
		if(tab[i].equals(tab[i-1])==false) yes++;else no++;
	}
	if(yes>no)System.out.println("NO");else System.out.println("YES");
}
}

import java.util.Scanner;

/**
 *
 * @author Mahmoud
 */
public class Exc {

public static void main( String[] args )
 {

     Scanner sc =new Scanner(System.in);

     int x  = sc.nextInt();
     String s = sc.next();
     int sfIndex = 0, fsIndex = 0, sfCount = 0,fsCount = 0;
     while( sfIndex+1 < s.length() && fsIndex+1 < s.length())
     {
     sfIndex = s.indexOf("SF", sfIndex);
     fsIndex  = s.indexOf("FS", fsIndex);

     if(sfIndex != -1)
     {
     sfCount++;
     sfIndex+=2;
     }

     if(fsIndex != -1)
     {
     fsCount++;
     fsIndex+=2;
     }

     if(sfIndex == -1 && fsIndex == -1)
     {
     break;
     }

     }

     System.out.println((sfCount >= fsCount)? "YES":"NO");

 }
}

import java.util.Scanner;
public class BetweenTheOffices {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		if(n==1){System.out.println("NO");}
		else{
		if(str.charAt(0)=='S'){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		sc.close();
	}
	}
}

import java.util.Scanner;

public class BetweenTheOffices {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int numberOfInput = scan.nextInt();
		String input = scan.next();
		int toSanFrancisco = 0;
		int toSeattle = 0;
		for (int i = 0; i < numberOfInput - 1; i++) {
			if (input.charAt(i) != input.charAt(i + 1)) {
				if (input.charAt(i) == 'S' && input.charAt(i) == 'F') {
					toSanFrancisco++;
				} else {
					toSeattle++;
				}
			}
		}
		if (toSanFrancisco > toSeattle) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		scan.close();
	}
}

import java.util.Scanner;

public class CF2
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s = scanner.nextLine();
        int SF = 0;
        int FS = 0;
        for(int i = 0; i < s.length(); i++)
        {
            if(s.charAt(i) == 'S' && s.charAt(i + 1) == 'F')
                SF++;
            if(s.charAt(i) == 'F' && s.charAt(i + 1) == 'S')
                FS++;
        }
        if(SF > FS)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.Scanner;

public class Doller {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x=sc.nextInt();
    String s = sc.next();

    int countS=0;
    int countF=0;

    for (int i=1; i<s.length(); i++)
        if(s.charAt(i)=='F'&&s.charAt(i)!=s.charAt(i-1))
            countF++;
        else if(s.charAt(i)=='S'&&s.charAt(i)!=s.charAt(i-1))
            countS++;
    if(s.charAt(0)=='F')
       countF++;
       else countS++;
    if (countF==countS&&s.charAt(0)=='F')
        System.out.print("NO");
    else if (countF==countS&&s.charAt(0)=='S')
        System.out.print("YES");
    else if (countF>countS&&countS!=0)
        System.out.print("NO");
    else System.out.print("YES");

}}

import java.util.Scanner;

/**
 *
 * @author Mahmoud
 */
public class Exc {

public static void main( String[] args )
 {

     Scanner sc =new Scanner(System.in);

     int x  = sc.nextInt();
     String s = sc.next();
     int sfIndex = 0, fsIndex = 0, sfCount = 0,fsCount = 0;
     while( sfIndex+1 < s.length())
     {
     sfIndex = s.indexOf("SF", sfIndex);
     fsIndex  = s.indexOf("FS", fsIndex);

     if(sfIndex != -1)
     {
     sfCount++;
     sfIndex+=2;
     }

     if(fsIndex != -1)
     {
     fsCount++;
     fsIndex+=2;
     }

     if(sfIndex == -1 && fsIndex == -1)
     {
     break;
     }

     }

     System.out.println((sfCount >= fsCount)? "YES":"NO");

 }
}

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException{
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
            int n=Integer.parseInt(br.readLine());
            String str=br.readLine();
            int s=0,f=0;
            for(int i=0;i<str.length();i++)
            {
                char ch=str.charAt(i);
                if(ch=='S')
                    s++;
                else
                    f++;

            }
            if(s>=f)
                bw.write("NO\n");
            else
                bw.write("YES\n");
            /*int[] arr=new int[4];
           int n=Integer.parseInt(str[0]);
           int m=Integer.parseInt(str[1]);
              int k=Integer.parseInt(str[2]);
          if(n<=(int )Math.min(m,k))
            bw.write("YES\n");
            else
          bw.write("NO\n");

           */
             bw.flush();
	}

}

import java.lang.String;
import  java.util.Scanner;
public class FirstProgram {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String line=in.nextLine();
        int i=0;
        int sea=0, fr=0;
        for (int j = 0; j <line.length() ; j++) {
            if(line.charAt(j)=='S') sea++;
            else fr++;
        }
        if(sea>fr) System.out.println("YES");
        else System.out.println("NO");
    }
    }

import java.util.Scanner;

public class Problem {

    public static void main(String [] args) {

        Scanner scanner  = new Scanner(System.in);

        StringBuilder sb1 = new StringBuilder(scanner.nextLine());
        StringBuilder sb2 = new StringBuilder(scanner.nextLine());
        int StoF = 0;
        int FtoS = 0;

        for(int i = 2 ; i < Integer.valueOf(sb1.toString()) ; i++)
        {
            if(sb2.substring(i-2,i).equals("SF"))
            {
                StoF++;
            }
            if(sb2.substring(i-2,i).equals("FS"))
            {
                FtoS++;
            }
        }
        scanner.close();
        if(StoF>FtoS)
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }

    }
}

import java.util.Scanner;

public class offices {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int length = sc.nextInt();
        String waste = sc.nextLine();
        String cities = sc.nextLine();
        int countFS = 0, countSF = 0;
        for (int i = 0; i < length - 1; i++){
            if (cities.charAt(i) == 'S'){
                if (cities.charAt(i+1) == 'F'){
                    countSF++;
                }
            } else {
                if (cities.charAt(i+1) == 'S'){
                    countFS++;
                }
            }
        }
        if (countFS > countSF){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.util.*;

public class BetweenTheOffices {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    String line = s.next();
    char pos = line.charAt(0);
    int numFlightsToS = 0;
    int numFlightsToF = 0;
    for (int i = 1; i < line.length(); ++i) {
      if (line.charAt(i) != pos) {
        if (pos == 'F') {
          ++numFlightsToS;
        } else {
          ++numFlightsToF;
        }
      }
    }
    System.out.println(numFlightsToF > numFlightsToS ? "YES" : "NO");
  }
}

import java.util.*;
public class PSG {
    public static void main(String args[]) {
        Scanner in =new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int a = 0; int b = 0;
        for(int i = 1;i < n;i++){
            if(s.charAt(i)=='S' && s.charAt(i)=='F'){
                a++;
            }
            if(s.charAt(i-1)=='S' && s.charAt(i)=='F'){
                b++;
            }
        }
        if(a < b){
            System.out.print("YES");
        }
        else{
            System.out.print("NO");
        }
    }
}

import java.util.Scanner;

public class Near_Apllication {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		in.nextInt();
		String s=in.next();
		System.out.println((s.charAt(s.length()-1)!=s.charAt(0))==true?"YES":"NO");
		/*System.out.println(s.charAt(0));
		System.out.println((s.charAt(s.length()-1)));*/
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {

  private void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    String s = in.next();
    s = s.replaceAll("S+", "S");
    s = s.replaceAll("F+", "F");
    if (s.startsWith("S")) {
      out.println(s.endsWith("F") ? "YES" : "NO");
    } else {
      out.println(s.endsWith("F") ? "YES" : "NO");
    }
  }

  public static void main(String[] args) throws FileNotFoundException {
    new Main().run();
  }

  private void run() throws FileNotFoundException {

    //new FileInputStream(new File("input.txt"))
    //
    try (InputReader in = new InputReader(System.in);
         PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }

  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {
    }
  }

}

import java.util.Scanner;
public class CodeForces867A{
  public static void main(String [] args){
    Scanner sc = new Scanner (System.in);
    int n = sc.nextInt();
    char [] h = new char [n];
    String a =sc.next();
    int f = 0;
    int s = 0;
    if(n<=100 && n>=2){
      for(int i = 0; i<h.length; i++){
        h[i]=a.charAt(i);
      }
      for(int i = 1; i<h.length; i++){
        if(h[i] == 'S'){
          s++;
        }
        else f++;
      }
      if((s<f) && (s>0 || h[0] == 'S')) System.out.println("Yes");
      else System.out.println("No");
    }
  }
}

import java.util.*;
public class offices
{
    public static void main(String[] args)
    {
        Scanner s1=new Scanner(System.in);
        int n=s1.nextInt();
        s1.nextLine();
        String input=s1.nextLine();
        int nsf=0;
        int ns=0;
        for(int i=0;i<n;i++)
        {
            if (input.substring(i,i+1).equals("F")) nsf+=1;
            else ns+=1;
        }
        if(ns>=nsf) System.out.println("YES");
        else System.out.println("NO");

    }
}

import java.util.Scanner;

public class problem867A {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();//handle enter key;

        String s = input.nextLine();
        int x = 1;
        char lastChar = s.charAt(0);
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == lastChar) {

            } else {
                x++;
                lastChar = s.charAt(i);
            }
        }
        //decide he is in home or not
        if (x % 2 == 0) {
            System.out.println("YES");
        } else {

            System.out.println("No");
        }

    }
}

import java.util.Scanner;
 public class prob{
     public static void main(String args[]){

  int fs=0;
  int sf=0;
   Scanner sc=new Scanner(System.in);

  String d;
  d=sc.next();

  for(int m=0;m<d.length()-1;m++)
  {
      if((d.charAt(m)=='F')&&(d.charAt(m+1)=='S'))
      {
       fs++;
      }
      if((d.charAt(m)=='S')&&(d.charAt(m+1)=='F'))
      {
          sf++;
      }
  }
  if(sf>fs)
  {
      System.out.println("Yes");
  }
  if(sf<=fs)
  {
      System.out.println("NO");
  }
 }
}

import java.util.Scanner;
import java.lang.*;

public class BetweenTheOffices {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String input;
		int numDays;

		System.out.print("");
		numDays = scan.nextInt();

		System.out.print("");
		input = scan.next();

		if (input.equals("SF")) {
			System.out.println("YES");

		}
		else {
			System.out.println("NO");
		} //end of if-statement
	}
} //end of BetweenTheOffices class

import java.util.Scanner;

public class problem867A {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        input.nextLine();//handle enter key;

        String s = input.nextLine();
        int x = 1;
        char lastChar = s.charAt(0);
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == lastChar) {

            } else {
                lastChar = s.charAt(i);
    x++;
            }
        }
        //decide he is in home or not
        if (x % 2 == 0) {
            System.out.println("YES");
        } else {

            System.out.println("No");
        }

    }
}

import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    sc.nextLine();
        String vuelos = sc.nextLine();
        int S=0, F=0;
        for(int i=0; i<n; i++)
        {
            if(vuelos.charAt(i)=='F' && vuelos.charAt(i+1) == 'S')
            {
                F++;
                break;
            }
            else if(vuelos.charAt(i)=='S' && vuelos.charAt(i+1) == 'F')
            {
                S++;
                break;
            }
            else if(vuelos.charAt(i)=='F' && vuelos.charAt(i+1) == 'F')
            {
                break;
            }
            else if(vuelos.charAt(i)=='S' && vuelos.charAt(i+1) == 'S')
            {
                break;
            }
        }
        if(S>F)
            System.out.print("YES");
        else if(S<=F)
            System.out.print("NO");

	}
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		String str;
		str = cin.nextLine();
		int a = 0;
		for (int i = 1; i <  str.length() ; i++)
			if (str.charAt(i) == 'F' && str.charAt(i-1) == 'S') a++;
			else if (str.charAt(i) == 'S' && str.charAt(i-1) == 'F') a--;
		System.out.println(a > 0 ? "YES" : "NO");
	}
}

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.nextLine();
        char[] arr = sc.nextLine().toCharArray();

        char f = arr[0];
        int c = 0;
        int b = 0;
        for (int i = 1; i < arr.length; i++) {
            if(f == 'S' && arr[i] == 'F')
                c++;
            else
                b++;

            f = arr[i];

        }

        System.out.println(b>c ? "YES" :"NO");
    }

}

import java.util.Scanner;

public class BetweenTheOffices {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String input;
		int numDays;

		System.out.print("");
		numDays = scan.nextInt();

		System.out.print("");
		input = scan.next();

		if (input.equals("SF")) {
			System.out.println("YES");

		}
		else {
			System.out.println("NO");
		}
	}
}

import java.util.Scanner;
import java.lang.*;

public class BetweenTheOffices {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String input;
		int numDays;

		System.out.print(" ");
		numDays = scan.nextInt();

		System.out.print(" ");
		input = scan.next();

		if (input.equals("SF")) {
			System.out.println("YES");

		}
		else {
			System.out.println("NO");
		} //end of if-statement
	}
} //end of BetweenTheOffices class

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        String ioba=scan.nextLine();
        int count=0;
        int count1=0;
        boolean b=false;
        String yep="SF";
        String fuck="FS";
        for(int i=0;i<ioba.length()-1;i++){
            if (ioba.substring(i,i+2).equals(yep)){
                count=count+1;

            }
            if (ioba.substring(i,i+2).equals(fuck)){
                count1=count1+1;
            }
        }
        if(count>count1){b=true;}
        System.out.println(b? "Yes":"No");

        }
    }

import java.util.*;
public class BetweenTheOffices{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String a = s.next();
        int y = 0;
        int no = 0;
        for(int i = 0; i < n-1; i++){
            int in1 = a.charAt(i);
            int in2 = a.charAt(i + 1);
            if(in1 == in2){
                continue;
            }else if(in1 < in2){
                no++;
            }else if(in1 > in2){
                y++;
            }
        }
        System.out.println((y>n)?"Yes":"NO");
    }
}

import java.util.*;
public class Solution{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        int cs=0,cf=0;
        char c=str.charAt(0);
        for(int i=1;i<str.length();i++)
        {
            char d=str.charAt(i);
            int a,b;
            if(c=='S')
              a=1;
            else
              a=0;
            if(d=='S')
              b=1;
            else
              b=0;
            if(a!=b)
            {
                if(a==0)
                   cf++;
                else
                   cs++;
            }
            c=d;
        }
        if(cs>cf)
            System.out.println("YES"+" "+cs+" "+cf);
       else
            System.out.println("NO");
    }
}