Problem: Vasya has an array a_1, a_2, ..., a_n.

You don't know this array, but he told you m facts about this array. The i-th fact is a triple of numbers t_i, l_i and r_i (0 ≤ t_i ≤ 1, 1 ≤ l_i < r_i ≤ n) and it means:

  * if t_i=1 then subbarray a_{l_i}, a_{l_i + 1}, ..., a_{r_i} is sorted in non-decreasing order; 
  * if t_i=0 then subbarray a_{l_i}, a_{l_i + 1}, ..., a_{r_i} is not sorted in non-decreasing order. A subarray is not sorted if there is at least one pair of consecutive elements in this subarray such that the former is greater than the latter. 



For example if a = [2, 1, 1, 3, 2] then he could give you three facts: t_1=1, l_1=2, r_1=4 (the subarray [a_2, a_3, a_4] = [1, 1, 3] is sorted), t_2=0, l_2=4, r_2=5 (the subarray [a_4, a_5] = [3, 2] is not sorted), and t_3=0, l_3=3, r_3=5 (the subarray [a_3, a_5] = [1, 3, 2] is not sorted).

You don't know the array a. Find any array which satisfies all the given facts.

Input

The first line contains two integers n and m (2 ≤ n ≤ 1000, 1 ≤ m ≤ 1000).

Each of the next m lines contains three integers t_i, l_i and r_i (0 ≤ t_i ≤ 1, 1 ≤ l_i < r_i ≤ n).

If t_i = 1 then subbarray a_{l_i}, a_{l_i + 1}, ... , a_{r_i} is sorted. Otherwise (if t_i = 0) subbarray a_{l_i}, a_{l_i + 1}, ... , a_{r_i} is not sorted.

Output

If there is no array that satisfies these facts in only line print NO (in any letter case).

If there is a solution, print YES (in any letter case). In second line print n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the array a, satisfying all the given facts. If there are multiple satisfying arrays you can print any of them.

Examples

Input


7 4
1 1 3
1 2 5
0 5 6
1 6 7


Output


YES
1 2 2 3 5 4 4


Input


4 2
1 1 4
0 2 3


Output


NO

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[])
    {
        FastReader input=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int T=1;
        while(T-->0)
        {
            int n=input.nextInt();
            int m=input.nextInt();
            ArrayList<Pair> acc=new ArrayList<>();
            ArrayList<Pair> dec=new ArrayList<>();
            for(int i=0;i<m;i++)
            {
                int t=input.nextInt();
                int l=input.nextInt();
                int r=input.nextInt();
                if(t==1)
                {
                    acc.add(new Pair(l-1,r-1));
                }
                else
                {
                    dec.add(new Pair(l-1,r-1));
                }
            }
            mergeSort(acc,0,acc.size()-1);
            int in=0;
            ArrayList<Pair> list=new ArrayList<>();
            int min=0,max=0;
            int i=0;
            while(i<acc.size())
            {
                if(i==in)
                {
                    min=acc.get(i).l;
                    max=acc.get(i).r;
                    i++;
                }
                else
                {
                    if(acc.get(i).l<=max)
                    {
                        max=Math.max(max,acc.get(i).r);
                        i++;
                    }
                    else
                    {
                        list.add(new Pair(min,max));
                        in=i;
                    }
                }
            }
            if(acc.size()>0)
            {
                list.add(new Pair(min,max));
            }
            int flag=0;
            for(int j=0;j<dec.size();j++)
            {
                int l=dec.get(j).l;
                int r=dec.get(j).r;
                for(int k=0;k<list.size();k++)
                {
                    int l1=list.get(k).l;
                    int r1=list.get(k).r;
                    if((l>=l1 && r<=r1))
                    {
                        flag=1;
                        break;
                    }
                }
            }
            if(flag==1)
            {
                out.println("NO");
            }
            else
            {
                out.println("YES");
                if(list.size()==0)
                {
                    int x=n;
                    for(int j=0;j<n;j++)
                    {
                        out.print(x+" ");
                        x--;
                    }
                }
                else
                {
                    ArrayList<Pair> li=new ArrayList<>();
                    int f=1;
                    for(int j=0;j<list.size();j++)
                    {
                        if(j==0)
                        {
                            int l=list.get(j).l;
                            int r=list.get(j).r;
                            if(l==0)
                            {
                                li.add(list.get(j));
                                f=0;
                            }
                            else
                            {
                                li.add(new Pair(0,l));
                                li.add(list.get(j));
                            }
                        }
                        else
                        {
                            li.add(new Pair(list.get(j-1).r,list.get(j).l));
                            li.add(list.get(j));
                        }
                    }
                    int l1=list.get(list.size()-1).l;
                    int r1=list.get(list.size()-1).r;
                    if(r1!=n-1)
                    {
                        li.add(new Pair(r1,n-1));
                    }
                    /*
                    for(int j=0;j<li.size();j++)
                    {
                        out.println(li.get(j).l+" "+li.get(j).r);
                    }

                     */
                    int arr[]=new int[n];
                    int x=n;
                    for(int j=0;j<li.size();j++)
                    {
                        int l=li.get(j).l;
                        int r=li.get(j).r;
                        if(f==0)
                        {
                            if(l==0)
                            {
                                arr[l]=n;
                            }
                            for(int k=l+1;k<=r;k++)
                            {
                                arr[k]=arr[k-1]+1;
                            }
                            f=1;
                        }
                        else
                        {
                            if(l==0)
                            {
                                arr[l]=n;
                            }
                            for(int k=l+1;k<=r;k++)
                            {
                                arr[k]=arr[k-1]-1;
                            }
                            f=0;
                        }
                    }
                    for(int j=0;j<n;j++)
                    {
                        out.print(arr[j]+" ");
                    }
                    out.println();
                }
            }
        }
        out.close();
    }
    static class Pair
    {
        int l,r;
        Pair(int l,int r)
        {
            this.l=l;
            this.r=r;
        }
    }
    public static void mergeSort(ArrayList<Pair> a,int p,int r)
    {
        if(p<r)
        {
            int q=(p+r)/2;
            mergeSort(a,p,q);
            mergeSort(a,q+1,r);
            merge(a,p,q,r);
        }
    }
    public static void merge(ArrayList<Pair> a,int p,int q,int r)
    {
        int n1=q-p+2;
        Pair L[]=new Pair[n1];
        int n2=r-q+1;
        Pair R[]=new Pair[n2];
        for(int i=p;i<=q;i++)
        {
            L[i-p]=a.get(i);
        }
        L[n1-1]=new Pair(Integer.MAX_VALUE,0);
        for(int i=q+1;i<=r;i++)
        {
            R[i-q-1]=a.get(i);
        }
        R[n2-1]=new Pair(Integer.MAX_VALUE,0);
        int x=0,y=0;
        for(int i=p;i<=r;i++)
        {
            if(L[x].l<=R[y].l)
            {
                a.set(i,L[x]);
                x++;
            }
            else
            {
                a.set(i,R[y]);
                y++;
            }
        }
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

        long nextLong()
        {

            return Long.parseLong(next());
        }

        double nextDouble()
        {

            return Double.parseDouble(next());
        }

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