import java.util.*;
public class Main{
    static Scanner sc = new Scanner(System.in);
    static int mod = 1_000_000_007;
    public static void main(String[] args){
        int n = sc.nextInt();
        Stack<int[]>stack = new Stack<>();
        stack.push(new int[]{-1,n + 1});
        int index = 0;
        int[]ans = new int[n];
        boolean valid = true;
        for (int i = 0; i < n * 2; i++) {
            String c = sc.next();
            if(c.equals("+")){
                stack.add(new int[]{index++,0});
                continue;
            }
            int num = sc.nextInt();
            if(stack.peek()[1] >= num){
                System.out.println("NO");
                valid = false;
                break;
            }
            ans[stack.pop()[0]] = num;
            stack.peek()[1] = num;
        }
        if(valid){
            System.out.println("YES");
            for (int i = 0; i < ans.length; i++) {
                System.out.print(ans[i] + " ");
            }
        }
    }

    private static void solve() {
        long n = sc.nextLong();

    }

    private static ArrayList<ArrayList<Integer>>g(int n){
        ArrayList<ArrayList<Integer>> g = new ArrayList<>();
        for (int i = 0; i < (n + 1); i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            g.get(u).add(v);
            g.get(v).add(u);
        }
        return g;
    }
    private static int gcb(int a,int b){
        if(a == b)
            return a;
        if(a < b)
            return gcb(b,a);
        if(a % b == 0)
            return b;
        return gcb(b,a % b);
    }

    private static void printList(List<Long> arr){
        for(long i : arr){
            System.out.print(i + " ");
        }
        System.out.println();
    }
    private static void printArr(int[]arr){
        for(int i : arr){
            System.out.print(i + " ");
        }
        System.out.println();
    }
    private static int[]readArr(int len){
        int[]ans = new int[len];
        for(int i = 0;i < len;i++){
            ans[i] = sc.nextInt();
        }
        return ans;
    }
    private static long powmod(long a,long b){
        long res=1;
        for(long i=0;i<b;i++){
            res=res*a%mod;
        }
        return res;
    }
}


import java.util.*;
public class Main{
    static Scanner sc = new Scanner(System.in);
    static int mod = 1_000_000_007;
    public static void main(String[] args){
        int n = sc.nextInt();
        Stack<int[]>stack = new Stack<>();
        stack.push(new int[]{-1,n + 1});
        int index = 0;
        int[]ans = new int[n];
        boolean valid = true;
        for (int i = 0; i < n * 2; i++) {
            String c = sc.next();
            if(c.equals("+")){
                stack.add(new int[]{index++,0});
                continue;
            }
            int num = sc.nextInt();
            if(stack.peek()[1] >= num){
                System.out.println("NO");
                valid = false;
                break;
            }
            int[]pop= stack.pop();
            ans[pop[0]] = Math.max(num,pop[1]);
            stack.peek()[1] = num;
        }
        if(valid){
            System.out.println("YES");
            for (int i = 0; i < ans.length; i++) {
                System.out.print(ans[i] + " ");
            }
        }
    }

    private static void solve() {
        long n = sc.nextLong();

    }

    private static ArrayList<ArrayList<Integer>>g(int n){
        ArrayList<ArrayList<Integer>> g = new ArrayList<>();
        for (int i = 0; i < (n + 1); i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            g.get(u).add(v);
            g.get(v).add(u);
        }
        return g;
    }
    private static int gcb(int a,int b){
        if(a == b)
            return a;
        if(a < b)
            return gcb(b,a);
        if(a % b == 0)
            return b;
        return gcb(b,a % b);
    }

    private static void printList(List<Long> arr){
        for(long i : arr){
            System.out.print(i + " ");
        }
        System.out.println();
    }
    private static void printArr(int[]arr){
        for(int i : arr){
            System.out.print(i + " ");
        }
        System.out.println();
    }
    private static int[]readArr(int len){
        int[]ans = new int[len];
        for(int i = 0;i < len;i++){
            ans[i] = sc.nextInt();
        }
        return ans;
    }
    private static long powmod(long a,long b){
        long res=1;
        for(long i=0;i<b;i++){
            res=res*a%mod;
        }
        return res;
    }
}


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

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int n = nextInt() * 2;
        char[] symbols = new char[n];
        int[] values = new int[n];
        for (int i = 0; i < n; i++) {
            char symb = next().charAt(0);
            if (symb == '-') {
                int val = nextInt();
                symbols[i] = symb;
                values[i] = val;
            } else {
                symbols[i] = symb;
                values[i] = 0;
            }
        }
        int[] ans = new int[n];
        int ind = n - 1;
        Stack<Integer> stack = new Stack<>();
        for (int i = n - 1; i >= 0; i--) {
            char symb = symbols[i];
            int val = values[i];
            if (symb == '+') {
                if (stack.size() == 0) {
                    pw.println("NO");
                    pw.close();
                    return;
                }
                ans[ind] = stack.pop();
                ind--;
            } else {
                if (stack.size() != 0) {
                    if (stack.peek() < val) {
                        pw.println("NO");
                        pw.close();
                        return;
                    }
                }
                stack.add(val);
            }
        }
        pw.println("YES");
        for (int i = n / 2; i < n; i++) {
            pw.print(ans[i] + " ");
        }
        pw.close();
    }

    static long mod = 1_000_000_007;

    static StringTokenizer st = new StringTokenizer("");
    static BufferedReader br;

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

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


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

public class D {

	public static class pair implements Comparable<pair> {
		int f;
		int s;

		pair(int x, int y) {

			f = y;
			s = x;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.s - o.s;
		}
	}

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static int dp[];

static void modify(int x,int v) {

		for(; x<=n;x+=(x&-x))bt[x]+=v;

	}

	static int n=262144-1;
	static int bt[]=new int[262144];
	static int get(int x) {

		int sum=0;

		for(; x>0;x-=(x&-x))sum+=bt[x];
		return sum;

	}

	static void out(String s) {
		out.append(s+"\n");
	}

	static void out(int n) {
		out.append(n+"\n");
	}

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();

		while (t-- > 0) {

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

				modify(i,1);

			}

//			for(int i=0;i<=n;i++) {
//				System.out.println(get(i));
//			}
//

			HashSet<Integer> hs=new HashSet<>();
			Stack<Character> st=new Stack<>();
			Stack<Integer> fil=new Stack<>();

			boolean ok=true;
			int ar[]=new int[n];
			int cnt=0;
			int dp[]=new int[n];
			char ch[]=new char[2*n];
			int j=0;
			for(int i=0;i<2*n;i++) {

				String s=sc.next();
				ch[i]=s.charAt(0);

				if(s.charAt(0)=='-') {

					int q=sc.nextInt();
					dp[j]=q;
					j++;
					if(st.isEmpty()) {

						ok=false;
					}
					else {
						st.pop();

						ar[fil.pop()]=q;

						modify(q,-1);
						int t1=get(q);
						int t2=get(n);

						int dif=t2-t1;

						if(st.size()>dif) {
							ok=false;
						}

					}

				}

				else {

					st.push('+');

					fil.add(cnt);
					cnt++;
				}

			}

			if(!ok) {
				out.append("NO\n");continue;
			}
			else {

				PriorityQueue<Integer> pq=new PriorityQueue<>();
				j=0;
				for(int i=0;i<n;i++) {
					if(ch[i]=='+')pq.add(ar[i]);
					else {

						if(pq.isEmpty()|| pq.peek()!=dp[j]) {
							ok=false;
							break;
						}

						pq.poll();
						j++;
					}
				}

			}

			if(ok) {
				out.append("YES\n");
				for(int i=0;i<n;i++) {
					out.append(ar[i]+" ");
				}
				out.append("\n");
			}
			else out.append("NO\n");
		}

		System.out.println(out);
	}

}


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

public class D {

	public static class pair implements Comparable<pair> {
		int f;
		int s;

		pair(int x, int y) {

			f = y;
			s = x;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.s - o.s;
		}
	}

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static int dp[];

static void modify(int x,int v) {

		for(; x<=n;x+=(x&-x))bt[x]+=v;

	}

	static int n=262144-1;
	static int bt[]=new int[262144];
	static int get(int x) {

		int sum=0;

		for(; x>0;x-=(x&-x))sum+=bt[x];
		return sum;

	}

	static void out(String s) {
		out.append(s+"\n");
	}

	static void out(int n) {
		out.append(n+"\n");
	}

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();

		while (t-- > 0) {

		int n=sc.nextInt();

			HashSet<Integer> hs=new HashSet<>();
			Stack<Character> st=new Stack<>();
			Stack<Integer> fil=new Stack<>();

			boolean ok=true;
			int ar[]=new int[n];
			int cnt=0;
			int dp[]=new int[n];
			char ch[]=new char[2*n];
			int j=0;
			for(int i=0;i<2*n;i++) {

				String s=sc.next();
				ch[i]=s.charAt(0);

				if(s.charAt(0)=='-') {

					int q=sc.nextInt();
					dp[j]=q;
					j++;
					if(st.isEmpty()) {

						ok=false;
					}
					else {
						st.pop();

						ar[fil.pop()]=q;

					}

				}

				else {

					st.push('+');

					fil.add(cnt);
					cnt++;
				}

			}

			if(!ok) {
				out.append("NO\n");continue;
			}
			else {

				PriorityQueue<Integer> pq=new PriorityQueue<>();
				j=0;int z=0;
				for(int i=0;i<2*n;i++) {
					if(ch[i]=='+') {
						pq.add(ar[z]);z++;
					}
					else {

						if(pq.isEmpty()|| pq.peek()!=dp[j]) {
							ok=false;
							break;
						}

						pq.poll();
						j++;

					}
				}

			}

			if(ok) {
				out.append("YES\n");
				for(int i=0;i<n;i++) {
					out.append(ar[i]+" ");
				}
				out.append("\n");
			}
			else out.append("NO\n");
		}

		System.out.println(out);
	}

}


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

public class D {

	public static class pair implements Comparable<pair> {
		int f;
		int s;

		pair(int x, int y) {

			f = y;
			s = x;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.s - o.s;
		}
	}

	static int mod = (int) 1e9 + 7;
	static ArrayList<Integer> gr[];
	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static int dp[];

static void modify(int x,int v) {

		for(; x<=n;x+=(x&-x))bt[x]+=v;

	}

	static int n=262144-1;
	static int bt[]=new int[262144];
	static int get(int x) {

		int sum=0;

		for(; x>0;x-=(x&-x))sum+=bt[x];
		return sum;

	}

	static void out(String s) {
		out.append(s+"\n");
	}

	static void out(int n) {
		out.append(n+"\n");
	}

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();

		while (t-- > 0) {

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

				modify(i,1);

			}

//			for(int i=0;i<=n;i++) {
//				System.out.println(get(i));
//			}
//

			HashSet<Integer> hs=new HashSet<>();
			Stack<Character> st=new Stack<>();
			Stack<Integer> fil=new Stack<>();

			boolean ok=true;
			int ar[]=new int[n];
			int cnt=0;
			int dp[]=new int[n];
			char ch[]=new char[2*n];
			int j=0;
			for(int i=0;i<2*n;i++) {

				String s=sc.next();
				ch[i]=s.charAt(0);

				if(s.charAt(0)=='-') {

					int q=sc.nextInt();
					dp[j]=q;
					j++;
					if(st.isEmpty()) {

						ok=false;
					}
					else {
						st.pop();

						ar[fil.pop()]=q;

						modify(q,-1);
						int t1=get(q);
						int t2=get(n);

						int dif=t2-t1;

						if(st.size()>dif) {
							ok=false;
						}

					}

				}

				else {

					st.push('+');

					fil.add(cnt);
					cnt++;
				}

			}

			if(!ok) {
				out.append("NO\n");continue;
			}
			else {

				PriorityQueue<Integer> pq=new PriorityQueue<>();
				j=0;int z=0;
				for(int i=0;i<2*n;i++) {
					if(ch[i]=='+') {
						pq.add(ar[z]);z++;
					}
					else {

						if(pq.isEmpty()|| pq.peek()!=dp[j]) {
							ok=false;
							break;
						}

						pq.poll();
						j++;

					}
				}

			}

			if(ok) {
				out.append("YES\n");
				for(int i=0;i<n;i++) {
					out.append(ar[i]+" ");
				}
				out.append("\n");
			}
			else out.append("NO\n");
		}

		System.out.println(out);
	}

}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Otbor {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        int n = Integer.parseInt(reader.readLine());
        boolean can = true;
        TreeSet<Integer> left = new TreeSet<>();
        for(int i = 1; i <= n; ++i){
            left.add(i);
        }
        LinkedList<Integer> linkedList = new LinkedList<>();
        TreeSet<Integer> is = new TreeSet<>();
        for(int i = 0; i < 2 * n; ++i){
            StringTokenizer st = new StringTokenizer(reader.readLine());
            if(st.nextToken().equals("+")){
                is.add(left.last());
                linkedList.add(left.last());
                left.remove(left.last());
            }
            else{
                if(is.size() == 0){
                    System.out.println("NO");
                    return;
                }
                int ch = Integer.parseInt(st.nextToken());
                if(ch < is.first()){
                    left.add(is.first());
                    linkedList.removeLast();
                    is.remove(is.first());
                    left.remove(ch);
                    linkedList.add(ch);
                }
                else if(ch == is.first()){
                    is.remove(ch);
                }
                else{
                    System.out.println("NO");
                    return;
                }
            }
        }
        StringBuilder s = new StringBuilder();
        for(Integer k : linkedList){
            s.append(k);
            s.append(" ");
        }
        System.out.println("YES");
        System.out.println(s);
    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Otbor {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        int n = Integer.parseInt(reader.readLine());
        TreeSet<Integer> left = new TreeSet<>();
        for(int i = 1; i <= n; ++i){
            left.add(i);
        }
        LinkedList<Integer> linkedList = new LinkedList<>();
        TreeSet<Integer> is = new TreeSet<>();
        int[] por = new int[n];
        int podr = -1;
        for(int i = 0; i < 2 * n; ++i){
            StringTokenizer st = new StringTokenizer(reader.readLine());
            if(st.nextToken().equals("+")){
                is.add(left.last());
                left.remove(left.last());
                podr = -1;
            }
            else{
                if(is.size() == 0){
                    System.out.println("NO");
                    return;
                }
                int ch = Integer.parseInt(st.nextToken());
                if(podr != -1 && podr > ch){
                    System.out.println("NO");
                    return;
                }
                podr = ch;
                linkedList.add(ch);
                if(ch < is.first()){
                    left.add(is.first());
                    is.remove(is.first());
                    left.remove(ch);
                }
                else if(ch == is.first()){
                    is.remove(ch);
                }
                else{
                    System.out.println("NO");
                    return;
                }
            }
        }
        StringBuilder s = new StringBuilder();
        for(Integer k : linkedList){
            s.append(k);
            s.append(" ");
        }
        System.out.println("YES");
        System.out.println(s);
    }
}


import com.sun.source.tree.Tree;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Otbor {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        int n = Integer.parseInt(reader.readLine());
        boolean can = true;
        TreeSet<Integer> left = new TreeSet<>();
        TreeSet<Integer> xod = new TreeSet<>();
        for(int i = 1; i <= n; ++i){
            left.add(i);
        }
        TreeSet<Integer> is = new TreeSet<>();
        int podr = -1;
        int cnt = 0;
        int[] ans = new int[n];
        for(int i = 0; i < 2 * n; ++i){
            StringTokenizer st = new StringTokenizer(reader.readLine());
            if(st.nextToken().equals("+")){
                is.add(left.last());
                left.remove(left.last());
                podr = -1;
                xod.add(cnt++);
            }
            else{
                if(is.size() == 0){
                    System.out.println("NO");
                    return;
                }
                int ch = Integer.parseInt(st.nextToken());
                if(podr > ch){
                    System.out.println("NO");
                    return;
                }
                podr = ch;
                if(ch < is.first()){
                    left.add(is.first());
                    is.remove(is.first());
                    left.remove(ch);
                }
                else if(ch == is.first()){
                    is.remove(ch);
                }
                else{
                    System.out.println("NO");
                    return;
                }
                ans[xod.last()] = ch;
                xod.remove(xod.last());
            }
        }
        StringBuilder s = new StringBuilder();
        for(Integer k : ans){
            s.append(k);
            s.append(" ");
        }
        System.out.println("YES");
        System.out.println(s);
    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Otbor {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        int n = Integer.parseInt(reader.readLine());
        TreeSet<Integer> left = new TreeSet<>();
        for(int i = 1; i <= n; ++i){
            left.add(i);
        }
        LinkedList<Integer> linkedList = new LinkedList<>();
        TreeSet<Integer> is = new TreeSet<>();
        for(int i = 0; i < 2 * n; ++i){
            StringTokenizer st = new StringTokenizer(reader.readLine());
            if(st.nextToken().equals("+")){
                is.add(left.last());
                linkedList.add(left.last());
                left.remove(left.last());
            }
            else{
                if(is.size() == 0){
                    System.out.println("NO");
                    return;
                }
                int ch = Integer.parseInt(st.nextToken());
                if(ch < is.first()){
                    left.add(is.first());
                    linkedList.removeLast();
                    is.remove(is.first());
                    left.remove(ch);
                    linkedList.add(ch);
                }
                else if(ch == is.first()){
                    is.remove(ch);
                    linkedList.removeFirst();
                }
                else{
                    System.out.println("NO");
                    return;
                }
            }
        }
        StringBuilder s = new StringBuilder();
        for(Integer k : linkedList){
            s.append(k);
            s.append(" ");
        }
        System.out.println("YES");
        System.out.println(s);
    }
}


import com.sun.source.tree.Tree;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Otbor {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        int n = Integer.parseInt(reader.readLine());
        boolean can = true;
        TreeSet<Integer> left = new TreeSet<>();
        TreeSet<Integer> xod = new TreeSet<>();
        for(int i = 1; i <= n; ++i){
            left.add(i);
        }
        TreeSet<Integer> is = new TreeSet<>();
        int podr = -1;
        int cnt = 0;
        int[] ans = new int[n];
        for(int i = 0; i < 2 * n; ++i){
            StringTokenizer st = new StringTokenizer(reader.readLine());
            if(st.nextToken().equals("+")){
                is.add(left.last());
                left.remove(left.last());
                podr = -1;
                xod.add(cnt++);
            }
            else{
                if(is.size() == 0){
                    System.out.println("NO");
                    return;
                }
                int ch = Integer.parseInt(st.nextToken());
                if(podr > ch){
                    System.out.println("NO");
                    return;
                }
                podr = ch;
                if(ch < is.first()){
                    left.add(is.first());
                    is.remove(is.first());
                    left.remove(ch);
                }
                else if(ch == is.first()){
                    is.remove(ch);
                }
                else{
                    System.out.println("NO");
                    return;
                }
                ans[xod.last()] = ch;
                if(xod.last() != n - 1 && ans[xod.last() + 1] > ans[xod.last()]){
                    System.out.println("NO");
                    return;
                }
                xod.remove(xod.last());
            }
        }
        StringBuilder s = new StringBuilder();
        for(Integer k : ans){
            s.append(k);
            s.append(" ");
        }
        System.out.println("YES");
        System.out.println(s);
    }
}


import java.util.*;import java.io.*;import java.math.*;
public class Shurikens
{
    static final Random random=new Random();

    static void ruffleSort(int[] a) {
        int n = a.length;
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        ArrayList<Integer> lst = new ArrayList<>();
        for(int i : a)
            lst.add(i);
        Collections.sort(lst);
        for(int i = 0; i < n; i++)
            a[i] = lst.get(i);
    }

    static void ruffleSort(long[] a) {
        int n = a.length;
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n);
            long temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        ArrayList<Long> lst = new ArrayList<>();
        for(long i : a)
            lst.add(i);
        Collections.sort(lst);
        for(int i = 0; i < n; i++)
            a[i] = lst.get(i);
    }

    public static void process()throws IOException
    {
        int n = ni();
        int c = 0;
        String[] s = new String[2*n];
        for(int i = 0; i < 2*n; i++)
            s[i] = nln();
        Stack<Integer> s1 = new Stack<>(), s2 = new Stack<>();
        for(int i = 2*n-1; i >= 0; i--){
            if(s[i].charAt(0) == '-'){
                int val = Integer.parseInt(s[i].substring(2));
                if(s1.isEmpty() || s1.peek() > val)
                    s1.push(val);
                else
                    break;
            }
            else if(!s1.isEmpty())
                s2.push(s1.pop());
            else
                break;
            c++;
        }
        if(c!=2*n){
            pn("NO");
            return;
        }
        pn("YES");
        while(!s2.isEmpty())
            p(s2.pop()+" ");
        pn("");
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        //int k = t;
        while(t-->0) {/*p("Case #"+ (k-t) + ": ");*/process();}
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
        out.close();
    }

    static long power(long k, long c, long mod){
        long y = 1;
        while(c > 0){
            if(c%2 == 1)
                y = y * k % mod;
            c = c/2;
            k = k * k % mod;
        }
        return y;
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

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


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vpnt(ans)                       \
    for (ll i = 0; i < ans.size(); i++) \
        cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define setbit(x, k) (x |= (1LL << k))
#define clearbit(x, k) (x &= ~(1LL << k)) //x er last theke k-1 tomo ghor
#define checkbit(x, k) (x & (1LL << k))
#define mp make_pair
#define scl(x) scanf("%lld", &x)
#define sci(x) scanf("%d", &x)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ff first
#define ss second
#define pii pair<int, int>
#define YES printf("YES\n")
#define Yes printf("Yes\n")
#define yes printf("yes\n")
#define NO printf("NO\n")
#define No printf("No\n")
#define no printf("no\n")
#define nn printf("\n")
#define pp(n, p) (ll)(pow(n, p) + 0.5)
#define mod 1000000007
#define N 205

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin>>n;
    vector<pii>v;
    char c;
    int x, cnt = 0, f = 0;

    for(int i=0; i<2*n; i++)
    {
        cin>>c;
        if(c=='-')
        {
            cin>>x;
            v.pb({x,cnt});
            cnt = 0;
        }
        else cnt++;
    }
    stack<pii>s;
    vector<int>ans(n);
    int pos = 0;

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<v[i].second; j++)
        {
            s.push({v[i].first, pos++});
        }

        if(s.empty() || s.top().first>v[i].first) {f = 1; break;}
        else
        {
            ans[s.top().second] = v[i].first;
            s.pop();
        }
    }

    if(f) NO;
    else {YES; vpnt(ans);}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vpnt(ans)                       \
    for (ll i = 0; i < ans.size(); i++) \
        cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define setbit(x, k) (x |= (1LL << k))
#define clearbit(x, k) (x &= ~(1LL << k)) //x er last theke k-1 tomo ghor
#define checkbit(x, k) (x & (1LL << k))
#define mp make_pair
#define scl(x) scanf("%lld", &x)
#define sci(x) scanf("%d", &x)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ff first
#define ss second
#define pii pair<int, int>
#define YES printf("YES\n")
#define Yes printf("Yes\n")
#define yes printf("yes\n")
#define NO printf("NO\n")
#define No printf("No\n")
#define no printf("no\n")
#define nn printf("\n")
#define pp(n, p) (ll)(pow(n, p) + 0.5)
#define mod 1000000007
#define N 205

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin>>n;
    vector<pii>v;
    char c;
    int x, cnt = 0, f = 0;

    for(int i=0; i<2*n; i++)
    {
        cin>>c;
        if(c=='-')
        {
            cin>>x;
            v.pb({x,cnt});
            cnt = 0;
        }
        else cnt++;
    }
    stack<pii>s;
    vector<int>ans(n);
    int pos = 0;

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<v[i].second; j++)
        {
            s.push({v[i].first, pos++});
        }

        if(s.empty() || s.top().first>v[i].first) {f = 1; break;}
        else
        {
            ans[s.top().second] = v[i].first;
            s.pop();
        }
    }

    if(f) cout<<"NO"<<endl;
    else {cout<<"YES"<<endl; vpnt(ans);}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vpnt(ans)                       \
    for (ll i = 0; i < ans.size(); i++) \
        cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define setbit(x, k) (x |= (1LL << k))
#define clearbit(x, k) (x &= ~(1LL << k)) //x er last theke k-1 tomo ghor
#define checkbit(x, k) (x & (1LL << k))
#define mp make_pair
#define scl(x) scanf("%lld", &x)
#define sci(x) scanf("%d", &x)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ff first
#define ss second
#define pii pair<int, int>
#define YES printf("YES\n")
#define Yes printf("Yes\n")
#define yes printf("yes\n")
#define NO printf("NO\n")
#define No printf("No\n")
#define no printf("no\n")
#define nn printf("\n")
#define pp(n, p) (ll)(pow(n, p) + 0.5)
#define mod 1000000007
#define N 205

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin>>n;
    vector<pii>v;
    char c;
    int x, cnt = 0, f = 0;

    for(int i=0; i<2*n; i++)
    {
        cin>>c;
        if(c=='-')
        {
            cin>>x;
            v.pb({x,cnt});
            cnt = 0;
        }
        else cnt++;
    }
    stack<pii>s;
    vector<int>ans(n);
    int pos = 0;

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<v[i].second; j++)
        {
            s.push({v[i].first, pos++});
        }

        if(s.empty() || s.top().first>v[i].first) {f = 1; break;}
        else
        {
            ans[s.top().second] = v[i].first;
            s.pop();
            if(!s.empty()) s.top().first = max(v[i].first, s.top().first);
        }
    }

    if(f) cout<<"NO"<<endl;
    else {cout<<"YES"<<endl; vpnt(ans);}
}


#include <bits/stdc++.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sum_all(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

const int dx8[] = { -1, 0, 1, 0,1,1,-1,-1 };
const int dy8[] = { 0, -1, 0, 1,1,-1,1,-1 };

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    vector<ll> arr(2 * n, -1);
    ll c = 0;
    for (ll i = 0;i < 2 * n;i++)
    {

        char ch;
        cin >> ch;
        if (ch == '+')
        {
            c++;
            continue;
        }
        ll x;
        cin >> x;
        arr[i] = x;
    }
    if (c != n)
    {
        cout << "NO" << endl;
        return 0;
    }
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    vector<ll> ans(n);
    ll x = n - 1;
    for (ll i = 2 * n - 1;i >= 0;i--)
    {
        if (arr[i] == -1)
        {
            if (pq.empty())
            {
                cout << "NO" << endl;
                return 0;
            }
            ans[x--] = pq.top();
            pq.pop();
            continue;
        }
        else
        {
            if (!pq.empty() && arr[i]>pq.top())
            {
                cout << "NO" << endl;
                return 0;
            }
            pq.push(arr[i]);
        }
    }
    cout << "YES" << endl;
    for (auto x : ans) cout << x << " ";
    cout << endl;
}


#include <bits/stdc++.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sum_all(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

const int dx8[] = { -1, 0, 1, 0,1,1,-1,-1 };
const int dy8[] = { 0, -1, 0, 1,1,-1,1,-1 };

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    vector<ll> arr(2 * n, -1);
    ll c = 0;
    for (ll i = 0;i < 2 * n;i++)
    {
        c++;
        char ch;
        cin >> ch;
        if (ch == '+') continue;
        ll x;
        cin >> x;
        arr[i] = x;
    }
    if (c != n)
    {
        cout << "NO" << endl;
        return 0;
    }
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    vector<ll> ans(n);
    ll x = n - 1;
    for (ll i = 2 * n - 1;i >= 0;i--)
    {
        if (arr[i] == -1)
        {
            if (pq.empty())
            {
                cout << "NO" << endl;
                return 0;
            }
            ans[x--] = pq.top();
            pq.pop();
            continue;
        }
        else pq.push(arr[i]);
    }
    cout << "YES" << endl;
    for (auto x : ans) cout << x << " ";
    cout << endl;
}


#include <bits/stdc++.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sum_all(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

const int dx8[] = { -1, 0, 1, 0,1,1,-1,-1 };
const int dy8[] = { 0, -1, 0, 1,1,-1,1,-1 };

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    vector<ll> arr(2 * n, -1);
    ll c = 0;
    for (ll i = 0;i < 2 * n;i++)
    {

        char ch;
        cin >> ch;
        if (ch == '+')
        {
            c++;
            continue;
        }
        ll x;
        cin >> x;
        arr[i] = x;
    }
    if (c != n)
    {
        cout << "NO" << endl;
        return 0;
    }
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    vector<ll> ans(n);
    ll x = n - 1;
    for (ll i = 2 * n - 1;i >= 0;i--)
    {
        if (arr[i] == -1)
        {
            if (pq.empty())
            {
                cout << "NO" << endl;
                return 0;
            }
            ans[x--] = pq.top();
            pq.pop();
            continue;
        }
        else pq.push(arr[i]);
    }
    cout << "YES" << endl;
    for (auto x : ans) cout << x << " ";
    cout << endl;
}


#include <bits/stdc++.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sum_all(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

const int dx8[] = { -1, 0, 1, 0,1,1,-1,-1 };
const int dy8[] = { 0, -1, 0, 1,1,-1,1,-1 };

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    vector<ll> arr(2 * n, -1);
    ll c = 0;
    for (ll i = 0;i < 2 * n;i++)
    {

        char ch;
        cin >> ch;
        if (ch == '+')
        {
            c++;
            continue;
        }
        ll x;
        cin >> x;
        arr[i] = x;
    }
    if (c != n)
    {
        cout << "NO" << endl;
        return 0;
    }
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    vector<ll> ans(n);
    ll x = n - 1;
    for (ll i = 2 * n - 1;i >= 0;i--)
    {
        if (arr[i] == -1)
        {
            if (pq.empty())
            {
                cout << "NO" << endl;
                return 0;
            }
            ans[x--] = pq.top();
            pq.pop();
            continue;
        }
        else
        {
            if (!pq.empty() && arr[i]<pq.top())
            {
                cout << "NO" << endl;
                return 0;
            }
            pq.push(arr[i]);
        }
    }
    cout << "YES" << endl;
    for (auto x : ans) cout << x << " ";
    cout << endl;
}


#include <bits/stdc++.h>
#define forn(i,n) for(ll i=0; i<n; i++)
#define pb push_back
#define ll long long int
#define mp make_pair
#define sz(arr) (ll)arr.size()
#define MOD 1000000007
using namespace std;

int main(){
	ll n;
	cin>>n;
	vector<ll> store;
	ll cnt=0;
	ll cur=0;
	vector<ll> ans(n);
	ll prev=-1;
	bool bo=true;
	forn(i,2*n){
		char x;
		cin>>x;
		if (x=='-'){
			if (cur==0){
				bo=false;
				break;
			}
			ll x;
			cin>>x;
			if (x<prev){
				bo=false;
				break;
			}
			ans[store[sz(store)-1]]=x;
			store.erase(store.begin()+sz(store)-1);
			prev=x;
			cur--;
		}
		else{
			cur++;
			store.pb(cnt);
			cnt++;
			if (sz(store)==0) prev=-1;
		}
	}
	if (bo){
		cout<<"YES\n";
		forn(i,n) cout<<ans[i]<<" ";
	}
	else cout<<"NO\n";

}


#include <bits/stdc++.h>
#define forn(i,n) for(ll i=0; i<n; i++)
#define pb push_back
#define ll long long int
#define mp make_pair
#define sz(arr) (ll)arr.size()
#define MOD 1000000007
using namespace std;

int main(){
	ll n;
	cin>>n;
	vector<ll> store;
	ll cnt=0;
	ll cur=0;
	vector<ll> ans(n);
	ll prev=-1;
	bool bo=true;
	forn(i,2*n){
		char x;
		cin>>x;
		if (x=='-'){
			if (cur==0){
				bo=false;
				break;
			}
			ll x;
			cin>>x;
			if (x<prev){
				bo=false;
				break;
			}
			ans[store[sz(store)-1]]=x;
			store.erase(store.begin()+sz(store)-1);
			prev=x;
			cur--;
		}
		else{
			cur++;
			store.pb(cnt);
			cnt++;
			prev=-1;
		}
	}
	if (bo){
		cout<<"YES\n";
		forn(i,n) cout<<ans[i]<<" ";
	}
	else cout<<"NO\n";

}


#include <bits/stdc++.h>
#define forn(i,n) for(ll i=0; i<n; i++)
#define pb push_back
#define ll long long int
#define mp make_pair
#define sz(arr) (ll)arr.size()
#define MOD 1000000007
using namespace std;

int main(){
	ll n;
	cin>>n;
	vector<ll> store;
	ll cnt=0;
	ll cur=0;
	vector<ll> ans(n+1);
	ll prev=-1;
	bool bo=true;
	forn(i,2*n){
		char x;
		cin>>x;
		if (x=='-'){
			if (cur==0){
				bo=false;
				break;
			}
			ll x;
			cin>>x;
			if (x<prev){
				bo=false;
				break;
			}
			if (ans[store[sz(store)-1]+1]>x){
				bo=false;
				break;
			}
			ans[store[sz(store)-1]]=x;
			store.erase(store.begin()+sz(store)-1);
			cur--;
		}
		else{
			cur++;
			store.pb(cnt);
			cnt++;
		}
	}
	if (bo){
		cout<<"YES\n";
		forn(i,n) cout<<ans[i]<<" ";
	}
	else cout<<"NO\n";

}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v;
    map<ll,ll> mp;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,last=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            if(st.size()==0){
                cout<<"NO\n";
                return ;
            }
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
            mp[x]=v.size()-1;
            flag=1;
        }
        else{
            cin>> y;

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }
            if(flag==0 and last>y){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v[mp[x]] = y;
                mp[y] = mp[x];
                mp[x] = 0;
            }
            else if(x==y){
                ava.erase(ava.find(x));
            }
            else{
                cout<<"NO\n";
                return;
            }
            flag=0;
            last = y;
        }
    }
    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v, input;
    map<ll,ll> mp;
    set<ll> heap;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,last=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            input.push_back(-1);
            if(st.size()==0){
                cout<<"NO\n";
                return ;
            }
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
            mp[x]=v.size()-1;
            flag=1;
        }
        else{
            cin>> y; input.push_back(y);

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }
            if(flag==0 and last>y){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v[mp[x]] = y;
                mp[y] = mp[x];
                mp[x] = 0;
            }
            else if(x==y){
                ava.erase(ava.find(x));
            }
            else{
                cout<<"NO\n";
                return;
            }
            flag=0;
            last = y;
        }
    }
    c=0;
    for(auto it: input){
        if(it == -1){
            heap.insert(v[c++]);
        }
        else{
            if(*heap.begin() != it){
                cout<<"NO\n";
                return;
            }
            heap.erase(heap.begin());
        }
    }

    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v;
    map<ll,ll> mp;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,sum=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
            mp[x]=v.size()-1;
        }
        else{
            cin>> y;

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v[mp[x]] = y;
                mp[y] = mp[x];
                mp[x] = 0;
            }
            else if(x==y){
                ava.erase(ava.find(x));
            }
            else{
                cout<<"NO\n";
                return;
            }
        }
    }
    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v;
    map<ll,ll> mp;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,sum=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            if(st.size()==0){
                cout<<"NO\n";
                return ;
            }
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
            mp[x]=v.size()-1;
        }
        else{
            cin>> y;

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v[mp[x]] = y;
                mp[y] = mp[x];
                mp[x] = 0;
            }
            else if(x==y){
                ava.erase(ava.find(x));
            }
            else{
                cout<<"NO\n";
                return;
            }
        }
    }
    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,sum=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
        }
        else{
            cin>> y;

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v.pop_back();
                v.push_back(y);
            }
            else if(x==y){
                ava.erase(ava.begin());
            }
            else{
                cout<<"NO\n";
                return;
            }
        }
    }
    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


/*            AUTHOR - SHIVAM GUPTA
                       Jalpaiguri Govt. Engg College             */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<ll> ve[100005];

void solve()
{
    set<ll> st, ava;
    vector<ll> v;
    map<ll,ll> mp;
    ll n=0,m=0,i=0,j=0,k=0,c=0,l=0,r=0,p=0,q=0,x=0,y=0,z=0,flag=0,sum=0;
    cin>>n;
    char ch;
    for(i=0;i<n;i++){
        st.insert(i+1);
    }
    for(i=0;i<2*n;i++)
    {
        cin>>ch;
        if(ch == '+'){
            x = *st.rbegin();
            ava.insert(x);
            st.erase(st.find(x));
            v.push_back(x);
            mp[x]=v.size()-1;
        }
        else{
            cin>> y;

            if(ava.size()==0){
                cout<<"NO\n";
                return ;
            }

            x = *ava.begin();
            if(x > y){
                st.insert(x);
                ava.erase(ava.find(x));
                st.erase(st.find(y));
                v[mp[x]] = y;
                mp[x]=0;
            }
            else if(x==y){
                ava.erase(ava.begin());
            }
            else{
                cout<<"NO\n";
                return;
            }
        }
    }
    cout<<"YES\n";
    for(auto it: v)
    cout<<it<<" ";
    cout<<endl;

}

bool imp=false;int main()
{
    fio;
    int t=1;
    if(imp)
	cin>>t;
	ll j=t;
    while(t--){
    // cout<<"Case #"<<j-t<<": ";
    solve();}
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <queue>
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <stack>
#include <set>
#include <utility>

using namespace std;
long long a, b, d, c, f, e, n, m, k, s, bj, c1, c2, c3, min1, max1, num[100010];
char sz[5];

int main()
{
    scanf("%lld", &k);
    stack<long long> sta, answer;
    for (a = 1; a <= 2 * k; ++a)
    {
        scanf("%s", sz);
        if (sz[0] == '+')
            num[a] = 0;
        else
            scanf("%lld", &num[a]);
    }
    for (a = 2 * k; a >= 1; --a)
    {
        if (!num[a])
        {
            if (sta.empty())
            {
                printf("NO\n");
                return 0;
            }
            answer.push(sta.top());
            sta.pop();
            continue;
        }
        if (!sta.empty() && num[a] > sta.top())
        {
            printf("NO\n");
            return 0;
        }
        sta.push(num[a]);
    }
    printf("YES\n");
    printf("%lld", answer.top());
    answer.pop();
    while (!answer.empty())
    {
        printf(" %lld", answer.top());
        answer.pop();
    }
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <queue>
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <stack>
#include <set>
#include <utility>

using namespace std;
long long a, b, d, c, f, e, n, m, k, s, bj, c1, c2, c3, min1, max1, num[100010];
char sz[5];

int main()
{
    scanf("%lld", &k);
    stack<long long> sta, answer;
    for (a = 1; a <= 2 * k; ++a)
    {
        scanf("%s", sz);
        if (sz[0] == '+')
            num[a] = 0;
        else
            scanf("%lld", &num[a]);
    }
    for (a = 2 * k; a >= 1; --a)
    {
        if (!num[a])
        {
            if (sta.empty())
            {
                printf("No\n");
                return 0;
            }
            answer.push(sta.top());
            sta.pop();
            continue;
        }
        if (!sta.empty() && num[a] > sta.top())
        {
            printf("NO\n");
            return 0;
        }
        sta.push(num[a]);
    }
    printf("YES\n");
    printf("%lld", answer.top());
    answer.pop();
    while (!answer.empty())
    {
        printf(" %lld", answer.top());
        answer.pop();
    }
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <queue>
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <stack>
#include <set>
#include <utility>

using namespace std;
long long a, b, d, c, f, e, n, m, k, s, bj, c1, c2, c3, min1, max1, num[200010];
char sz[5];

int main()
{
    scanf("%lld", &k);
    stack<long long> sta, answer;
    for (a = 1; a <= 2 * k; ++a)
    {
        scanf("%s", sz);
        if (sz[0] == '+')
            num[a] = 0;
        else
            scanf("%lld", &num[a]);
    }
    for (a = 2 * k; a >= 1; --a)
    {
        if (!num[a])
        {
            if (sta.empty())
            {
                printf("NO\n");
                return 0;
            }
            answer.push(sta.top());
            sta.pop();
            continue;
        }
        if (!sta.empty() && num[a] > sta.top())
        {
            printf("NO\n");
            return 0;
        }
        sta.push(num[a]);
    }
    printf("YES\n");
    printf("%lld", answer.top());
    answer.pop();
    while (!answer.empty())
    {
        printf(" %lld", answer.top());
        answer.pop();
    }
    printf("\n");
}


// @iamnifer
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define ull unsigned long long
#define elif else if
#define pb push_back
#define add insert
#define fastio cout.tie(nullptr); cin.tie(nullptr); ios_base::sync_with_stdio(false)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) (ll)((x).size())
#define gcd __gcd
#define lcm(a, b) (a)/gcd((a), (b))*(b)
#define precision(x) cout << setprecision((x))
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef vector<vector<ll>> graph;

template<typename A, typename B>
void umin(A &a, B b) {
    if (a > b) a = b;
}

template<typename A, typename B>
void umax(A &a, B b) {
    if (a < b) a = b;
}

template<typename B, typename E, typename M>
M binpow(B b, E e, M m) {
    M r = 1;
    while (e > 0) {
        if (e & 1) r = r * b % m;
        b = b * b % m;
        e >>= 1;
    }
    return r;
}

string to_string(string &s) {
    return "\"" + s + "\"";
}

template<typename A, typename B>
string to_string(pair<A, B> v) {
    return "{" + to_string(v.first) + " " + to_string(v.second) + "}";
}

template<typename T>
string to_string(set<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

template<typename T>
string to_string(vector<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

void debug() {
    cerr << endl;
}

template<typename Head, typename...Tail>
void debug(Head H, Tail...T) {
    cerr << " " << to_string(H);
    debug(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define debug(...)
#endif

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma,sse4")
// #pragma comment(linker,"/STACK:128777216")

const ld pi = 3.14159265358979323846264338327950288419716939937510;
const ld eps = 1e-8;
const ll inf = 1e12;
const ll MOD = 1e9 + 7;  // 998244353
const ll maxN = 2e5 + 9;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'||*x==EOF))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    fastio;
    int n;read(n);
    vector<pair<int,int>>gots;
    set<int>unused;
    int bal=0;
    vector<pair<int,int>>actions;
    for(int i=0;i<2*n;i++){
        char c;
        read(c);
        if(c=='+'){
            unused.insert(i);
            bal++;
            actions.pb({'+',-1});
        }
        else{
            int x;read(x);
            actions.pb({'-',x});
            gots.pb({x,i});
            bal--;
        }
        if(bal<0){
            write("NO\n");
            return 0;
        }
    }
    sort(all(gots));
    for(auto&i:gots){
        int curnum=i.first;
        int ind=i.second;
        int to=*--unused.lower_bound(ind);
        unused.erase(to);
        actions[to].second=curnum;
    }
    set<int>curs;
    char c;
    int it;
    vector<int>ans;
    for(auto&i:actions){
        c=i.first;
        it=i.second;
        if(c=='+'){
            curs.insert(it);
            ans.pb(it);
        }
        else{
            int what=*curs.begin();
            if(it!=what){
                write("NO\n");
                return 0;
            }
            curs.erase(what);
        }
    }
    write("YES\n");
    for(auto&i:ans)write(i,' ');
}


// @iamnifer
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>

#define ll int
#define ld long double
#define ull unsigned long long
#define elif else if
#define pb push_back
#define add insert
#define fastio cout.tie(nullptr); cin.tie(nullptr); ios_base::sync_with_stdio(false)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) (ll)((x).size())
#define gcd __gcd
#define lcm(a, b) (a)/gcd((a), (b))*(b)
#define precision(x) cout << setprecision((x))
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef vector<vector<ll>> graph;

template<typename A, typename B>
void umin(A &a, B b) {
    if (a > b) a = b;
}

template<typename A, typename B>
void umax(A &a, B b) {
    if (a < b) a = b;
}

template<typename B, typename E, typename M>
M binpow(B b, E e, M m) {
    M r = 1;
    while (e > 0) {
        if (e & 1) r = r * b % m;
        b = b * b % m;
        e >>= 1;
    }
    return r;
}

string to_string(string &s) {
    return "\"" + s + "\"";
}

template<typename A, typename B>
string to_string(pair<A, B> v) {
    return "{" + to_string(v.first) + " " + to_string(v.second) + "}";
}

template<typename T>
string to_string(set<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

template<typename T>
string to_string(vector<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

void debug() {
    cerr << endl;
}

template<typename Head, typename...Tail>
void debug(Head H, Tail...T) {
    cerr << " " << to_string(H);
    debug(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define debug(...)
#endif

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma,sse4")
// #pragma comment(linker,"/STACK:128777216")

const ld pi = 3.14159265358979323846264338327950288419716939937510;
const ld eps = 1e-8;
const ll inf = 1e12;
const ll MOD = 1e9 + 7;  // 998244353
const ll maxN = 2e5 + 9;

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    fastio;
    ll n;cin>>n;
    vector<pair<ll,ll>>gots;
    set<ll>unused;
    ll bal=0;
    vector<pair<ll,ll>>actions;
    for(ll i=0;i<2*n;i++){
        char c;
        cin>>c;
        if(c=='+'){
            unused.insert(i);
            bal++;
            actions.pb({'+',-1});
        }
        else{
            ll x;cin>>x;
            actions.pb({'-',x});
            gots.pb({x,i});
            bal--;
        }
        if(bal<0){
            cout<<"NO\n";
            return 0;
        }
    }
    sort(all(gots));
    for(auto&i:gots){
        ll curnum=i.first;
        ll ind=i.second;
        ll to=*--unused.lower_bound(ind);
        unused.erase(to);
        actions[to].second=curnum;
    }
    set<ll>curs;
    char c;
    ll it;
    vector<ll>ans;
    for(auto&i:actions){
        c=i.first;
        it=i.second;
        if(c=='+'){
            curs.insert(it);
            ans.pb(it);
        }
        else{
            ll what=*curs.begin();
            if(it!=what){
                cout<<"NO\n";
                return 0;
            }
            curs.erase(what);
        }
    }
    cout<<"YES\n";
    for(auto&i:ans)cout<<i<<' ';
}


// @iamnifer
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define ull unsigned long long
#define elif else if
#define pb push_back
#define add insert
#define fastio cout.tie(nullptr); cin.tie(nullptr); ios_base::sync_with_stdio(false)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) (ll)((x).size())
#define gcd __gcd
#define lcm(a, b) (a)/gcd((a), (b))*(b)
#define precision(x) cout << setprecision((x))
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef vector<vector<ll>> graph;

template<typename A, typename B>
void umin(A &a, B b) {
    if (a > b) a = b;
}

template<typename A, typename B>
void umax(A &a, B b) {
    if (a < b) a = b;
}

template<typename B, typename E, typename M>
M binpow(B b, E e, M m) {
    M r = 1;
    while (e > 0) {
        if (e & 1) r = r * b % m;
        b = b * b % m;
        e >>= 1;
    }
    return r;
}

string to_string(string &s) {
    return "\"" + s + "\"";
}

template<typename A, typename B>
string to_string(pair<A, B> v) {
    return "{" + to_string(v.first) + " " + to_string(v.second) + "}";
}

template<typename T>
string to_string(set<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

template<typename T>
string to_string(vector<T> v) {
    string r = "{", e;
    for (auto i : v) r += e + to_string(i), e = ", ";
    return r + "}";
}

void debug() {
    cerr << endl;
}

template<typename Head, typename...Tail>
void debug(Head H, Tail...T) {
    cerr << " " << to_string(H);
    debug(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define debug(...)
#endif

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma,sse4")
// #pragma comment(linker,"/STACK:128777216")

const ld pi = 3.14159265358979323846264338327950288419716939937510;
const ld eps = 1e-8;
const ll inf = 1e12;
const ll MOD = 1e9 + 7;  // 998244353
const ll maxN = 2e5 + 9;

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    fastio;
    ll n;cin>>n;
    vector<pair<ll,ll>>gots;
    set<ll>unused;
    ll bal=0;
    vector<pair<ll,ll>>actions;
    for(ll i=0;i<2*n;i++){
        char c;
        cin>>c;
        if(c=='+'){
            unused.insert(i);
            bal++;
            actions.pb({'+',-1});
        }
        else{
            ll x;cin>>x;
            actions.pb({'-',x});
            gots.pb({x,i});
            bal--;
        }
        if(bal<0){
            cout<<"NO\n";
            return 0;
        }
    }
    sort(all(gots));
    for(auto&i:gots){
        ll curnum=i.first;
        ll ind=i.second;
        ll to=*--unused.lower_bound(ind);
        unused.erase(to);
        actions[to].second=curnum;
    }
    set<ll>curs;
    char c;
    ll it;
    vector<ll>ans;
    for(auto&i:actions){
        c=i.first;
        it=i.second;
        if(c=='+'){
            curs.insert(it);
            ans.pb(it);
        }
        else{
            ll what=*curs.begin();
            if(it!=what){
                cout<<"NO\n";
                return 0;
            }
            curs.erase(what);
        }
    }
    cout<<"YES\n";
    for(auto&i:ans)cout<<i<<' ';
}


#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, w, r[200001];
char c;
vector<int> h;

int main() {
	cin >> n;
	for (i = 1; i <= n + n; i++) {
		cin >> c;
		if (c == '-') {
			if (h.empty()) {
				cout << "NO";
				return 0;
			}
			cin >> k;
			w = h.back();
			h.pop_back();
			if (k < r[w + 1]) {
				cout << "NO";
				return 0;
			}
			r[w] = k;
		}
		if (c == '+') h.push_back(j), j++;
	}
	cout << "YES\n";
	for (i = 0; i < n; i++) cout << r[i] << " ";
}


#include <bits/stdc++.h>
using namespace std;
int n, i, k, g, j;
char c, p;
vector<int> h;

int main() {
	cin >> n;
	for (i = 1; i <= n + n; i++) {
		cin >> c;
		if (c == '-') {
			if (i < 2) {
				cout << "NO";
				return 0;
			}
			cin >> k;
			if (k != n) h.push_back(k);
			if (g > k && p == c) {
				cout << "NO";
				return 0;
			}
			g = k;
		}
		if (p == '+' && c == '+') h.push_back(n);
		p = c;
	}
	cout << "YES\n";
	for (int j : h) cout << j << " ";
}


#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, w, r[200001];
char c;
vector<int> h;

int main() {
	cin >> n;
	for (i = 0; i < n + n; i++) {
		cin >> c;
		if (c == '-') {
			if (h.empty()) {
				cout << "NO";
				return 0;
			}
			cin >> k;
			w = h.back();
			h.pop_back();
			if (k < r[w + 1]) {
				cout << "NO";
				return 0;
			}
			r[w] = k;
		}
		else h.push_back(j), j++;
	}
	cout << "YES\n";
	for (i = 0; i < n; i++) cout << r[i] << " ";
}


#pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt"); ofstream out("output.txt");
#define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int G = 100005;
int fen[G];

void add(int p){
    for(; p<G; p += p&-p) fen[p]++;
}

int sum_pref(int p){
    int o = 0;
    for(; p; p -= p&-p) o += fen[p];
    return o;
}

int sum_seg(int l, int r){
    return sum_pref(r) - sum_pref(l-1);
}

int main() {
    fast;
    init(fen, 0);
    ll a; cin>>a;
    ll event[a*2], bal = 0;
    for(int q=0; q<a*2; q++){
        char c; cin>>c;
        if(c=='+'){
            event[q] = 1;
        }
        else{
            cin>>event[q];
            event[q] *= -1;
        }
    }
    vec<int> o;
    set<ll> s;
    int fl = 1;
    for(int q=a*2-1; q>=0; q--){
        if(event[q]==1){
            if(s.empty()) cout<<"NO", exit(0);
            o.pb(*s.begin());
            s.erase(o.back());
        }
        else{
            ll x = event[q]*-1;
            if(s.size() && x>(*s.begin())) cout<<"NO", exit(0);
            s.insert(x);
        }
    }
    reverse(all(o));
    if(!fl) cout<<"NO", exit(0);
    cout<<"YES\n";
    for(ll i : o) cout<<i<<" ";
}


#pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt"); ofstream out("output.txt");
#define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int G = 100005;
int fen[G];

void add(int p){
    for(; p<G; p += p&-p) fen[p]++;
}

int sum_pref(int p){
    int o = 0;
    for(; p; p -= p&-p) o += fen[p];
    return o;
}

int sum_seg(int l, int r){
    return sum_pref(r) - sum_pref(l-1);
}

int main() {
    fast;
    init(fen, 0);
    ll a; cin>>a;
    ll event[a*2], bal = 0;
    for(int q=0; q<a*2; q++){
        char c; cin>>c;
        if(c=='+'){
            bal++;
            event[q] = 1;
        }
        else{
            cin>>event[q];
            event[q] *= -1;
            bal--;
            if(bal<0) cout<<"NO", exit(0);
        }
    }
    for(int q=1; q<a*2; q++){
        if(event[q]<0 && event[q-1]<0){
            if(event[q-1]<event[q]) cout<<"NO", exit(0);
        }
    }
    int cnt = 0;
    for(int q=0; q<a*2; q++){
        if(event[q]==1) cnt++;
        else{
            ll x = event[q]*-1;
            ll free = (a-x+1)-sum_seg(x, a);
            if(free<cnt) cout<<"NO", exit(0);
            add(x);
            cnt--;
        }
    }
    cout<<"YES\n";
    vec<int> o;
    set<ll> s;
    for(int q=a*2-1; q>=0; q--){
        if(event[q]==1){
            o.pb(*s.begin());
            s.erase(*s.begin());
        }
        else{
            ll x = event[q]*-1;
            s.insert(x);
        }
    }
    reverse(all(o));
    for(ll i : o) cout<<i<<" ";
}


#pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt"); ofstream out("output.txt");
#define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int G = 100005;
int fen[G];

void add(int p){
    for(; p<G; p += p&-p) fen[p]++;
}

int sum_pref(int p){
    int o = 0;
    for(; p; p -= p&-p) o += fen[p];
    return o;
}

int sum_seg(int l, int r){
    return sum_pref(r) - sum_pref(l-1);
}

int main() {
    fast;
    init(fen, 0);
    ll a; cin>>a;
    ll event[a*2], bal = 0;
    for(int q=0; q<a*2; q++){
        char c; cin>>c;
        if(c=='+'){
            bal++;
            event[q] = 1;
        }
        else{
            cin>>event[q];
            event[q] *= -1;
            bal--;
            if(bal<0) cout<<"NO", exit(0);
        }
    }
    for(int q=1; q<a*2; q++){
        if(event[q]<0 && event[q-1]<0){
            if(event[q-1]<event[q]) cout<<"NO", exit(0);
        }
    }
    int cnt = 0;
    for(int q=0; q<a*2; q++){
        if(event[q]==1) cnt++;
        else{
            ll x = event[q]*-1;
            ll free = (a-x+1)-sum_seg(x, a);
            if(free<cnt) cout<<"NO", exit(0);
            add(x);
            cnt--;
        }
    }
    vec<int> o;
    set<ll> s;
    for(int q=a*2-1; q>=0; q--){
        if(event[q]==1){
            o.pb(*s.begin());
            s.erase(*s.begin());
        }
        else{
            ll x = event[q]*-1;
            s.insert(x);
        }
    }
    reverse(all(o));
    int fl = 1;
    set<int> ss;
    for(int q=0, i=0; q<a*2; q++){
        if(event[q]==1){
            ss.insert(o[i++]);
        }
        else{
            ll x = event[q]*-1;
            fl &= x==(*ss.begin());
            ss.erase(x);
        }
    }
    if(!fl) cout<<"NO", exit(0);
    cout<<"YES\n";
    for(ll i : o) cout<<i<<" ";
}


#pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt"); ofstream out("output.txt");
#define fast cin.tie(0); cout.tie(0); cin.sync_with_stdio(0); cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int G = 100005;
int fen[G];

void add(int p){
    for(; p<G; p += p&-p) fen[p]++;
}

int sum_pref(int p){
    int o = 0;
    for(; p; p -= p&-p) o += fen[p];
    return o;
}

int sum_seg(int l, int r){
    return sum_pref(r) - sum_pref(l-1);
}

int main() {
    fast;
    init(fen, 0);
    ll a; cin>>a;
    ll event[a*2], bal = 0;
    for(int q=0; q<a*2; q++){
        char c; cin>>c;
        if(c=='+'){
            bal++;
            event[q] = 1;
        }
        else{
            cin>>event[q];
            event[q] *= -1;
            bal--;
            if(bal<0) cout<<"NO", exit(0);
        }
    }
    for(int q=1; q<a*2; q++){
        if(event[q]<0 && event[q-1]<0){
            if(event[q-1]<event[q]) cout<<"NO", exit(0);
        }
    }
    int cnt = 0;
    for(int q=0; q<a*2; q++){
        if(event[q]==1) cnt++;
        else{
            ll x = event[q]*-1;
            ll free = (a-x+1)-sum_seg(x, a);
            if(free<cnt) cout<<"NO", exit(0);
            add(x);
            cnt--;
        }
    }
    vec<int> o;
    set<ll> s;
    for(int q=a*2-1; q>=0; q--){
        if(event[q]==1){
            o.pb(*s.begin());
            s.erase(*s.begin());
        }
        else{
            ll x = event[q]*-1;
            s.insert(x);
        }
    }
    reverse(all(o));
    int fl = 1;
    set<int> ss;
    for(int q=0, i=0; q<a*2; q++){
        if(event[q]==1){
            ss.insert(o[i++]);
        }
        else{
            ll x = event[q]*-1;
            fl &= x==(*s.begin());
            s.erase(x);
        }
    }
    if(!fl) cout<<"NO", exit(0);
    cout<<"YES\n";
    for(ll i : o) cout<<i<<" ";
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> ans(n);
    set<int> nums;
    for (int i = 1; i <= n; i++) {
        nums.insert(i);
    }
    int p = 0, m = 0, prev_num = 0, prev_sign = '+';
    for (int i = 0; i < n * 2; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            p++;
            prev_sign = '+';
            continue;
        }
        int x;
        cin >> x;
        m++;
        if (p - m < 0 || (prev_num > x && prev_sign == '-')) {
            cout << "NO";
            return 0;
        }
        prev_num = x;
        prev_sign = '-';
        if (p <= n && ans[n - 1] == 0) {
            ans[p - 1] = x;
            nums.erase(x);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
        if (ans[i] == 0) {
            ans[i] = *nums.rbegin();
            nums.erase(ans[i]);
        }
        cout << ans[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> ans(n);
    set<int> nums;
    /*for (int i = 0; i < n; i++) {
        nums.insert(i);
    }*/
    vector<int> ev(n * 2, 0);
    int p = 0, m = 0;
    for (int i = 0; i < n * 2; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            nums.insert(p);
            p++;
            continue;
        }
        int x;
        cin >> x;
        ev[i] = x;
        m++;
        if (nums.empty()) {
            cout << "NO\n";
            return 0;
        }
        int free = *nums.rbegin();
        ans[free] = x;
        nums.erase(free);
    }
    bool ok = true;
    set<int> s;
    int j = -1;
    for (int i = 0; i < n * 2; i++) {
        if (ev[i] == 0) {
            j++;
            s.insert(ans[j]);
            continue;
        }
        if (s.empty() || *s.begin() != ev[i]) {
            ok = false;
            break;
        }
        s.erase(ev[i]);
    }
    if (ok) {
        cout << "YES\n";
        for (int i : ans) {
            cout << i << ' ';
        }
    } else {
        cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> ans(n);
    set<int> nums;
    for (int i = 1; i <= n; i++) {
        nums.insert(i);
    }
    vector<int> ev(n * 2, 0);
    int p = 0;
    for (int i = 0; i < n * 2; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            p++;
            continue;
        }
        int x;
        cin >> x;
        ev[i] = x;
        if (p > 0 && p <= n && ans[p - 1] == 0) {
            ans[p - 1] = x;
            nums.erase(x);
        }
    }
    for (int i = 0; i < n; i++) {
        if (ans[i] == 0) {
            ans[i] = *nums.rbegin();
            nums.erase(ans[i]);
        }
    }
    bool ok = true;
    set<int> s;
    int j = -1;
    for (int i = 0; i < n * 2; i++) {
        if (ev[i] == 0) {
            j++;
            s.insert(ans[j]);
            continue;
        }
        if (s.empty() || *s.begin() != ev[i]) {
            ok = false;
            break;
        }
        s.erase(ev[i]);
    }
    if (ok) {
        cout << "YES\n";
        for (int i : ans) {
            cout << i << ' ';
        }
    } else {
        cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> ans(n);
    set<int> nums;
    for (int i = 1; i <= n; i++) {
        nums.insert(i);
    }
    int p = 0, m = 0, prev_num = 0, prev_sign = '+';
    for (int i = 0; i < n * 2; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            p++;
            prev_sign = '+';
            continue;
        }
        int x;
        cin >> x;
        m++;
        if (p - m < 0 || (prev_num > x && prev_sign == '-')) {
            cout << "NO";
            return 0;
        }
        prev_num = x;
        prev_sign = '-';
        if (p <= n && ans[p - 1] == 0) {
            ans[p - 1] = x;
            nums.erase(x);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
        if (ans[i] == 0) {
            ans[i] = *nums.rbegin();
            nums.erase(ans[i]);
        }
        cout << ans[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> ans(n);
    set<int> nums;
    for (int i = 1; i <= n; i++) {
        nums.insert(i);
    }
    vector<int> ev(n * 2, 0);
    int p = 0, m = 0, prev_num = 0, prev_sign = '+';
    for (int i = 0; i < n * 2; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            p++;
            continue;
        }
        int x;
        cin >> x;
        ev[i] = x;
        if (p > 0 && p <= n && ans[n - 1] == 0) {
            ans[p - 1] = x;
            nums.erase(x);
        }
    }
    for (int i = 0; i < n; i++) {
        if (ans[i] == 0) {
            ans[i] = *nums.rbegin();
            nums.erase(ans[i]);
        }
    }
    bool ok = true;
    set<int> s;
    int j = -1;
    for (int i = 0; i < n * 2; i++) {
        if (ev[i] == 0) {
            j++;
            s.insert(ans[j]);
            continue;
        }
        if (s.empty() || *s.begin() != ev[i]) {
            ok = false;
            break;
        }
        s.erase(ev[i]);
    }
    if (ok) {
        cout << "YES\n";
        for (int i : ans) {
            cout << i << ' ';
        }
    } else {
        cout << "NO\n";
    }
    return 0;
}


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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int n;
    auto val = 0;
    int x;
    char type;

    cin >> n;

    auto first = new int[n];
    int fc = -1;

    auto second = new int[n];
    int fs = -1;

    auto ans = new int[n];

    auto z = n << 1;
    while (z--) {
        cin >> type;
        if (type == '+') {
            first[++fc] = val++;
            second[++fs] = 0;
        }
        else {
            cin >> x;
            if (fc == -1 || x <= second[fs]) {
                cout << "NO";
                return 0;
            }
            ans[first[fc--]] = x;
            fs--;

            if (fc >= 0) {
                auto& s = second[fs];
                if (x > s)
                    s = x;
            }
        }
    }

    cout << "YES\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    auto val = 0;
    int x;

    cin >> n;
    stack<pair<int, int>> s;
    vector<int> ans(n, 0);

    n *= 2;
    for (auto i = 0; i < n; ++i) {
        char type;
        cin >> type;
        if (type == '+') {
            s.emplace(val++, 0);
        }
        else {
            cin >> x;
            if (s.empty() || x <= s.top().second) {
                cout << "NO";
                return 0;
            }
            ans[s.top().first] = x;
            s.pop();
            if (!s.empty()) {
                s.top().second = max(s.top().second, x);
            }
        }
    }
    n /= 2;

    cout << "YES\n";
    for (auto& a : ans)
        cout << a << " ";

    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    auto val = 0;
    int x;
    char type;

    cin >> n;
    stack<pair<int, int>> s;
    vector<int> ans(n);

    auto z = n *= 2;
    while(z--) {
        cin >> type;
        if (type == '+') {
            s.push({ val++, 0 });
        }
        else {
            cin >> x;
            if (s.empty() || x <= s.top().second) {
                cout << "NO";
                return 0;
            }
            ans[s.top().first] = x;
            s.pop();
            if (!s.empty()) {
            	if (x > s.top().second)
					s.top().second = x;
            }
        }
    }

    cout << "YES\n";
    for (auto& a : ans)
        cout << a << " ";

    return 0;
}


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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int n;
    auto val = 0;
    int x;
    char type;

    cin >> n;
    stack<pair<int, int>> s;
    vector<int> ans(n);

    auto z = n *= 2;
    while (z--) {
        cin >> type;
        if (type == '+') {
            s.push({ val++, 0 });
        }
        else {
            cin >> x;
            if (s.empty() || x <= s.top().second) {
                cout << "NO";
                return 0;
            }
            ans[s.top().first] = x;
            s.pop();
            if (!s.empty()) {
                if (x > s.top().second)
                    s.top().second = x;
            }
        }
    }

    cout << "YES\n";
    for (auto& a : ans)
        cout << a << " ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	n *= 2;

	int z = 0;
	int pos = 0;
	int curmax = 0;

	vector<int> arr(n);
	vector<pair<int, int>> ans;

	int curp = 0;

	vector<pair<int, int>> edges;

	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		if (c == '-')
		{
			if (/*arr.empty()*/ curp == 0)
			{
				cout << "NO";
				return 0;
			}

			int x;
			cin >> x;

			if (pos == 0 && !edges.empty() && edges[0].second > x)
			{
				cout << "NO";
				return 0;
			}

			ans.emplace_back(arr[--curp], x);
			//curp--;
			//arr.erase(arr.begin());

			if (edges.empty() || edges[0].second > x)
			{
				edges.insert(edges.begin(), { pos, x });
			}
			else
			{
				edges[0].second = x;
			}
			edges[0].first--;
			if (edges[0].first < 0)
			{
				edges.erase(edges.begin());
			}

			pos = 0;
		}
		else
		{
			pos++;
			arr[curp++] = ++z;
			/*
			if (!arr.empty())
			{

				//arr.insert(arr.begin(), ++z);
			}
			else
			{
				//arr.push_back(++z);
			}
			*/
		}
	}

	sort(ans.begin(), ans.end());

	cout << "YES" << '\n';
	for (auto i : ans)
	{
		cout << i.second << " ";
	}
	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    vector<pair<int, int>> stck;
    int n;
    cin >> n;
    stck.reserve(n);
    n *= 2;

    bool canans = true;
    int val = 0;
    vector<int> ans(n, 0);
    for (int i = 0; i < n; ++i) {
        char type;
        cin >> type;
        if (type == '+') {
            stck.emplace_back(val++, 0);
        }
        else {
            int x;
            cin >> x;
            if (stck.empty() || x <= stck.back().second) {
                canans = false;
                break;
            }
            ans[stck.back().first] = x;
            stck.pop_back();
            if (!stck.empty()) {
                stck.back().second = max(stck.back().second, x);
            }
        }
    }
    if (!canans) {
        cout << "NO\n";
    }
    else {
        cout << "YES\n";
        for (int i = 0; i < n; ++i) {
            cout << ans[i] << " ";
        }
    }

    return 0;
}


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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int n;
    auto val = 0;
    int x;
    char type;

    cin >> n;
    stack<int> first;
    stack<int> second;
    auto ans = new int[n];

    //vector<int> ans(n);

    auto z = n << 1;
    while (z--) {
        cin >> type;
        if (type == '+') {
            first.push(val++);
            second.push(0);
        }
        else {
            cin >> x;
            if (first.empty() || x <= second.top()) {
                cout << "NO";
                return 0;
            }
            ans[first.top()] = x;
            first.pop();
            second.pop();
            if (!first.empty()) {
                auto& s = second.top();
                if (x > s)
                    s = x;
            }
        }
    }

    cout << "YES\n";
    for (auto& a : ans)
        cout << a << " ";

    return 0;
}


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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int n;
    auto val = 0;
    int x;
    char type;

    cin >> n;

    auto first = new int[n];
    auto second = new int[n];
    int fc = -1;

    auto ans = new int[n];

    auto z = n << 1;
    while (z--) {
        cin >> type;
        if (type == '+') {
            first[++fc] = val++;
            second[fc] = 0;
        }
        else {
            cin >> x;
            if (fc == -1 || x <= second[fc]) {
                cout << "NO";
                return 0;
            }
            ans[first[fc--]] = x;

            if (fc >= 0) {
                auto& s = second[fc];
                if (x > s)
                    s = x;
            }
        }
    }

    cout << "YES\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << ' ';

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;
	n *= 2;

	int z = 0;
	int pos = 0;
	int curmax = 0;

	vector<int> arr;
	vector<pair<int, int>> ans;

	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		if (c == '-')
		{
			if (arr.empty())
			{
				cout << "NO";
				return 0;
			}

			int x;
			cin >> x;

			if (pos == 0 && curmax > x)
			{
				cout << "NO";
				return 0;
			}

			ans.emplace_back(arr[0], x);
			arr.erase(arr.begin());

			pos = 0;
			curmax = x;
		}
		else
		{
			pos++;
			if (!arr.empty())
			{
				arr.insert(arr.begin(), ++z);
			}
			else
			{
				arr.push_back(++z);
			}
		}
	}

	sort(ans.begin(), ans.end());

	cout << "YES" << '\n';
	for (auto i : ans)
	{
		cout << i.second << " ";
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	n *= 2;

	int z = 0;
	int pos = 0;
	int curmax = 0;

	vector<int> arr(n);
	vector<pair<int, int>> ans;

	int curp = 0;

	vector<pair<int, int>> edges;

	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		if (c == '-')
		{
			if (/*arr.empty()*/ curp == 0)
			{
				cout << "NO";
				return 0;
			}

			int x;
			cin >> x;

			if (pos == 0 && !edges.empty() && edges[0].second > x)
			{
				cout << "NO";
				return 0;
			}

			ans.emplace_back(arr[--curp], x);
			//curp--;
			//arr.erase(arr.begin());

			if (edges.empty() || edges[0].second > x)
			{
				edges.insert(edges.begin(), { pos, x });
			}
			else
			{
				for (auto& edge : edges)
				{
					if (edge.second < x)
					{
						edge.second = x;
					}
					else
						break;
				}
			}

			edges[0].first--;
			while(!edges.empty() && edges[0].first <= 0)
			{
				edges.erase(edges.begin());
			}

			pos = 0;
		}
		else
		{
			pos++;
			arr[curp++] = ++z;
			/*
			if (!arr.empty())
			{

				//arr.insert(arr.begin(), ++z);
			}
			else
			{
				//arr.push_back(++z);
			}
			*/
		}
	}

	sort(ans.begin(), ans.end());

	cout << "YES" << '\n';
	for (auto i : ans)
	{
		cout << i.second << " ";
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	n *= 2;

	int z = 0;
	int pos = 0;
	int curmax = 0;

	vector<int> arr(n);
	vector<pair<int, int>> ans;

	int curp = 0;

	vector<pair<int, int>> edges;

	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		if (c == '-')
		{
			if (/*arr.empty()*/ curp == 0)
			{
				cout << "NO";
				return 0;
			}

			int x;
			cin >> x;

			if (pos == 0 && !edges.empty() && edges[0].second > x)
			{
				cout << "NO";
				return 0;
			}

			ans.emplace_back(arr[--curp], x);

			if (!edges.empty() && pos == 0)
				edges[0].first--;

			while (!edges.empty() && edges[0].first <= 0)
			{
				edges.erase(edges.begin());
			}

			if (edges.empty() || edges[0].second > x)
			{
				edges.insert(edges.begin(), { pos - 1, x });
			}
			else
			{
				for (auto& edge : edges)
				{
					if (edge.second < x)
					{
						edge.second = x;
					}
					else
						break;
				}
			}

			pos = 0;
		}
		else
		{
			pos++;
			arr[curp++] = ++z;
			/*
			if (!arr.empty())
			{

				//arr.insert(arr.begin(), ++z);
			}
			else
			{
				//arr.push_back(++z);
			}
			*/
		}
	}

	sort(ans.begin(), ans.end());

	cout << "YES" << '\n';
	for (auto i : ans)
	{
		cout << i.second << " ";
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	n *= 2;

	int z = 0;
	int pos = 0;
	int curmax = 0;

	vector<int> arr(n);
	vector<pair<int, int>> ans;

	int curp = 0;

	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		if (c == '-')
		{
			if (/*arr.empty()*/ curp == 0)
			{
				cout << "NO";
				return 0;
			}

			int x;
			cin >> x;

			if (pos == 0 && curmax > x)
			{
				cout << "NO";
				return 0;
			}

			ans.emplace_back(arr[--curp], x);
			//curp--;
			//arr.erase(arr.begin());

			pos = 0;
			curmax = x;
		}
		else
		{
			pos++;
			arr[curp++] = ++z;
			/*
			if (!arr.empty())
			{

				//arr.insert(arr.begin(), ++z);
			}
			else
			{
				//arr.push_back(++z);
			}
			*/
		}
	}

	sort(ans.begin(), ans.end());

	cout << "YES" << '\n';
	for (auto i : ans)
	{
		cout << i.second << " ";
	}
	return 0;
}