/*
 * @author romit17
 */

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

public class E1101 {

    void solve() throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder("");
        int n = ni();
        int b = Integer.MIN_VALUE;
        int s = Integer.MIN_VALUE;
        while(n-->0)
        {
            char c = nc();
            int x = ni(), y = ni();
            if(c=='+')
            {
                s = Math.max(s,Math.min(x,y));
                b= Math.max(b,Math.max(x,y));
                continue;
            }
            if((s<=x && b<=y) || (s<=y && b<=x))
                System.out.println("YES");
            else
                System.out.println("NO");
        }
    }

    public static void main(String[] args) throws IOException {
        new E1101().solve();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;
    InputStream is = System.in;

    private int readByte() {
        if (lenbuf == -1) {
            throw new InputMismatchException();
        }
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) {
                return -1;
            }
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b));
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) {
            map[i] = ns(m);
        }
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = ni();
        }
        return a;
    }

    private int[] na1(int n) {
        int[] a = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            a[i] = ni();
        }
        return a;
    }

    private long[] nb(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nl();
        }
        return a;
    }

    private long[] nb1(int n) {
        long[] a = new long[n + 1];
        for (int i = 1; i < n + 1; i++) {
            a[i] = nl();
        }
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

}


/*
 * @author romit17
 */

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

public class E1101 {

    void solve() throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder("");
        int n = ni();
        int b = Integer.MIN_VALUE;
        int s = Integer.MIN_VALUE;
        while(n-->0)
        {
            char c = nc();
            int x = ni(), y = ni();
            if(c=='+')
            {
                s = Math.max(s,Math.min(x,y));
                b= Math.max(b,Math.max(x,y));
                continue;
            }
            if((s<=x && b<=y) || (s<=y && b<=x))
                sb.append("YES\n");
            else
                sb.append("NO\n");
        }
        System.out.println(sb);
    }

    public static void main(String[] args) throws IOException {
        new E1101().solve();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;
    InputStream is = System.in;

    private int readByte() {
        if (lenbuf == -1) {
            throw new InputMismatchException();
        }
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) {
                return -1;
            }
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b));
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) {
            map[i] = ns(m);
        }
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = ni();
        }
        return a;
    }

    private int[] na1(int n) {
        int[] a = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            a[i] = ni();
        }
        return a;
    }

    private long[] nb(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nl();
        }
        return a;
    }

    private long[] nb1(int n) {
        long[] a = new long[n + 1];
        for (int i = 1; i < n + 1; i++) {
            a[i] = nl();
        }
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

}


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

public class PolyCarpWallet {

    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 sc = new FastReader();
    OutputStream outputstream = System.out;
    PrintWriter out = new PrintWriter(outputstream);
    int n = sc.nextInt();
    long nw = 0;
    long nh = 0;
    for(int i = 1; i<=n; i++){
      String tmp = sc.next();
      char ch = tmp.charAt(0);
      long first = sc.nextLong();
      long sec = sc.nextLong();
      if(ch=='+'){
        long w = Math.min(first,sec);
        long h = Math.max(first,sec);
        nw = Math.max(nw,w);
        nh = Math.max(nh,h);
      } else {
        long ww = Math.min(first,sec);
        long wh = Math.max(first,sec);
        if(nw>ww || nh>wh){
          out.println("NO");
        } else {
          out.println("YES");
        }
      }
    }
    out.close();
  }

}


import java.util.Scanner;

public class PolyCarpWallet {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long nw = 0;
    long nh = 0;
    for(int i = 1; i<=n; i++){
      String tmp = sc.next();
      char ch = tmp.charAt(0);
      long first = sc.nextLong();
      long sec = sc.nextLong();
      if(ch=='+'){
        long w = Math.min(first,sec);
        long h = Math.max(first,sec);
        nw = Math.max(nw,w);
        nh = Math.max(nh,h);
      } else {
        long ww = Math.min(first,sec);
        long wh = Math.max(first,sec);
        if(nw>ww || nh>wh){
          System.out.println("NO");
        } else {
          System.out.println("YES");
        }
      }
    }
  }

}


package sample;

import java.util.Scanner;

public class PolyCarpWallet {

  static class Prop {
    public int w;
    public int h;
    public Prop(){
      this.w = 0;
      this.h = 0;
    }
    public Prop(int w, int h){
      this.w = w;
      this.h = h;
    }
    public void add(int w, int h){
      int befw = this.w;
      int befh = this.h;
      this.w = Math.max(befw,w);
      this.h = Math.max(befh,h);
    }

    public int getW() {return this.w;}
    public int getH() {return this.h;}
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Character.getNumericValue(sc.nextLine().charAt(0));
    Prop prop = new Prop();
    for(int i = 1; i<=n; i++){
      char ch = sc.next().charAt(0);
      int first = sc.nextInt();
      int sec = sc.nextInt();
      //System.out.println(str);
      if(ch=='+'){
        int tw = first;
        int th = sec;
        int w = Math.min(tw,th);
        int h = Math.max(tw,th);
        prop.add(w,h);
      } else {
        int tww = first;
        int twh = sec;
        int ww = Math.min(tww,twh);
        int wh = Math.max(tww,twh);
        int nw = prop.getW();
        int nh = prop.getH();
        //System.out.println("nw " + nw+" nh "+ nh);
        //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
        if(nw>ww || nh>wh){
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("NO");
        } else {
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("YES");
        }
      }
    }
  }

}


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

public class PolyCarpWallet {

    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 sc = new FastReader();
    int n = sc.nextInt();
    long nw = 0;
    long nh = 0;
    for(int i = 1; i<=n; i++){
      String tmp = sc.next();
      char ch = tmp.charAt(0);
      long first = sc.nextLong();
      long sec = sc.nextLong();
      if(ch=='+'){
        long w = Math.min(first,sec);
        long h = Math.max(first,sec);
        nw = Math.max(nw,w);
        nh = Math.max(nh,h);
      } else {
        long ww = Math.min(first,sec);
        long wh = Math.max(first,sec);
        if(nw>ww || nh>wh){
          System.out.println("NO");
        } else {
          System.out.println("YES");
        }
      }
    }
  }

}


import java.util.Scanner;

public class PolyCarpWallet {

  static class Prop {
    public long w;
    public long h;
    public Prop(){
      this.w = 0;
      this.h = 0;
    }
    public Prop(long w, long h){
      this.w = w;
      this.h = h;
    }
    public void add(long w, long h){
      long befw = this.w;
      long befh = this.h;
      this.w = Math.max(befw,w);
      this.h = Math.max(befh,h);
    }

    public long getW() {return this.w;}
    public long getH() {return this.h;}
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    //String tmp = sc.next();
    //System.out.println(tmp);
    int n = sc.nextInt();
    //System.out.println(n);
    Prop prop = new Prop();
    for(int i = 1; i<=n; i++){
      //System.out.println("Hi");
      String tmp = sc.next();
      //System.out.println(tmp);
      char ch = tmp.charAt(0);
      long first = sc.nextLong();
      long sec = sc.nextLong();
      //System.out.println(first +" "+ sec);
      if(ch=='+'){
        long w = Math.min(first,sec);
        long h = Math.max(first,sec);
        prop.add(w,h);
      } else {
        long ww = Math.min(first,sec);
        long wh = Math.max(first,sec);
        //long nw = prop.getW();
        //long nh = prop.getH();
        //System.out.println("nw " + nw+" nh "+ nh);
        //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
        if(prop.getW()>ww || prop.getH()>wh){
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("NO");
        } else {
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("YES");
        }
      }
    }
  }

}


import java.util.Scanner;

public class PolyCarpWallet {

  static class Prop {
    public int w;
    public int h;
    public Prop(){
      this.w = 0;
      this.h = 0;
    }
    public Prop(int w, int h){
      this.w = w;
      this.h = h;
    }
    public void add(int w, int h){
      int befw = this.w;
      int befh = this.h;
      this.w = Math.max(befw,w);
      this.h = Math.max(befh,h);
    }

    public int getW() {return this.w;}
    public int getH() {return this.h;}
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    //String tmp = sc.next();
    //System.out.println(tmp);
    int n = sc.nextInt();
    //System.out.println(n);
    Prop prop = new Prop();
    for(int i = 1; i<=n; i++){
      //System.out.println("Hi");
      String tmp = sc.next();
      //System.out.println(tmp);
      char ch = tmp.charAt(0);
      int first = sc.nextInt();
      int sec = sc.nextInt();
      //System.out.println(first +" "+ sec);
      if(ch=='+'){
        int tw = first;
        int th = sec;
        int w = Math.min(tw,th);
        int h = Math.max(tw,th);
        prop.add(w,h);
      } else {
        int tww = first;
        int twh = sec;
        int ww = Math.min(tww,twh);
        int wh = Math.max(tww,twh);
        int nw = prop.getW();
        int nh = prop.getH();
        //System.out.println("nw " + nw+" nh "+ nh);
        //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
        if(nw>ww || nh>wh){
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("NO");
        } else {
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("YES");
        }
      }
    }
  }

}


import java.util.Scanner;

public class PolyCarpWallet {

  static class Prop {
    public long w;
    public long h;
    public Prop(){
      this.w = 0;
      this.h = 0;
    }
    public Prop(long w, long h){
      this.w = w;
      this.h = h;
    }
    public void add(long w, long h){
      long befw = this.w;
      long befh = this.h;
      this.w = Math.max(befw,w);
      this.h = Math.max(befh,h);
    }

    public long getW() {return this.w;}
    public long getH() {return this.h;}
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    //String tmp = sc.next();
    //System.out.println(tmp);
    int n = sc.nextInt();
    //System.out.println(n);
    Prop prop = new Prop();
    for(int i = 1; i<=n; i++){
      //System.out.println("Hi");
      String tmp = sc.next();
      //System.out.println(tmp);
      char ch = tmp.charAt(0);
      long first = sc.nextLong();
      long sec = sc.nextLong();
      //System.out.println(first +" "+ sec);
      if(ch=='+'){
        long tw = first;
        long th = sec;
        long w = Math.min(tw,th);
        long h = Math.max(tw,th);
        prop.add(w,h);
      } else {
        long tww = first;
        long twh = sec;
        long ww = Math.min(tww,twh);
        long wh = Math.max(tww,twh);
        long nw = prop.getW();
        long nh = prop.getH();
        //System.out.println("nw " + nw+" nh "+ nh);
        //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
        if(nw>ww || nh>wh){
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("NO");
        } else {
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("YES");
        }
      }
    }
  }

}


import java.util.Scanner;

public class PolyCarpWallet {

  static class Prop {
    public int w;
    public int h;
    public Prop(){
      this.w = 0;
      this.h = 0;
    }
    public Prop(int w, int h){
      this.w = w;
      this.h = h;
    }
    public void add(int w, int h){
      int befw = this.w;
      int befh = this.h;
      this.w = Math.max(befw,w);
      this.h = Math.max(befh,h);
    }

    public int getW() {return this.w;}
    public int getH() {return this.h;}
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Character.getNumericValue(sc.nextLine().charAt(0));
    Prop prop = new Prop();
    for(int i = 1; i<=n; i++){
      char ch = sc.next().charAt(0);
      int first = sc.nextInt();
      int sec = sc.nextInt();
      //System.out.println(str);
      if(ch=='+'){
        int tw = first;
        int th = sec;
        int w = Math.min(tw,th);
        int h = Math.max(tw,th);
        prop.add(w,h);
      } else {
        int tww = first;
        int twh = sec;
        int ww = Math.min(tww,twh);
        int wh = Math.max(tww,twh);
        int nw = prop.getW();
        int nh = prop.getH();
        //System.out.println("nw " + nw+" nh "+ nh);
        //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
        if(nw>ww || nh>wh){
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("NO");
        } else {
          //System.out.println("nw " + nw+", nh "+ nh+", ww "+ww+", wh "+wh);
          System.out.println("YES");
        }
      }
    }
  }

}


import java.util.*;

public class Eedu58
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), max = 0, min = 0;

        for (int i = 0; i < n; i++)
        {
            char c = in.next().charAt(0);
            int x = in.nextInt(), y = in.nextInt();
            if (c == '+')
            {
                max = Math.max(max, Math.max(x, y));
                min = Math.max(min, Math.min(x, y));
            }
            else
                System.out.println(Math.max(x, y) >= max && Math.min(x, y) >= min ? "YES" : "NO");
        }
    }
}


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

public class Eedu58
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), max = 0, min = 0;

        for (int i = 0; i < n; i++)
        {
            char c = in.next().charAt(0);
            int x = in.nextInt(), y = in.nextInt();
            if (c == '+')
            {
                max = Math.max(max, Math.max(x, y));
                min = Math.max(min, Math.min(x, y));
            }
            else
                out.println(Math.max(x, y) >= max && Math.min(x, y) >= min ? "YES" : "NO");
        }

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


import java.util.*;

public class Eedu58
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), max = 0, min = 0;

        for (int i = 0; i < n; i++)
        {
            char c = in.next().charAt(0);
            int x = in.nextInt(), y = in.nextInt();
            if (c == '+')
            {
                max = Math.max(max, Math.max(x, y));
                min = Math.max(min, Math.min(x, y));
            }
            else
                out.println(Math.max(x, y) >= max && Math.min(x, y) >= min ? "YES" : "NO");
        }

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


// No sorceries shall prevail. //
import java.util.*;
import java.io.*;

public class InVoker {
	static long mod = 1000000007;
	static long mod2 = 998244353;

    static class Segment implements Comparable<Segment> {
		int l, r, initialIndex;
		Segment () {}
		Segment (int l_, int r_, int d_) {
		    this.l = l_;
		    this.r = r_;
		    this.initialIndex = d_;
		}

		@Override
		public int compareTo(Segment o) {
		    return l - o.l;
		}
    }

//    Segment[] seg=new Segment[n];
//	for (int i=0;i<n;i++) {
//		int l=inp.nextInt();
//		int r=inp.nextInt();
//		seg[i]=new Segment(l,r,i);
//	}

	static long gcd(long a, long b) {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	    }
	static int gcd(int a, int b) {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	}

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

		int n=inp.nextInt();
		inp.nextLine();
		long maxW=0,maxH=0;
		for(int i=0;i<n;i++) {
			String s[]=inp.nextLine().split(" ");
			//out.print(s[0]+" "+s[1]+" "+s[2]);
			int x=Integer.parseInt(s[1]);
			int y=Integer.parseInt(s[2]);
			if(s[0].equals("+")) {
				//out.println("ZZ");
				maxW=Math.max(maxW, Math.min(x, y));
				maxH=Math.max(maxH, Math.max(x, y));
			}
			else {
				out.println(Math.min(x, y)>=maxW && Math.max(x,y)>=maxH?"YES":"NO");
			}
		}

		out.close();
		inp.close();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class yo {

public static void main(String[] args) throws IOException {
	FastScanner fs=new FastScanner(System.in);
	int k=fs.nextInt();
	//int[][] a=new int[k][2];
	int max1=0;
	int max2=0;
	int seen=0;
	for(int i=0;i<k;i++) {
		String[] b=fs.nextLine().split(" ");
		int c=Integer.parseInt(b[1]);
		int d=Integer.parseInt(b[2]);
		int cc=Math.min(c, d);
		int dd=Math.max(c, d);
		if(b[0].equals("+")) {
			max1=Math.max(max1,cc);
			max2=Math.max(max2,dd);

		}
		else {
			System.out.println(max1<=cc&&max2<=dd? "YES":"NO");
		}

	}
}

	//System.out.println(c[3]+" "+c[4]);

static class FastScanner {
    BufferedReader br;
    StringTokenizer st;
    public FastScanner(InputStream i){
        br = new BufferedReader(new InputStreamReader(i));
        st = new StringTokenizer("");
    }
    public String next() throws IOException{
        if(st.hasMoreTokens()) return st.nextToken();
        else st = new StringTokenizer(br.readLine());
        return next();
    }
    public long nextLong() throws IOException{ return Long.parseLong(next()); }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
    public String nextLine() throws IOException {
        if(!st.hasMoreTokens())
            return br.readLine();
        String ret = st.nextToken();
        while(st.hasMoreTokens())
            ret += " " + st.nextToken();
        return ret;
    }
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class yo {

public static void main(String[] args) throws IOException {
	FastScanner fs=new FastScanner(System.in);
	StringBuilder st=new StringBuilder("");
	int k=fs.nextInt();
	//int[][] a=new int[k][2];
	int max1=0;
	int max2=0;
	int seen=0;
	for(int i=0;i<k;i++) {
		String[] b=fs.nextLine().split(" ");
		int c=Integer.parseInt(b[1]);
		int d=Integer.parseInt(b[2]);
		int cc=Math.min(c, d);
		int dd=Math.max(c, d);
		if(b[0].equals("+")) {
			max1=Math.max(max1,cc);
			max2=Math.max(max2,dd);

		}
		else {
			st.append(max1<=cc&&max2<=dd? "YES":"NO");
			st.append("\n");
		}

	}
	System.out.print(st);
}

	//System.out.println(c[3]+" "+c[4]);

static class FastScanner {
    BufferedReader br;
    StringTokenizer st;
    public FastScanner(InputStream i){
        br = new BufferedReader(new InputStreamReader(i));
        st = new StringTokenizer("");
    }
    public String next() throws IOException{
        if(st.hasMoreTokens()) return st.nextToken();
        else st = new StringTokenizer(br.readLine());
        return next();
    }
    public long nextLong() throws IOException{ return Long.parseLong(next()); }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
    public String nextLine() throws IOException {
        if(!st.hasMoreTokens())
            return br.readLine();
        String ret = st.nextToken();
        while(st.hasMoreTokens())
            ret += " " + st.nextToken();
        return ret;
    }
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class yo {

public static void main(String[] args) throws IOException {
	FastScanner fs=new FastScanner(System.in);
	int k=fs.nextInt();
	int[][] a=new int[k][2];
	int seen=0;
	for(int i=0;i<k;i++) {
		String[] b=fs.nextLine().split(" ");
		int c=Integer.parseInt(b[1]);
		int d=Integer.parseInt(b[2]);
		int cc=Math.min(c, d);
		int dd=Math.max(c, d);
		if(b[0].equals("+")) {
			a[seen][0]=cc;
			a[seen][1]=dd;
			seen++;
		}
		else {
			boolean works=true;
			for(int j=0;j<seen;j++)
				if(!(a[j][0]<=cc&&a[j][1]<=dd)) {
					works=false;
					break;
				}
			System.out.println(works? "YES":"NO");
		}

	}
}

	//System.out.println(c[3]+" "+c[4]);

static class FastScanner {
    BufferedReader br;
    StringTokenizer st;
    public FastScanner(InputStream i){
        br = new BufferedReader(new InputStreamReader(i));
        st = new StringTokenizer("");
    }
    public String next() throws IOException{
        if(st.hasMoreTokens()) return st.nextToken();
        else st = new StringTokenizer(br.readLine());
        return next();
    }
    public long nextLong() throws IOException{ return Long.parseLong(next()); }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
    public String nextLine() throws IOException {
        if(!st.hasMoreTokens())
            return br.readLine();
        String ret = st.nextToken();
        while(st.hasMoreTokens())
            ret += " " + st.nextToken();
        return ret;
    }
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class yo {

public static void main(String[] args) throws IOException {
	FastScanner fs=new FastScanner(System.in);
	int k=fs.nextInt();
	int[][] a=new int[k][2];
	int seen=0;
	for(int i=0;i<k;k++) {
		String[] b=fs.nextLine().split(" ");
		int c=Integer.parseInt(b[1]);
		int d=Integer.parseInt(b[2]);
		int cc=Math.min(c, d);
		int dd=Math.max(c, d);
		if(b[0].equals("+")) {
			a[seen][0]=cc;
			a[seen][1]=dd;
			seen++;
		}
		else {
			boolean works=true;
			for(int j=0;j<seen;j++)
				if(!(a[j][0]<=cc&&a[j][1]<=dd)) {
					works=false;
					break;
				}
			System.out.println(works? "YES":"NO");

		}

	}
}

	//System.out.println(c[3]+" "+c[4]);

static class FastScanner {
    BufferedReader br;
    StringTokenizer st;
    public FastScanner(InputStream i){
        br = new BufferedReader(new InputStreamReader(i));
        st = new StringTokenizer("");
    }
    public String next() throws IOException{
        if(st.hasMoreTokens()) return st.nextToken();
        else st = new StringTokenizer(br.readLine());
        return next();
    }
    public long nextLong() throws IOException{ return Long.parseLong(next()); }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
    public String nextLine() throws IOException {
        if(!st.hasMoreTokens())
            return br.readLine();
        String ret = st.nextToken();
        while(st.hasMoreTokens())
            ret += " " + st.nextToken();
        return ret;
    }
}

}


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

public class E {
    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 FastReader scn = new FastReader();

    public static void main(String[] args) {
        int t = 1;
        while(t-- > 0) run();
    }

    public static void run() {
        int n = scn.nextInt();

        int l = 0, r = 0;
        StringBuilder res = new StringBuilder();

        for(int i = 0; i<n; i++){
            char ch = scn.next().charAt(0);
            int a = scn.nextInt();
            int b = scn.nextInt();

            if(a>b){
                int t = a;
                a = b;
                b = t;
            }
            if (ch == '+') {
                l = Math.max(l,a);
                r = Math.max(r,b);
            }else {
                if(a>=l && b>=r) res.append("YES\n");
                else res.append("NO\n");
            }
        }

        System.out.println(res);
    }
}


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

public class E {
    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 FastReader scn = new FastReader();

    public static void main(String[] args) {
        int t = 1;
        while(t-- > 0) run();
    }

    public static void run() {
        int n = scn.nextInt();

        int l = 0, r = 0;

        for(int i = 0; i<n; i++){
            char ch = scn.next().charAt(0);
            int a = scn.nextInt();
            int b = scn.nextInt();

            if(a>b){
                int t = a;
                a = b;
                b = t;
            }
            if (ch == '+') {
                l = Math.max(l,a);
                r = Math.max(r,b);
            }else {
                if(a>=l && b>=r) System.out.println("YES");
                else System.out.println("NO");
            }
        }
    }
}


import java.lang.*;
import java.util.*;
public class job{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	boolean bool=true;
	LinkedHashMap<Integer,Integer> arr= new LinkedHashMap<Integer,Integer>();
	int n=sc.nextInt();
	for(int i=0;i<n;i++){
	    bool=true;
      String c=sc.next();
       if(c.equals("+"))
       arr.put(sc.nextInt(),sc.nextInt());
      if(c.equals("?")){
      int h=sc.nextInt();
      int w=sc.nextInt();
      for(Map.Entry<Integer,Integer>e:arr.entrySet()){
        int a=e.getKey();
        int b=e.getValue();
        if(!((a<=h&&b<=w)||(a<=w&&b<=h))){
        bool=false;
        break;
        }}
        if(!bool)
        System.out.println("NO");
        else
       System.out.println("YES");
      }
	}
	}
}


import java.lang.*;
import java.util.*;
public class job{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	int n=sc.nextInt();
	int max=0,min=0;
	for(int i=0;i<n;i++){
      String c=sc.next();
       int a=sc.nextInt();
      int b=sc.nextInt();
      if(a<b){
      int temp=a;a=b;b=temp;
      }
       if(c.charAt(0)=='+'){
       if(min<a)
       min=a;
       if(max<b)
       max=b;}
      if(c.charAt(0)=='?'){
        System.out.println((a>=min&&b>=max)?"YES":?NO);
      }
	}
	}
}


import java.io.*;
import java.util.*;
public class job{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	PrintWriter p=new PrintWriter(System.out);
	int n=sc.nextInt();
	int max=0,min=0;
	for(int i=0;i<n;i++){
      String c=sc.next();
       int a=sc.nextInt();
      int b=sc.nextInt();
      if(a<b){
      int temp=a;a=b;b=temp;
      }
       if(c.charAt(0)=='+'){
       if(min<a)
       min=a;
       if(max<b)
       max=b;}
      else
        p.println(a>=min&&b>=max?"YES":"NO");
	}
	p.flush();
	}
}


import java.lang.*;
import java.util.*;
public class job{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	int n=sc.nextInt();
	int max=0,min=0;
	for(int i=0;i<n;i++){
      String c=sc.next();
       int a=sc.nextInt();
      int b=sc.nextInt();
      if(a<b){
      int temp=a;a=b;b=temp;
      }
       if(c.equals("+")){
       if(min<a)
       min=a;
       if(max<b)
       max=b;}
      if(c.equals("?")){
        if(a>=min&&b>=max)
        System.out.println("YES");
        else
        System.out.println("NO");
      }
	}
	}
}


import java.lang.*;
import java.util.*;
public class job{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	int n=sc.nextInt();
	int max=0,min=0;
	for(int i=0;i<n;i++){
      String c=sc.next();
       int a=sc.nextInt();
      int b=sc.nextInt();
      if(a<b){
      int temp=a;a=b;b=temp;
      }
       if(c.charAt(0)=='+'){
       if(min<a)
       min=a;
       if(max<b)
       max=b;}
      if(c.charAt(0)=='?'){
        System.out.println((a>=min&&b>=max)?"YES":"NO");
      }
	}
	}
}


import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Main
{
    public static void main(String[] args)throws IOException
    {
        FastReader in=new FastReader(System.in);
        StringBuffer st=new StringBuffer();
        int n=in.nextInt();
        n-=1;
        String p=in.next();
        int a=in.nextInt(),b=in.nextInt();
        int d=Math.min(a,b),h=Math.max(a,b);
        a=d;b=h;
        while(n--!=0){
          String s=in.next();int x=in.nextInt(),y=in.nextInt();

          if(s.equals("+")){
            d=Math.min(x,y);h=Math.max(x,y);
            x=d;y=h;
            a=Math.max(x,a);
            b=Math.max(y,b);
          }
          else{
           // System.out.println(a+" "+b+" "+x+" "+y);
            if((a<=x&&b<=y)||(a<=y&&b<=x))
            st.append("YES\n");
            else
            st.append("NO\n");
          }
        }

        System.out.print(st);
    }
    static class FastReader{

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }

        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


import java.util.Scanner;

public class E {

    private final static Scanner br = new Scanner(System.in);
    //private final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private final static StringBuilder sb = new StringBuilder();

    public static void main(String[] args) {

        int n = br.nextInt();
        br.nextLine();
        int biggestX = Integer.MIN_VALUE;
        int biggestY = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            String type = br.next();
                int x = br.nextInt();
                int y = br.nextInt();
                if(y > x){
                    int t = x;
                    x = y;
                    y = t;
                }
            if(type.equals("+")){
                if(x > biggestX){
                    biggestX = x;
                }

                if(y > biggestY){
                    biggestY = y;
                }
            } else {
                if(x < biggestX || y < biggestY){
                    System.out.println("NO");
                } else {
                    System.out.println("YES");
                }
            }

        }

        System.out.print(sb.toString());
    }
}


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

public class E {

    //private final static Scanner br = new Scanner(System.in);
    private final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private final static StringBuilder sb = new StringBuilder();

    public static void main(String[] args) throws IOException {

        int n = Integer.parseInt(br.readLine());
        int biggestX = Integer.MIN_VALUE;
        int biggestY = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            String[] parts = br.readLine().split(" ");
            String type = parts[0];
                int x = Integer.parseInt(parts[1]);
                int y =  Integer.parseInt(parts[2]);
                if(y > x){
                    int t = x;
                    x = y;
                    y = t;
                }
            if(type.equals("+")){
                if(x > biggestX){
                    biggestX = x;
                }

                if(y > biggestY){
                    biggestY = y;
                }
            } else {
                if(x < biggestX || y < biggestY){
                    sb.append("NO").append('\n');
                } else {
                    sb.append("YES").append('\n');
                }
            }
        }

        System.out.print(sb.toString());
    }
}


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

public class main{
	static Read in;
	static ArrayList<Integer> g;

	public static void main(String args[]){
		in = new Read();
		int n = in.nextInt(), curx = 0, cury = 0;

		while (n-->0){
			String c = in.next();
			int x = in.nextInt(), y = in.nextInt();

			int mx = Math.max(x,y), mn = Math.min(x,y);

			if (c.equals("+")){
				curx = Math.max(curx,mx);
				cury = Math.max(cury,mn);
			} else if (mx>=curx && mn>=cury)
				System.out.print("YES\n");
			else
				System.out.print("NO\n");

			System.out.println(curx+" "+cury);
		}

	}

	static private class Read{
		BufferedReader br;
		StringTokenizer st;
		public Read(){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());}
		double nextDouble(){return Double.parseDouble(next());}
		long nextLong(){return Long.parseLong(next());}
		String line(){
			String ans ="";
			try {ans = br.readLine();}
			catch(IOException e){e.printStackTrace();}
			return ans;
		}
	}

}


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

public class main{
	static Read in;
	static ArrayList<Integer> g;

	public static void main(String args[]){
		in = new Read();
		int n = in.nextInt(), curx = 0, cury = 0;

		while (n-->0){
			String c = in.next();
			int x = in.nextInt(), y = in.nextInt();

			int mx = Math.max(x,y), mn = Math.min(x,y);

			if (c.equals("+")){
				curx = Math.max(curx,mx);
				cury = Math.max(cury,mn);
			} else if (mx>=curx && mn>=cury)
				System.out.print("YES\n");
			else
				System.out.print("NO\n");

		}

	}

	static private class Read{
		BufferedReader br;
		StringTokenizer st;
		public Read(){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());}
		double nextDouble(){return Double.parseDouble(next());}
		long nextLong(){return Long.parseLong(next());}
		String line(){
			String ans ="";
			try {ans = br.readLine();}
			catch(IOException e){e.printStackTrace();}
			return ans;
		}
	}

}


//  package CF;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class ecf {

    public static void main(String[] args) {
        in = new FastReader();
       int n=ni();
       int low=0;
       int hi=0;
        StringBuilder sb=new StringBuilder();
       for (int i=0;i<n;i++){
           String str=n();
           char cc=str.charAt(0);
           if (cc=='+'){
               ArrayList<Integer> al=new ArrayList<>();
               al.add(ni());
               al.add(ni());
               Collections.sort(al);
               low=Math.max(low,al.get(0));
               hi=Math.max(hi,al.get(1));
           }else{

               int a=ni();
               int b=ni();
               ArrayList<Integer> al=new ArrayList<>();
               al.add(a);
               al.add(b);
               Collections.sort(al);
               if (a>=low&&b>=hi){
                   sb.append("YES").append("\n");
               }else{
                   sb.append("NO").append("\n");
               }
           }

       }
        System.out.print(sb.toString());
    }
    static class pair{
        int x;
        int y;
        pair(int x,int y){
            this.x=x;
            this.y=y;
        }
    }
    public static long binarySearch(long low, long high) {
        while (high - low > 1) {
            long mid = (high - low)/2 + low;
            //System.out.println(mid);
            if (works(mid)) {
                high = mid;
            } else {
                low = mid;
            }
        }
        return (works(low) ? low : high);
    }
    private static String toString(List<Integer> list) {
        StringBuilder result = new StringBuilder();
        for(int x : list) {
            result.append(x + " ");
        }
        return result.toString();
    }
    //     static long ncr(int n,int r)
//     {
//         if(n<0 || r<0 || n<r)
//             return 0;
//         return nCr[n][r];
//     }
    public static void sortbyColumn(int arr[][], int col)
    {
        //this method is taken from geeks for geeks
        // Using built-in sort function Arrays.sort
        Arrays.sort(arr, new Comparator<int[]>() {

            @Override
            // Compare values according to columns
            public int compare(final int[] entry1,
                               final int[] entry2) {

                // To sort in descending order revert
                // the '>' Operator
                if (entry1[col] > entry2[col])
                    return 1;
                else
                    return -1;
            }
        });  // End of function call sort().
    }

    private static Set<Integer> getPrime(int value) {

        Set<Integer> set = new HashSet<>();
        for (int i = 2;i * i <= value;i ++) {
            if (value % i == 0) {
                while (value % i == 0) {
                    value /= i;
                }
                set.add(i);
            }
        }
        if (value > 1) {
            set.add(value);
        }
        return set;

    }
    static class Graph{
        ArrayList<Integer> al_array[];
        int nodes;
        Graph(int no){
            this.nodes=no;
            this.al_array=new ArrayList[no];
            for (int i=0;i<no;i++){
                al_array[i]=new ArrayList<>();
            }
        }
        void addDir(int i,int j){
            this.al_array[i].add(j);
        }
        void addUndir(int i,int j){
            this.al_array[i].add(j);
            this.al_array[j].add(i);
        }
        Graph compliment(){
            Graph com=new Graph(this.nodes);
            for (int i=0;i<this.nodes;i++){
                ArrayList<Integer> al=this.al_array[i];
                for (int j=0;j<al.size();j++){
                    int node=al.get(j);
                    com.addDir(node,i);
                }
            }
            return com;
        }

    }
    static void  printLN2DArray(int[][] arr){
        StringBuilder sb=new StringBuilder();
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                sb.append(arr[i][j]).append(" ");
            }
            sb.append("\n");
        }
        System.out.println(sb.toString());
    }
    static long fast_exp_with_mod(long base, long exp) {
        long MOD=1000000000+7;
        long res=1;
        while(exp>0) {
            if(exp%2==1) res=(res*base)%MOD;
            base=(base*base)%MOD;
            exp/=2;
        }
        return res%MOD;
    }
    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
    static class my_no{
        long num;
        long denom;

        @Override
        public String toString() {
            if (denom<0){
                this.num=-this.num;
                this.denom=-this.denom;
            }
            if (num==0)return "0";
            return (num+"/"+denom);
        }

        my_no(int no){
            this.num=no;
            this.denom=1;
        }
        my_no(long num,long denom){
            this.num=num;
            this.denom=denom;
        }

        my_no multiply(my_no obj){
            long num1=obj.num;
            long denom1=obj.denom;
            long n=num1*num;
            long d=denom1*denom;
            long gcd=gcd(n,d);
            n/=gcd;
            d/=gcd;
            return new my_no(n,d);

        }
//        my_no multiply(my_no obj){
//            long num1=obj.num;
//            long denom1=obj.denom;
//            long num2=this.num;
//            long denom2=this.denom;
//
//        }

        my_no multiply(int no){
            long n=num*no;
            long d=denom;
            long gcd=gcd(n,d);
            n/=gcd;
            d/=gcd;
            return new my_no(n,d);

        }
    }

    static void memset(int[][] arr,int val){
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                arr[i][j]=val;
            }
        }
    }
    static void memset(int[] arr,int val){
        for (int i=0;i<arr.length;i++){
            arr[i]=val;
        }
    }

    static void memset(long[][] arr,long val){
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                arr[i][j]=val;
            }
        }
    }
    static void memset(long[] arr,long val){
        for (int i=0;i<arr.length;i++){
            arr[i]=val;
        }
    }
    static private boolean works(long test){
        return true;
    }

    static void reverse(char[] arr ,int i,int j){
        if (i==j)
            return;
        while (i<j){
            char temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
            ++i;
            --j;
        }
    }
    static int[]  takeIntegerArrayInput(int no){
        int[] arr=new int[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static long fast_Multiply(long no , long pow){
        long result=1;
        while (pow>0){
            if ((pow&1)==1){
                result=result*no;
            }
            no=no*no;
            pow>>=1;
        }
        return result;
    }

    static long[]  takeLongArrayInput(int no){
        long[] arr=new long[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static final long MOD = (long)20011;
    static FastReader in;

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static int[] ia(int N){
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

    static long[] la(int N){
        long[] a = new long[N];
        for(int i = 0; i<N; i++)a[i] = nl();
        return a;
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    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();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static void println(String[] arr){
        for (int i=0;i<arr.length;++i){
            System.out.println(arr[i]);
        }
    }

}


// package CF;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class ecf {

    public static void main(String[] args) {
        in = new FastReader();
       int n=ni();
       int low=0;
       int hi=0;
        StringBuilder sb=new StringBuilder();
       for (int i=0;i<n;i++){
           String str=n();
           char cc=str.charAt(0);
           if (cc=='+'){
               ArrayList<Integer> al=new ArrayList<>();
               al.add(ni());
               al.add(ni());
               Collections.sort(al);
               low=Math.max(low,al.get(0));
               hi=Math.max(hi,al.get(1));
           }else{

               int a=ni();
               int b=ni();
               ArrayList<Integer> al=new ArrayList<>();
               al.add(a);
               al.add(b);
               Collections.sort(al);
               a=al.get(0);
               b=al.get(1);
               if (a>=low&&b>=hi){
                   sb.append("YES").append("\n");
               }else{
                   sb.append("NO").append("\n");
               }
           }

       }
        System.out.print(sb.toString());
    }
    static class pair{
        int x;
        int y;
        pair(int x,int y){
            this.x=x;
            this.y=y;
        }
    }
    public static long binarySearch(long low, long high) {
        while (high - low > 1) {
            long mid = (high - low)/2 + low;
            //System.out.println(mid);
            if (works(mid)) {
                high = mid;
            } else {
                low = mid;
            }
        }
        return (works(low) ? low : high);
    }
    private static String toString(List<Integer> list) {
        StringBuilder result = new StringBuilder();
        for(int x : list) {
            result.append(x + " ");
        }
        return result.toString();
    }
    //     static long ncr(int n,int r)
//     {
//         if(n<0 || r<0 || n<r)
//             return 0;
//         return nCr[n][r];
//     }
    public static void sortbyColumn(int arr[][], int col)
    {
        //this method is taken from geeks for geeks
        // Using built-in sort function Arrays.sort
        Arrays.sort(arr, new Comparator<int[]>() {

            @Override
            // Compare values according to columns
            public int compare(final int[] entry1,
                               final int[] entry2) {

                // To sort in descending order revert
                // the '>' Operator
                if (entry1[col] > entry2[col])
                    return 1;
                else
                    return -1;
            }
        });  // End of function call sort().
    }

    private static Set<Integer> getPrime(int value) {

        Set<Integer> set = new HashSet<>();
        for (int i = 2;i * i <= value;i ++) {
            if (value % i == 0) {
                while (value % i == 0) {
                    value /= i;
                }
                set.add(i);
            }
        }
        if (value > 1) {
            set.add(value);
        }
        return set;

    }
    static class Graph{
        ArrayList<Integer> al_array[];
        int nodes;
        Graph(int no){
            this.nodes=no;
            this.al_array=new ArrayList[no];
            for (int i=0;i<no;i++){
                al_array[i]=new ArrayList<>();
            }
        }
        void addDir(int i,int j){
            this.al_array[i].add(j);
        }
        void addUndir(int i,int j){
            this.al_array[i].add(j);
            this.al_array[j].add(i);
        }
        Graph compliment(){
            Graph com=new Graph(this.nodes);
            for (int i=0;i<this.nodes;i++){
                ArrayList<Integer> al=this.al_array[i];
                for (int j=0;j<al.size();j++){
                    int node=al.get(j);
                    com.addDir(node,i);
                }
            }
            return com;
        }

    }
    static void  printLN2DArray(int[][] arr){
        StringBuilder sb=new StringBuilder();
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                sb.append(arr[i][j]).append(" ");
            }
            sb.append("\n");
        }
        System.out.println(sb.toString());
    }
    static long fast_exp_with_mod(long base, long exp) {
        long MOD=1000000000+7;
        long res=1;
        while(exp>0) {
            if(exp%2==1) res=(res*base)%MOD;
            base=(base*base)%MOD;
            exp/=2;
        }
        return res%MOD;
    }
    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
    static class my_no{
        long num;
        long denom;

        @Override
        public String toString() {
            if (denom<0){
                this.num=-this.num;
                this.denom=-this.denom;
            }
            if (num==0)return "0";
            return (num+"/"+denom);
        }

        my_no(int no){
            this.num=no;
            this.denom=1;
        }
        my_no(long num,long denom){
            this.num=num;
            this.denom=denom;
        }

        my_no multiply(my_no obj){
            long num1=obj.num;
            long denom1=obj.denom;
            long n=num1*num;
            long d=denom1*denom;
            long gcd=gcd(n,d);
            n/=gcd;
            d/=gcd;
            return new my_no(n,d);

        }
//        my_no multiply(my_no obj){
//            long num1=obj.num;
//            long denom1=obj.denom;
//            long num2=this.num;
//            long denom2=this.denom;
//
//        }

        my_no multiply(int no){
            long n=num*no;
            long d=denom;
            long gcd=gcd(n,d);
            n/=gcd;
            d/=gcd;
            return new my_no(n,d);

        }
    }

    static void memset(int[][] arr,int val){
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                arr[i][j]=val;
            }
        }
    }
    static void memset(int[] arr,int val){
        for (int i=0;i<arr.length;i++){
            arr[i]=val;
        }
    }

    static void memset(long[][] arr,long val){
        for (int i=0;i<arr.length;i++){
            for (int j=0;j<arr[i].length;j++){
                arr[i][j]=val;
            }
        }
    }
    static void memset(long[] arr,long val){
        for (int i=0;i<arr.length;i++){
            arr[i]=val;
        }
    }
    static private boolean works(long test){
        return true;
    }

    static void reverse(char[] arr ,int i,int j){
        if (i==j)
            return;
        while (i<j){
            char temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
            ++i;
            --j;
        }
    }
    static int[]  takeIntegerArrayInput(int no){
        int[] arr=new int[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static long fast_Multiply(long no , long pow){
        long result=1;
        while (pow>0){
            if ((pow&1)==1){
                result=result*no;
            }
            no=no*no;
            pow>>=1;
        }
        return result;
    }

    static long[]  takeLongArrayInput(int no){
        long[] arr=new long[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static final long MOD = (long)20011;
    static FastReader in;

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static int[] ia(int N){
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

    static long[] la(int N){
        long[] a = new long[N];
        for(int i = 0; i<N; i++)a[i] = nl();
        return a;
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    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();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static void println(String[] arr){
        for (int i=0;i<arr.length;++i){
            System.out.println(arr[i]);
        }
    }

}


#include<iostream>
using namespace std;
int main()
{
	int n,count,i;
	char ch;
	long long maxx,maxy,h,w,x,y,g,d;
	while(scanf("%d",&n)!=EOF)
	{
		maxx=maxy=0;
		count=0;
		for(i=0;i<n;i++)
		{
			getchar();
			scanf("%c%lld%lld",&ch,&x,&y);
			if(x>y)
			{
				g=x;
				d=y;
			}
			else
			{
				g=y;d=x;
			}
			if(ch=='+')
			{
				if(g>maxx)
				maxx=g;
				if(d>maxy)
				maxy=d;
			}
			else
			{
				h=g;
				w=d;
				if(h>=maxx&&w>=maxy)
				printf("YES\n");
				else
				printf("NO\n");
			}
		}
	}
	return 0;
 }


#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string>
#include<string.h>
#include<queue>
#include<stack>
#include<iostream>
#include<cstdio>

using namespace std;

char s[500005];
int main()
{
	int n; scanf("%d", &n);
	int maxh = 0, maxw = 0;
	for (int i = 0; i < n; i++) {
		char c; int a, b;
		scanf(" %c %d %d", &c, &a, &b);
		if (a > b) swap(a, b);
		if (c == '+') {
			maxh = max(maxh, a);
			maxw = max(maxw, b);
		}
		else {
			if (maxh > a || maxw > b) {
				printf("NO\n");
			}
			else printf("YES\n");
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inFile(t) freopen((t),"r",stdin)
#define outFile(t) freopen((t),"w",stdout)
#define pb push_back
#define pf push_front
#define Pb pop_back
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define Pf pop_front
#define sz size
#define MP make_pair
#define Pc __builtin_popcount
#define pi 2*acos(0)
#define BiEdge(v,a,b,c) (v)[(a)].pb({b,c}),(v)[(b)].pb(({a,c}))
#define mod 1000000007
#define point complex<ld>
#define X real()
#define Y imag()
#define coordinate pair<ld,ll>
#define cross(a,b)(conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define rectangle pair<coordinate,coordinate>
#define line tuple<ll,ll,ll>
#define EPS 1e-7
#define polygon vector<point>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int const N = 1e5+5,M = 105;
using namespace std;

int n,highx1,highy1,highx2,highy2,x,y;
char c;
int main()
{
    //abdelrahman001
    scanf("%d",&n);
    while(n--)
    {
        scanf(" %c%d%d",&c,&x,&y);
        if(x>y)swap(x,y);
        if(c == '+')
        {
            if(x>highx1)
                highx1 = x,highy1 =y;
            if(y>highy2)
                highx2 = x,highy2 =y;
        }
        else
            ((x>=highx1 && y>=highy1)||(x>=highx2 && y>highy2))?puts("YES"):puts("NO");
    }
    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main()
{
    int n;
    cin >> n;
    int highx=0,highy=0,highx1=0;
    while(n--) {
        char c;
        cin >> c;
        if(c == '+') {
            int x,y;
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            int h,w;
            cin >> h >>w;
            if(min(highx,highx1) <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (min(highx,highx1) <=w && highy <= h) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inFile(t) freopen((t),"r",stdin)
#define outFile(t) freopen((t),"w",stdout)
#define pb push_back
#define pf push_front
#define Pb pop_back
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define Pf pop_front
#define sz size
#define MP make_pair
#define Pc __builtin_popcount
#define pi 2*acos(0)
#define BiEdge(v,a,b,c) (v)[(a)].pb({b,c}),(v)[(b)].pb(({a,c}))
#define mod 1000000007
#define point complex<ld>
#define X real()
#define Y imag()
#define coordinate pair<ld,ll>
#define cross(a,b)(conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define rectangle pair<coordinate,coordinate>
#define line tuple<ll,ll,ll>
#define EPS 1e-7
#define polygon vector<point>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int const N = 1e5+5,M = 105;
using namespace std;

int n,highx1,highy1,highx2,highy2,x,y;
char c;
int main()
{
    //abdelrahman001
    scanf("%d",&n);
    while(n--)
    {
        scanf(" %c%d%d",&c,&x,&y);
        if(x>y)swap(x,y);
        if(c == '+')
        {
            if(x>highx1)
                highx1 = x,highy1 =y;
            if(y>highy2)
                highx2 = x,highy2 =y;
        }
        else
            ((x>=highx1 && y>=highy1)&&(x>=highx2 && y>=highy2))?puts("YES"):puts("NO");
    }
    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main()
{
    int n;
    cin >> n;
    int highx=0,highy=0,highx1=0;
    while(n--) {
        char c;
        cin >> c;
        if(c == '+') {
            int x,y;
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            int h,w;
            cin >> h >>w;
            if(highx <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx <=w && highy <= h) {
                cout << "YES" << endl;
            } else if (highx1 <= w && highy<=h){
                cout << "YES" << endl;
            } else if (highx1 <= h && highy <= w) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define AbdelrahmanAhmed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;

using namespace std;

int main()
{
    AbdelrahmanAhmed
    int n;
    cin >> n;
    int highx=0,highy=0,highx1=0;
    int x,y,h,w;
    char c;
    while(n--) {
        cin >> c;
        if(c == '+') {
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            cin >> h >>w;
            if(highx <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx<=w && highy <= h) {
                cout << "YES" << endl;
            }if(highx1 <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx1<=w && highy <= h) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inFile(t) freopen((t),"r",stdin)
#define outFile(t) freopen((t),"w",stdout)
#define pb push_back
#define pf push_front
#define Pb pop_back
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define Pf pop_front
#define sz size
#define MP make_pair
#define Pc __builtin_popcount
#define pi 2*acos(0)
#define BiEdge(v,a,b,c) (v)[(a)].pb({b,c}),(v)[(b)].pb(({a,c}))
#define mod 1000000007
#define point complex<ld>
#define X real()
#define Y imag()
#define coordinate pair<ld,ll>
#define cross(a,b)(conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define rectangle pair<coordinate,coordinate>
#define line tuple<ll,ll,ll>
#define EPS 1e-7
#define polygon vector<point>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int const N = 1e5+5,M = 105;
using namespace std;

int n,highx1,highy1,highx2,highy2,x,y;
char c;
int main()
{
    //abdelrahman001
    scanf("%d",&n);
    while(n--)
    {
        scanf(" %c%d%d",&c,&x,&y);
        if(x>y)swap(x,y);
        if(c == '+')
        {
            if(x>highx1)
                highx1 = x,highy1 =y;
            if(y>highy2)
                highx2 = x,highy2 =y;
        }
        else
            ((x>=highx1 && y>=highy1)&&(x>=highx2 && y>highy2))?puts("YES"):puts("NO");
    }
    return 0;
}


#include <bits/stdc++.h>
#define AbdelrahmanAhmed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;

using namespace std;

int main()
{
    AbdelrahmanAhmed
    int n;
    cin >> n;
    int highx=0,highy=0,highx1=0;
    int x,y,h,w;
    char c;
    while(n--) {
        cin >> c;
        if(c == '+') {
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            cin >> h >>w;
            if(highx <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx<=w && highy <= h) {
                cout << "YES" << endl;
            }else if(highx1 <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx1<=w && highy <= h) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inFile(t) freopen((t),"r",stdin)
#define outFile(t) freopen((t),"w",stdout)
#define pb push_back
#define pf push_front
#define Pb pop_back
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define Pf pop_front
#define sz size
#define MP make_pair
#define Pc __builtin_popcount
#define pi 2*acos(0)
#define BiEdge(v,a,b,c) (v)[(a)].pb({b,c}),(v)[(b)].pb(({a,c}))
#define mod 1000000007
#define point complex<ld>
#define X real()
#define Y imag()
#define coordinate pair<ld,ll>
#define cross(a,b)(conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define rectangle pair<coordinate,coordinate>
#define line tuple<ll,ll,ll>
#define EPS 1e-7
#define polygon vector<point>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int const N = 1e5+5,M = 105;
using namespace std;

int n,highx,highy,high,x,y;
char c;
int main()
{
    abdelrahman001
    cin >> n;
    for(int i = 0;i<n;i++)
    {
        cin >> c >> x >> y;
        if(c == '+')
            highx = max(highx,x),highy = max(highy,y),high=max(high,min(x,y));
        else
            ((x>=highx && y>=highy) || (x>=highy && y>=highx) || (x>=highy && y>=high) || (x>=high && y>=highx) || (x>=highx && y>=high) || (x>=high && y>=highy))?cout << "YES\n":cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll highx=0,highy=0,highx1=0;
    while(n--) {
        char c;
        cin >> c;
        if(c == '+') {
            ll x,y;
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            ll h,w;
            cin >> h >>w;
            if(highx <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (highx <=w && highy <= h) {
                cout << "YES" << endl;
            } else if (highx1 <= w && highy<=h){
                cout << "YES" << endl;
            } else if (highx1 <= h && highy <= w) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inFile(t) freopen((t),"r",stdin)
#define outFile(t) freopen((t),"w",stdout)
#define pb push_back
#define pf push_front
#define Pb pop_back
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define Pf pop_front
#define sz size
#define MP make_pair
#define Pc __builtin_popcount
#define pi 2*acos(0)
#define BiEdge(v,a,b,c) (v)[(a)].pb({b,c}),(v)[(b)].pb(({a,c}))
#define mod 1000000007
#define point complex<ld>
#define X real()
#define Y imag()
#define coordinate pair<ld,ll>
#define cross(a,b)(conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define rectangle pair<coordinate,coordinate>
#define line tuple<ll,ll,ll>
#define EPS 1e-7
#define polygon vector<point>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int const N = 1e5+5,M = 105;
using namespace std;

int n,highx,highy,x,y;
char c;
int main()
{
    abdelrahman001
    cin >> n;
    for(int i = 0;i<n;i++)
    {
        cin >> c >> x >> y;
        if(c == '+')
            highx = max(highx,x),highy = max(highy,y);
        else
            ((x>=highx && y>=highy) || (x>=highy && y>=highx))?cout << "YES\n":cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define AbdelrahmanAhmed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;

using namespace std;

int main()
{
    AbdelrahmanAhmed
    int n;
    cin >> n;
    int highx=0,highy=0,highx1=0;
    int x,y,h,w;
    char c;
    while(n--) {
        cin >> c;
        if(c == '+') {
            cin >> x >> y;
            highx = max(x,highx);
            highy = max(y,highy);
            highx1 = max(highx1 , min(x,y));
        } else {
            cin >> h >>w;
            if(min(highx,highx1) <= h && highy<=w) {
                cout << "YES" << endl;
            } else if (min(highx,highx1) <=w && highy <= h) {
                cout << "YES" << endl;
            } else {
                cout << "NO" << endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long mn(long x, long y)
{
  return  y + ((x - y) & ((x - y) >>
            (sizeof(long) * CHAR_BIT - 1)));
}

/*Function to find maximum of x and y*/
long mx(long x, long y)
{
  return x - ((x - y) & ((x - y) >>
            (sizeof(long) * CHAR_BIT - 1)));
}
main(){
	long n,z,y,h,w,p=0,q=0;
	cin>>n;
	char x;
	while(n--)
	{  cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	h=mx(y,z);
      	w=mn(y,z);

	     p=mx(h,p);
	     q=mx(q,w);
	  }
	  else{
	  //	cout<<p<<" "<<q<<endl;
	   cin>>y>>z;
      h=mx(z,y);
      	w=mn(z,y);
      	if(p<=h&&q<=w)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
#define debug_iv_ac ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
main(){
	debug_iv_ac
	long long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	   cin>>x>>y>>z;;
      if(x=='+'){
       if(y>z)  swap(y,z);
	  	p=max(z,p);
	  	 q=max(y,q);
	     continue;
	  }
	  else{

      	 if((p<=y&&q<=z)||(p<=z&&q<=y))
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
#define debug_iv_ac ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
main(){
	 debug_iv_ac
	long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	h=max(y,z);
      	w=min(y,z);
	    p=max(h,p);
	    q=max(q,w);
	  }
	  else{
	   cin>>y>>z;
         h=max(z,y);
      	 w=min(z,y);
      	if(p<=h&&q<=w)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	   cin>>x;
      if(x=='+'){
      	cin>>y>>z;
       if(y>z)
       {p=max(y,p);
	    q=max(q,z);}
	  else
	  {
	  	p=max(z,p);
	  	 q=max(y,q);
	  }
	  }
	  else{
	     cin>>y>>z;
         h=max(z,y);
      	 w=min(z,y);
      	 if(p<=h && q<=w)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long n,z,y,h,w,p=0,q=0;
	cin>>n;
	char x;
	while(n--)
	{  cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	h=max(y,z);
      	w=min(y,z);

	     p=max(h,p);
	     q=max(q,w);
	  }
	  else{
	  //	cout<<p<<" "<<q<<endl;
	   cin>>y>>z;
      h=max(z,y);
      	w=min(z,y);
      	if(p<=h&&q<=w)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	h=max(y,z);
      	w=min(y,z);
	    p=max(h,p);
	    q=max(q,w);
	  }
	  else{
	   cin>>y>>z;
         h=max(z,y);
      	 w=min(z,y);
      	if(p<=h&&q<=w)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	   cin>>x>>y>>z;;
      if(x=='+'){
       if(y>z)  swap(y,z);
	  	p=max(z,p);
	  	 q=max(y,q);
	     continue;
	  }
	  else{

      	 if((p<=y&&q<=z)||(p<=z&&q<=y))
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long n,z,y,h,w,p=0,q=0;
	cin>>n;
	char x;
	while(n--)
	{  cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	if(z>y)
      	{  z=y+z;
      	   y=z-y;
      	   z=z-y;}
	   if(y>p)
	     p=y;
	  if(z>q)
	     q=z;
	  }
	  else{
	  	cout<<p<<" "<<q<<endl;
	   cin>>y>>z;
      	if(z>y)
      	{  z=y+z;
      	   y=z-y;
      	   z=z-y;}
      	if(p<=y&&q<=z)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long long n,z,y,h,w,p=0,q=0,i=0;
	cin>>n;
	char x;
	while(i<n)
	{  i++;
	   cin>>x>>y>>z;;
      if(x=='+'){
       if(y>z)  swap(y,z);
	  	p=max(z,p);
	  	 q=max(y,q);
	     continue;
	  }
	  else{

      	 if(p<=max(y,z) && q<=min(y,z))
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;
main(){
	long n,z,y,h,w,p=0,q=0;
	cin>>n;
	char x;
	while(n--)
	{  cin>>x;
      if(x=='+'){
      	cin>>y>>z;
      	if(z>y)
      	{  z=y+z;
      	   y=z-y;
      	   z=z-y;}
	   if(y>p)
	     p=y;
	  if(z>q)
	     q=z;
	  }
	  else{
	  //	cout<<p<<" "<<q<<endl;
	   cin>>y>>z;
      	if(z>y)
      	{  z=y+z;
      	   y=z-y;
      	   z=z-y;}
      	if(p<=y&&q<=z)
      	  cout<<"YES"<<endl;
      	else
      	   cout<<"NO"<<endl;

	  }

	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	vector<pair<int, int>> v1, v2;
	pair<int, int> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	for (int i = 0;i < n;i++) {
		char a;
		int b, c;
		cin >> a >> b >> c;

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {
			int flag = 1;

				if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b))&& ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b)))  {
					flag = 0;
				}
				if (!flag) {
					cout << "YES" << endl;
				}
				else {
					cout << "NO" << endl;
				}
			}

		}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	long long n;
	scanf("%Ld", &n);
	pair<long long, long long> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	char a;
	long long b, c;
	while (n--) {
		scanf("\n%c", &a);
		scanf("%Ld %Ld", &b, &c);

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

			if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b)) && ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b))) {
				printf("YES \n");
			}
			else {
				printf("NO \n");
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	scanf("%d", &n);
	pair<int, int> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	char a;
	int b, c;
	while (n--) {
		scanf("%c", &a);
		scanf("%d", &b);
		scanf("%d", &c);

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

			if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b)) && ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b))) {
				printf("YES \n");
			}
			else {
				printf("NO \n");
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	pair<int, int> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	char a;
	int b, c;
	while (n--) {
		scanf("%c", &a);
		scanf("%d", &b);
		scanf("%d", &c);

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

			if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b)) && ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b))) {
				printf("YES \n");
			}
			else {
				printf("NO \n");
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	scanf("%d", &n);
	pair<int, int> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	char a;
	int b, c;
	while (--n) {
		scanf("%c", &a);
		scanf("%d", &b);
		scanf("%d", &c);

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

			if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b)) && ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b))) {
				printf("YES \n");
			}
			else {
				printf("NO \n");
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	vector<pair<int, int>> v1, v2;
	for (int i = 0;i < n;i++) {
		char a;
			int b, c;
		cin >> a >> b >> c;
		if (a =='+') {
			v1.push_back(make_pair(b,c));
		}
		if (a == '?') {
			int flag = 1;
			for (int i = 0;i < v1.size();i++) {
				if ((v1[i].first > b || v1[i].second > c) &&(v1[i].first > c || v1[i].second > b) ) {

					flag = 0;
				}

			}
			if (flag) {
				cout << "YES"<<endl;
			}
			else {
				cout << "NO" << endl;
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	vector<pair<int, int>> v1, v2;
	for (int i = 0;i < n;i++) {
		char a;
			int b, c;
		cin >> a >> b >> c;
		if (a =='+') {
			v1.push_back(make_pair(b,c));
		}
		if (a == '?') {
			int flag = 1;
			for (int i = 0;i < v1.size();i++) {
				if ((v1[i].first > b || v1[i].second > c) &&(v1[i].first > c || v1[i].second > b) ) {

					flag = 0;
					break;
				}

			}
			if (flag) {
				cout << "YES"<<endl;
			}
			else {
				cout << "NO" << endl;
			}
		}

	}

}


#include<bits/stdc++.h>

using namespace std;
vector<long long> factors;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false);

int main()
{
	IOS

	int n;
	cin >> n;
	ll mh = 0,ml = 0;

	for(int i = 0;i < n;++i){
		char que;
		cin >> que;
		if(que == '+'){
			int x,y;
			cin >> x >> y;
			if(x < y)
			{
				int temp = x;
				x = y;
				y = temp;
			}
			if(mh < y)
				mh = y;
			if(ml < x)
				ml = x;
		}else if(que == '?'){
			int h,w;
			cin >> h >> w;
			if(w < h)
			{
				int temp = h;
				h = w;
				w = temp;
			}
			if( mh <= h &&  ml <= w){
				cout << "YES\n";
			}else{
				cout << "NO\n";
			}
		}
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	scanf("%d", &n);
	pair<long long, long long> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	char a;
	int b, c;
	while (n--) {
		scanf("\n%c", &a);
		scanf("%Ld %Ld", &b, &c);

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

			if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b)) && ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b))) {
				printf("YES \n");
			}
			else {
				printf("NO \n");
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	pair<int, int> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	for (int i = 0;i < n;i++) {
		char a;
		int b, c;
		cin >> a >> b >> c;

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

				if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b))&& ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b)))  {
					cout << "YES" << endl;
				}
				else {
					cout << "NO" << endl;
				}
			}

		}

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	pair<long long, long long> mx, my;
	mx = make_pair(0, 0);
	my = make_pair(0, 0);
	for (int i = 0;i < n;i++) {
		char a;
		long long b, c;
		cin >> a >> b >> c;

		if (a == '+') {

			if (b > mx.first) {

				mx.first = b;
				mx.second = c;
			}
			if (c > my.second) {
				my.first = b;
				my.second = c;
			}
		}
		if (a == '?') {

				if (((mx.first <= b && mx.second <= c) || (mx.first <= c && mx.second <= b))&& ((my.first <= b && my.second <= c) || (my.first <= c && my.second <= b)))  {
					cout << "YES" << endl;
				}
				else {
					cout << "NO" << endl;
				}
			}

		}

}


#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define clean(a,k) memset(a, k, sizeof(a))
#define runner(i,k,m) for(i=k;i<=m;i++)
#define cases(T) cin>>T;while(T--)
using namespace std;
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll binaryExponentiation(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}
ll modInverse(ll A,ll M)
{
    return modularExponentiation(A,M-2,M);
}
int main()
{
    ll N,maxx=-1e9,maxy=-1e9,x,y;
    char c;
    cin>>N;
    for(ll i=0;i<N;i++)
    {
        cin>>c;
        if(c=='+')
        {
            cin>>x>>y;
            if(x>y) swap(x,y);
            maxx=max(maxx,x);
            maxy=max(maxy,y);
        }
        else if(c=='?')
        {
            cin>>x>>y;
            //if(x>y)swap(x,y);
            if(x>=maxx&&y>=maxy)    cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        //cout<<"\n"<<maxx<<" "<<maxy<<endl;
    }
}


#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 25;
const int MASK = 1 << 10;
const int INF = (LL)1e9 + 5;
const LL MOD = 998244353;

vector<LL> R;
LL dp1[MAXN][MASK][2], dp2[MAXN][MASK][2], K;

LL cntbit(LL mask) {
	LL cnt = 0;
	while (mask) {
		cnt += mask & 1;
		mask >>= 1;
	}
	return cnt;
}

LL qpow(LL a, LL p) {
	if (p == 0) return 1;
	LL ans = qpow(a, p >> 1);
	ans = ans * ans % MOD;
	if (p & 1) ans = ans * a % MOD;
	return ans;
}

LL dfs1(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return cntbit(mask) <= K;
	if (!lim && dp1[pos][mask][zero] != -1) return dp1[pos][mask][zero];

	LL ans = 0;
	for (LL i = 0; i <= (lim ? R[pos] : 9); i++) {
		LL nmask = zero && i == 0 ? mask : mask | 1 << i;
		ans = (ans + dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos])) % MOD;
	}

	if (!lim) dp1[pos][mask][zero] = ans;
	return ans;
}

LL dfs2(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return 0;
	if (!lim && dp2[pos][mask][zero] != -1) return dp2[pos][mask][zero];

	LL ans = 0, cnt = cntbit(mask);
	for (LL i = 0; i <= (lim ? R[pos] : 9); i++) {
		LL nmask = zero && i == 0 ? mask : mask | 1 << i;
		if (cnt == K && nmask != mask) continue;

		LL num = dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		LL pref = i * qpow(10, R.size() - pos - 1) % MOD;
		LL rem = dfs2(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		ans = (ans + pref * num % MOD + rem) % MOD;
	}

	if (!lim) dp2[pos][mask][zero] = ans;
	return ans;
}

LL solve(LL r) {
	if (r == 0) return 0;
	R.clear();
	while (r) {
		R.push_back(r % 10);
		r /= 10;
	}
	reverse(R.begin(), R.end());
	LL ans = dfs2(0, 0, true, true);
	return ans;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	memset(dp1, -1, sizeof(dp1));
	memset(dp2, -1, sizeof(dp2));

	LL l, r;
	cin >> l >> r >> K;
	cout << ((solve(r) - solve(l - 1)) % MOD + MOD) % MOD << "\n";

	return 0;

	/**** Note MAXN ****/
}


#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 25;
const int MASK = 1 << 10;
const LL MOD = 998244353;

vector<LL> R;
LL dp1[MAXN][MASK][2], dp2[MAXN][MASK][2], K;

LL cntbit(LL mask) {
	LL cnt = 0;
	while (mask) {
		cnt += mask & 1;
		mask >>= 1;
	}
	return cnt;
}

LL qpow(LL a, LL p) {
	if (p == 0) return 1;
	LL ans = qpow(a, p >> 1);
	ans = ans * ans % MOD;
	if (p & 1) ans = ans * a % MOD;
	return ans;
}

LL dfs1(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return cntbit(mask) <= K;
	if (!lim && dp1[pos][mask][zero] != -1) return dp1[pos][mask][zero];

	LL ans = 0;
	for (LL i = 0; i <= (lim ? R[pos] : 9); i++) {
		LL nmask = zero && i == 0 ? mask : mask | 1 << i;
		ans = (ans + dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos])) % MOD;
	}

	if (!lim) dp1[pos][mask][zero] = ans;
	return ans;
}

LL dfs2(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return 0;
	if (!lim && dp2[pos][mask][zero] != -1) return dp2[pos][mask][zero];

	LL ans = 0, cnt = cntbit(mask);
	for (LL i = 0; i <= (lim ? R[pos] : 9); i++) {
		LL nmask = zero && i == 0 ? mask : mask | 1 << i;
		if (cnt == K && nmask != mask) continue;

		LL num = dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		LL pref = i * qpow(10, R.size() - pos - 1) % MOD;
		LL rem = dfs2(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		ans = (ans + pref * num % MOD + rem) % MOD;
	}

	if (!lim) dp2[pos][mask][zero] = ans;
	return ans;
}

LL solve(LL r) {
	if (r == 0) return 0;
	R.clear();
	for (int i = 0; i < 20; i++) {
		R.push_back(r % 10);
		r /= 10;
	}
	reverse(R.begin(), R.end());
	LL ans = dfs2(0, 0, true, true);
	return ans;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	LL l, r;
	while (cin >> l >> r >> K) {
		memset(dp1, -1, sizeof(dp1));
		memset(dp2, -1, sizeof(dp2));
		LL ans = ((solve(r) - solve(l - 1)) % MOD + MOD) % MOD;
//		LL bfs = bruteforce(l, r);
//		cout << bfs << " " << ans << "\n"; assert(ans == bfs);
		cout << ans << "\n";
	}

	return 0;

	/**** Note MAXN ****/
}


#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 25;
const int MASK = 1 << 10;
const int INF = (LL)1e9 + 5;
const LL MOD = 998244353;

vector<LL> R;
LL dp1[MAXN][MASK][2], dp2[MAXN][MASK][2], K;

LL cntbit(LL mask) {
	LL cnt = 0;
	while (mask) {
		cnt += mask & 1;
		mask >>= 1;
	}
	return cnt;
}

LL qpow(LL a, LL p) {
	if (p == 0) return 1;
	LL ans = qpow(a, p >> 1);
	ans = ans * ans % MOD;
	if (p & 1) ans = ans * a % MOD;
	return ans;
}

LL dfs1(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return cntbit(mask) <= K;
	if (!lim && dp1[pos][mask][zero] != -1) return dp1[pos][mask][zero];

	LL ans = 0;
	for (int i = 0; i <= (lim ? R[pos] : 9); i++) {
		int nmask = zero && i == 0 ? mask : mask | 1 << i;
		ans = (ans + dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos])) % MOD;
	}

	if (!lim) dp1[pos][mask][zero] = ans;
	return ans;
}

LL dfs2(int pos, int mask, bool zero, bool lim) {
	if (pos == R.size()) return 0;
	if (!lim && dp2[pos][mask][zero] != -1) return dp2[pos][mask][zero];

	LL ans = 0, cnt = cntbit(mask);
	for (int i = 0; i <= (lim ? R[pos] : 9); i++) {
		int nmask = zero && i == 0 ? mask : mask | 1 << i;
		if (cnt == K && (~mask & 1 << i)) continue;

		LL num = dfs1(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		LL pref = i * qpow(10, R.size() - pos - 1) % MOD;
		LL rem = dfs2(pos + 1, nmask, zero && i == 0, lim && i == R[pos]);
		ans = (ans + pref * num % MOD + rem) % MOD;
	}

	if (!lim) dp2[pos][mask][zero] = ans;
	return ans;
}

LL solve(LL r) {
	if (r == 0) return 0;
	R.clear();
	while (r) {
		R.push_back(r % 10);
		r /= 10;
	}
	reverse(R.begin(), R.end());
	LL ans = dfs2(0, 0, true, true);
	return ans;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	memset(dp1, -1, sizeof(dp1));
	memset(dp2, -1, sizeof(dp2));

	LL l, r;
	cin >> l >> r >> K;
	cout << solve(r) - solve(l - 1) << "\n";

	return 0;

	/**** Note MAXN ****/
}