n,q = input().split(' ')
n = int(n)
q=int(q)
s=''
a =[]
for i in range(n):
        s+='1'
c=''
for _ in range(q):
   a,b,c=input().split(' ')
   a=int(a)
   b=int(b)
   for i in range(a,b):
       s+=c;
   print(s)