package validate;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Validate {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Cary seznamCar1 = new Cary();
        Cary seznamCar2 = new Cary();
        int pocet1, pocet2;
        pocet1 = s.nextInt();
        
        int[][] pole1 = new int[pocet1][2];
        char[] com1 = new char[pocet1];
        int pocX = 0;
        int pocY = 0;
        
        for (int i = 0; i < pocet1; i++) {
            com1[i] = s.next().charAt(0);
            pole1[i][0] = s.nextInt();
            pole1[i][1] = s.nextInt();
            if(com1[i] == 'L'){
                Cara c = new Cara(pocX,pocY, pole1[i][0] + pocX, pole1[i][1]+ pocY);
                seznamCar1.a.add(c);
            }
            pocX += pole1[i][0];
            pocY += pole1[i][1];
        }
        
        pocet2 = s.nextInt();
        pocX = 0;
        pocY = 0;
        int[][] pole2 = new int[pocet2][2];
        char[] com2 = new char[pocet2];
        
        for (int i = 0; i < pocet2; i++) {
            com2[i] = s.next().charAt(0);
            pole2[i][0] = s.nextInt();
            pole2[i][1] = s.nextInt();
            if(com2[i] == 'L'){
                Cara c = new Cara(pocX,pocY, pole2[i][0] + pocX, pole2[i][1]+ pocY);
                seznamCar2.a.add(c);
            }
            pocX += pole2[i][0];
            pocY += pole2[i][1];
        }
//        vypisPole(com1, pole1);
//        vypisPole(com2, pole2);
//        System.out.println(seznamCar1);
//        System.out.println(seznamCar2);
        int[] p = seznamCar1.posun();
//        System.out.println(p[0] + " " + p[1]);
        p = seznamCar2.posun();
//        System.out.println(p[0] + " " + p[1]);
//        System.out.println(seznamCar1);
//        System.out.println(seznamCar2);
        
        System.out.println((seznamCar1.isEqual(seznamCar2) && seznamCar2.isEqual(seznamCar1) ? "YES" : "NO"));
        
        
    }
    
    public static class Cara {
        int x1, y1;
        int x2, y2;

        public Cara(int x1, int y1, int x2, int y2) {
            if(x1 < x2){
                this.x1 = x1;
                this.y1 = y1;
                this.x2 = x2;
                this.y2 = y2;
            }else{
                this.x1 = x2;
                this.y1 = y2;
                this.x2 = x1;
                this.y2 = y1;
            }
        }
        
        public boolean containBod(int x, int y){
            if(x == x1 && y == y1){
//                System.out.println("tady1");
                return true;
            }
            if(x == x2 && y == y2){
//                System.out.println("tady2");
                return true;
            }
            
            if(x == 0 && x1 == 0 && x2 == 0){
                if(y1 > y2){
                    if(y < y1 || y > y2){
//                        System.out.println("tady3");
                        return true;
                    }
                    return false;
                }
            }else if(x1 == 0 && x2 == 0){
                return false;
            }
            
            if(y == 0 && y1 == 0 && y2 == 0){
                if(x < x2 || x > x1){
//                    System.out.println("tady4");
                    return true;
                }
                return false;
            }else if(y1 == 0 && y2 == 0){
                return false;
            }
            
            if(x < x1 || x > x2){
                return false;
            }
            if(y1 < y2){
                if(y < y1 || y > y2){
                    return false;
                }
            }else{
                if(y > y1 || y < y2){
                    return false;
                }
            }
            if(x == 0 && y == 0){
//                System.out.println("tady5");
                return true;
            }
            
            double pom = x2 / x;
            double pom2 = y2 / y;
            if(pom == pom2){
//                System.out.println("tady6");
                return true;
            }
            return false;
        }
        
        public void posun(int[] p){
            x1 += p[0];
            x2 += p[0];
            
            y1 += p[1];
            y2 += p[1];
        }
        
        public int[] getLowest(){
            int[] bod = new int[2];
            if(y1 > y2){
                bod[0] = x2;
                bod[1] = y2;
            }else if(y1 < y2){
                bod[0] = x1;
                bod[1] = y1;
            }else{
                if(x1 < x2){
                    bod[0] = x1;
                    bod[1] = y1;
                }else{
                    bod[0] = x2;
                    bod[1] = y2; 
                }
                
            }
            
            return bod;
        }

        @Override
        public String toString() {
            return "C{" + "[" + x1 + "," + y1 + "]<->[" + x2 + "," + y2 + ']';
        }
        
        
        
    }
    
    public static class Cary {
        List<Cara> a = new ArrayList<Cara>();

        public Cary() {
        }
        
        public int[] getBod(){
            int[] res;
            res = a.get(0).getLowest();
            for (int i = 1; i < a.size(); i++) {
                if(a.get(i).getLowest()[1] < res[1]){
                    res = a.get(i).getLowest();
                }else if(a.get(i).getLowest()[1] == res[1]){
                    if(a.get(i).getLowest()[0] < res[0]){
                        res = a.get(i).getLowest();
                    }
                }
            }
            return res;
        }

        @Override
        public String toString() {
            String s = "";
            for (int i = 0; i < a.size(); i++) {
                s += a.get(i).toString() + "\n";
            }
            return s;
        }
        
        
        
        public int[] posun(){
            int[] posun = getBod();
            posun[0] *= -1;
            posun[1] *= -1;
            
            for (int i = 0; i < a.size(); i++) {
                a.get(i).posun(posun);
            }
            return posun;
        }
        
        public boolean isEqual(Cary c){
            for (int i = 0; i < a.size(); i++) {
                if(!c.containBod(a.get(i).x1, a.get(i).y1)){
                    return false;
                }
                if(!c.containBod(a.get(i).x2, a.get(i).y2)){
                    return false;
                }
            }
            
            return true;
            
        }
        
        public boolean containBod(int x, int y){
            for (int i = 0; i < a.size(); i++) {
                if(a.get(i).containBod(x, y)){
                    return true;
                }
            }
            return false;
        }
    }
    
    public static void vypisPole(char[] p, int[][] pCisel){
        System.out.println("");
        System.out.print("[ ");
        for (int i = 0; i < p.length; i++) {
            System.out.println(" " + p[i] + " " + pCisel[i][0] + " " + pCisel[i][1]);
        }
        System.out.println(" ]");
    }
}
