You have a malfunctioning microwave in which you want to put some bananas. You have n time-steps before the microwave stops working completely. At each time-step, it displays a new operation.

Let k be the number of bananas in the microwave currently. Initially, k = 0. In the i-th operation, you are given three parameters t_i, x_i, y_i in the input. Based on the value of t_i, you must do one of the following:

Type 1: (t_i=1, x_i, y_i) — pick an a_i, such that 0 ≤ a_i ≤ y_i, and perform the following update a_i times: k:=⌈ (k + x_i) ⌉.

Type 2: (t_i=2, x_i, y_i) — pick an a_i, such that 0 ≤ a_i ≤ y_i, and perform the following update a_i times: k:=⌈ (k ⋅ x_i) ⌉.

Note that x_i can be a fractional value. See input format for more details. Also, ⌈ x ⌉ is the smallest integer ≥ x.

At the i-th time-step, you must apply the i-th operation exactly once.

For each j such that 1 ≤ j ≤ m, output the earliest time-step at which you can create exactly j bananas. If you cannot create exactly j bananas, output -1.

Input

The first line contains two space-separated integers n (1 ≤ n ≤ 200) and m (2 ≤ m ≤ 10^5).

Then, n lines follow, where the i-th line denotes the operation for the i-th timestep. Each such line contains three space-separated integers t_i, x'_i and y_i (1 ≤ t_i ≤ 2, 1≤ y_i≤ m).

Note that you are given x'_i, which is 10^5 ⋅ x_i. Thus, to obtain x_i, use the formula x_i= \dfrac{x'_i} {10^5}.

For type 1 operations, 1 ≤ x'_i ≤ 10^5 ⋅ m, and for type 2 operations, 10^5 < x'_i ≤ 10^5 ⋅ m.

Output

Print m integers, where the i-th integer is the earliest time-step when you can obtain exactly i bananas (or -1 if it is impossible).

Examples

Input


3 20
1 300000 2
2 400000 2
1 1000000 3


Output


-1 -1 1 -1 -1 1 -1 -1 -1 3 -1 2 3 -1 -1 3 -1 -1 -1 3 


Input


3 20
1 399999 2
2 412345 2
1 1000001 3


Output


-1 -1 -1 1 -1 -1 -1 1 -1 -1 3 -1 -1 -1 3 -1 2 -1 3 -1 

Note

In the first sample input, let us see how to create 16 number of bananas in three timesteps. Initially, k=0.

  * In timestep 1, we choose a_1=2, so we apply the type 1 update — k := ⌈(k+3)⌉ — two times. Hence, k is now 6. 
  * In timestep 2, we choose a_2=0, hence value of k remains unchanged. 
  * In timestep 3, we choose a_3=1, so we are applying the type 1 update k:= ⌈(k+10)⌉ once. Hence, k is now 16. 



It can be shown that k=16 cannot be reached in fewer than three timesteps with the given operations.

In the second sample input, let us see how to create 17 number of bananas in two timesteps. Initially, k=0.

  * In timestep 1, we choose a_1=1, so we apply the type 1 update — k := ⌈(k+3.99999)⌉ — once. Hence, k is now 4. 
  * In timestep 2, we choose a_2=1, so we apply the type 2 update — k := ⌈(k⋅ 4.12345)⌉ — once. Hence, k is now 17. 



It can be shown that k=17 cannot be reached in fewer than two timesteps with the given operations.

Difficulty: HARD
Tags: Dynamic programming

Graph algorithms

Graph traversal

Implementation
Skill types: Dynamic programming

Starter code:

Solutions:
from __future__ import division, print_function
import math
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BASE = int(10 ** 5)

def main():
	(n, m) = map(int, input().split())
	answer = [-1 for i in range(m + 1)]
	answer[0] = 0
	for step in range(n):
		(t, x, y) = map(int, input().split())
		bfs = []
		dis = [-1 for i in range(m + 1)]
		cur = 0
		for i in range(m + 1):
			if answer[i] != -1:
				bfs.append(i)
				dis[i] = 0
		if len(bfs) == m + 1:
			break
		for u in bfs:
			if dis[u] == y:
				continue
			v = 0
			if t == 1:
				v = math.ceil(u + x / BASE)
			else:
				v = math.ceil(u * x / BASE)
			if v > m:
				continue
			if dis[v] == -1:
				dis[v] = dis[u] + 1
				bfs.append(v)
				answer[v] = step + 1
	print(' '.join((str(x) for x in answer[1:])))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
import io, os
from collections import deque
input = lambda : sys.stdin.readline().rstrip()
XDIV = int(100000.0)

class Problem:

	def __init__(self):
		self.sol = []
		self.M = None

	def _next_step(self, dq, t, x, y, step):

		def operation(val):
			if t == 1:
				return val + int(math.ceil(x / XDIV))
			else:
				return int(math.ceil(val * x / XDIV))
		tempdq = deque()
		while dq:
			k = dq.popleft()
			tempdq.append(k)
			for _ in range(y):
				k = operation(k)
				if k > self.M or self.sol[k] != -1:
					break
				tempdq.append(k)
				self.sol[k] = step
		return tempdq

	def solve(self):
		(N, M) = map(int, input().split())
		dq = deque()
		self.M = M
		self.sol = [-1] * (M + 1)
		dq.append(0)
		self.sol[0] = 0
		for i in range(N):
			(t, x, y) = map(int, input().split())
			dq = self._next_step(dq, t, x, y, i + 1)
		self.sol.pop(0)
		sys.stdout.write(' '.join(map(str, self.sol)))

def main():
	p = Problem()
	T = 1
	while T:
		p.solve()
		T -= 1
main()


b = 10 ** 5

def f(t, x, k):
	if t == 1:
		return (x + k * b + b - 1) // b
	else:
		return (x * k + b - 1) // b
(n, m) = map(int, input().split())
res = [-1] * (m + 1)
res[0] = 0
for i in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	for k in range(m + 1):
		if res[k] in (-1, i):
			continue
		for _ in range(y):
			k = f(t, x, k)
			if k > m or res[k] > -1:
				break
			res[k] = i
res.pop(0)
print(*res)


import os, sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)

def ceil2(a, b):
	return math.floor((a + b - 1) / b)
TT = pow(10, 5)
(N, M) = getInts()
ans = [-1] * (M + 1)
done = set([0])
LIM = float(M * TT)
for i in range(1, N + 1):
	(t, x, y) = getInts()
	if t == 1:
		x = ceil2(x, TT)
		for j in list(done):
			for k in range(y):
				j += x
				if j > M or j in done:
					break
				done.add(j)
				ans[j] = i
	else:
		x = float(x)
		for j in list(done):
			for k in range(y):
				j = ceil2(j * x, TT)
				if j > M or j in done:
					break
				done.add(j)
				ans[j] = i
print(*ans[1:])


import sys, functools, collections, bisect, math, heapq
input = sys.stdin.readline
sys.setrecursionlimit(200000)
mod = 10 ** 9 + 7
(n, m) = map(int, input().strip().split())
res = [-1] * (m + 1)
res[0] = 0
DIV = 100000

def ceil_(a, b):
	return a // b + (a % b > 0)

def gnxt(curr, t, x):
	if t == 1:
		return curr + int(ceil_(x, DIV))
	return int(ceil_(curr * x, DIV))
for i in range(1, n + 1):
	(t, x, y) = map(int, input().strip().split())
	for j in range(m):
		if res[j] == -1 or res[j] == i:
			continue
		nxt = j
		for _ in range(y):
			nxt = gnxt(nxt, t, x)
			if nxt > m or res[nxt] != -1:
				break
			res[nxt] = i
print(' '.join((str(res[i]) for i in range(1, m + 1))))


import sys
import math
from collections import defaultdict, Counter, deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m) = map(int, input().split())
ans = [-1] * (m + 1)
visit = set([0])
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t == 1:
		d = (x + 10 ** 5 - 1) // 10 ** 5
		for k in list(visit):
			for j in range(y):
				k += d
				if k > m or k in visit:
					break
				ans[k] = i + 1
				visit.add(k)
	else:
		for k in list(visit):
			for j in range(y):
				k = math.floor((k * x + 10 ** 5 - 1) / 10 ** 5)
				if k > m or k in visit:
					break
				ans[k] = i + 1
				visit.add(k)
print(*ans[1:])


(n, m) = map(int, input().split())
N = 10 ** 5
dp = [[-1, -1] for _ in range(m + 1)]
dp[0] = [0, 0]
for T in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	for pre in range(m):
		if dp[pre][0] == -1:
			continue
		if dp[pre][0] == T:
			if dp[pre][1] == y:
				continue
			if t == 1:
				nxt = pre + (x - 1) // N + 1
				if nxt > m:
					break
				elif dp[nxt][0] == -1:
					dp[nxt] = [T, dp[pre][1] + 1]
			else:
				nxt = (pre * x - 1) // N + 1
				if nxt > m:
					break
				elif dp[nxt][0] == -1:
					dp[nxt] = [T, dp[pre][1] + 1]
		elif t == 1:
			nxt = pre + (x - 1) // N + 1
			if nxt > m:
				break
			elif dp[nxt][0] == -1:
				dp[nxt] = [T, 1]
		else:
			nxt = (pre * x - 1) // N + 1
			if nxt > m:
				break
			elif dp[nxt][0] == -1:
				dp[nxt] = [T, 1]
dp = [dp[i][0] for i in range(1, m + 1)]
print(*dp)


tt = 10 ** 5
(n, m) = map(int, input().split())
vis = [0 for i in range(m + 1)]
vis[0] = 1
for i in range(n):
	(t, x, y) = map(int, input().split())
	for j in range(m, -1, -1):
		if vis[j] == 0:
			continue
		ct = 0
		tmp = j
		while ct < y:
			if t == 1:
				tmp = tmp + (x + tt - 1) // tt
			else:
				tmp = (tmp * x + tt - 1) // tt
			if tmp > m or vis[tmp]:
				break
			ct += 1
			vis[tmp] = i + 2
for i in range(1, m + 1):
	if i == m:
		print(vis[i] - 1)
	else:
		print(vis[i] - 1, end=' ')


import sys
import math
from collections import deque
input = lambda : sys.stdin.readline().rstrip()
XDIV = int(100000.0)

class Problem:

	def __init__(self):
		self.sol = []
		self.vis = []
		self.M = None

	def _next_step(self, dq, t, x, y, step):

		def operation(val):
			if t == 1:
				return val + math.ceil(x / XDIV)
			else:
				return math.ceil(val * x / XDIV)
		tempdq = deque()
		while dq:
			k = dq.popleft()
			tempdq.append(k)
			for _ in range(y):
				k = operation(k)
				if k > self.M or self.vis[k]:
					break
				tempdq.append(k)
				self.vis[k] = True
				self.sol[k] = step
		return tempdq

	def solve(self):
		(N, M) = map(int, input().split())
		dq = deque()
		self.M = M
		self.sol = [-1] * (M + 1)
		self.vis = [False] * (M + 1)
		dq.append(0)
		self.sol[0] = 0
		self.vis[0] = True
		for i in range(N):
			(t, x, y) = map(int, input().split())
			dq = self._next_step(dq, t, x, y, i + 1)
		print(*self.sol[1:], sep=' ')

def main():
	p = Problem()
	T = 1
	while T:
		p.solve()
		T -= 1
main()


import io
import os
from math import ceil

def solve(N, M, TXY):

	def ceildivI(x, y):
		return (x + y - 1) // y

	def ceildivF(x, y):
		return ceil(x / y)
	M100000 = float(M * 10 ** 5)
	possible = {0}
	inf = 201
	earliest = [inf] * (M + 1)
	for (ts, (t, x, y)) in enumerate(TXY, start=1):
		if t == 1:
			x = ceildivI(x, 100000)
			for k in list(possible):
				for i in range(y):
					k = k + x
					if k > M or k in possible:
						break
					possible.add(k)
					earliest[k] = min(earliest[k], ts)
		else:
			x = float(x)
			for k in list(possible):
				for i in range(y):
					if k * x > M100000:
						break
					k = ceildivF(k * x, 100000.0)
					if k in possible:
						break
					possible.add(k)
					earliest[k] = min(earliest[k], ts)
	return ' '.join((str(x) if x != inf else '-1' for x in earliest[1:]))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = 1
for tc in range(1, TC + 1):
	(N, M) = [int(x) for x in input().split()]
	TXY = [[int(x) for x in input().split()] for i in range(N)]
	ans = solve(N, M, TXY)
	print(ans)


import time
import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7
TT = pow(10, 5)

def solve():

	def ceil2(a, b):
		return math.floor((a + b - 1) / b)
	(N, M) = getInts()
	ans = [-1] * (M + 1)
	ans[0] = 0
	done = set([0])
	LIM = float(M * 10 ** 5)
	for i in range(1, N + 1):
		(t, x, y) = getInts()
		if t == 1:
			x = ceil2(x, TT)
			for j in list(done):
				for k in range(y):
					j += x
					if j > M or j in done:
						break
					done.add(j)
					ans[j] = i
		else:
			x = float(x)
			for j in list(done):
				for k in range(y):
					if j * x > LIM:
						break
					j = ceil2(j * x, TT)
					if j > M or j in done:
						break
					done.add(j)
					ans[j] = i
	print(*ans[1:])
	return
solve()


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7
den = 10 ** 5
(n, m) = MI()
dp = [-1] * (m + 1)
kk = [0] * (m + 1)
dp[0] = 0
for k in range(1, n + 1):
	(t, x, y) = MI()
	if t == 1:
		x = (x + den - 1) // den
		if x == 0:
			continue
		for i in range(x, m + 1):
			if dp[i] != -1:
				continue
			if dp[i - x] == -1:
				continue
			if dp[i - x] == k:
				if kk[i - x] < y:
					dp[i] = k
					kk[i] = kk[i - x] + 1
			else:
				dp[i] = k
				kk[i] = 1
	else:
		for i in range(1, m + 1):
			if dp[i] != -1:
				continue
			l = den * (i - 1) // x + 1
			r = den * i // x
			if l > r or l == i:
				continue
			if dp[l] == -1:
				continue
			if dp[l] == k:
				if kk[l] < y:
					dp[i] = k
					kk[i] = kk[l] + 1
			else:
				dp[i] = k
				kk[i] = 1
print(*dp[1:])


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
MOD = 10 ** 9 + 7
(n, m) = map(int, input().split())
ans = [-1] * (m + 1)
ans[0] = 0
for i in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	k = x // 100000 + 1
	if x % 100000 == 0:
		k -= 1
	for j in range(m + 1):
		if ans[j] > -1 and ans[j] < i:
			if t == 1:
				curr = j + k
				count = 0
				while count < y and curr <= m and (ans[curr] == -1):
					ans[curr] = i
					count += 1
					curr = curr + k
			else:
				curr = j * x // 100000 + 1
				if j * x % 100000 == 0:
					curr -= 1
				count = 0
				while count < y and curr <= m and (ans[curr] == -1):
					ans[curr] = i
					q = x * curr // 100000 + 1
					if x * curr % 100000 == 0:
						q -= 1
					curr = q
					count += 1
finans = []
for i in range(1, m + 1):
	finans.append(ans[i])
print(' '.join(map(str, finans)))


from math import ceil
curr = 0

def ceil(x, y):
	return (x + y - 1) // y

def operation(type, x):
	global curr, DIV
	if type == 1:
		return curr + ceil(x, DIV)
	elif type == 2:
		return ceil(curr * x, DIV)
(n, m) = [int(i) for i in input().split()]
is_seen = [0 for i in range(m + 1)]
is_seen[0] = 1
ans = [-1 for i in range(m + 1)]
DIV = int(100000.0)
for timestep in range(n):
	(t, x, y) = [int(i) for i in input().split()]
	new_seen = []
	for pos_bananas in range(m + 1):
		if is_seen[pos_bananas]:
			curr = pos_bananas
			i = 1
			while i <= y:
				curr = operation(t, x)
				if curr > m:
					break
				if is_seen[curr]:
					break
				new_seen.append(curr)
				ans[curr] = timestep + 1
				i += 1
	for idx in new_seen:
		is_seen[idx] = 1
print(*ans[1:])


import os, sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	dp = [0] + [n + 1] * m
	ti = [0] * (m + 1)
	for _ in range(1, n + 1):
		(t, x, y) = map(int, input().split())
		for i in range(m + 1):
			if dp[i] == n + 1 or ti[i] == y:
				continue
			ne = i + (x + 99999) // 100000 if t == 1 else (i * x + 99999) // 100000
			if ne > m or dp[ne] < _:
				continue
			ti[ne] = min(ti[ne], ti[i] + 1) if dp[ne] == _ else ti[i] + 1
			dp[ne] = _
		ti = [0] * (m + 1)
	for i in range(m + 1):
		if dp[i] == n + 1:
			dp[i] = -1
	print(*dp[1:])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys, os, io
input = sys.stdin.readline
from math import ceil
(N, M) = map(int, input().split())
lis = [False] * (M + 1)
lis[0] = True
ans = [-1] * (M + 1)
for i in range(1, N + 1):
	(t, x, y) = map(int, input().split())
	new_lis = [False] * (M + 1)
	for k in range(M + 1):
		if lis[k]:
			if not new_lis[k]:
				new_lis[k] = True
			else:
				continue
			z = k
			for _ in range(y):
				if t == 1:
					z = ceil(z + x / 100000)
				else:
					z = ceil(z * x / 100000)
				if z > M or lis[z] or new_lis[z]:
					break
				ans[z] = i
				new_lis[z] = True
	lis = new_lis
print(*ans[1:])


import sys
input = sys.stdin.readline

def t1(k, x):
	if x % 100000 == 0:
		return k + x // 100000
	else:
		return k + x // 100000 + 1

def t2(k, x):
	ret = k * x
	if ret % 100000 == 0:
		return ret // 100000
	else:
		return ret // 100000 + 1

def main():
	(n, m) = map(int, input().split())
	ans = [-1] * (m + 1)
	ans[0] = 0
	for i in range(1, n + 1):
		(t, x, y) = map(int, input().split())
		tf = [False] * (m + 1)
		if t == 1:
			for j in range(m + 1):
				if tf[j] or ans[j] == -1:
					continue
				cnt = y
				k = j
				while cnt > 0:
					cnt -= 1
					k = t1(k, x)
					if k > m:
						break
					tf[k] = True
					if ans[k] == -1:
						ans[k] = i
					else:
						cnt = y
		else:
			for j in range(m + 1):
				if j == 0:
					continue
				if tf[j] or ans[j] == -1:
					continue
				cnt = y
				k = j
				while cnt > 0:
					cnt -= 1
					k = t2(k, x)
					if k > m:
						break
					tf[k] = True
					if ans[k] == -1:
						ans[k] = i
					else:
						cnt = y
	print(*ans[1:])
for _ in range(1):
	main()


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
import heapq as h, time
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7
DIV = int(100000)

def gnxt(curr, t, x):
	if t == 1:
		return curr + int(ceil_(x, DIV))
	return int(ceil_(curr * x, DIV))

def solve():
	(n, m) = getInts()
	ans = [-1 for i in range(m + 1)]
	ans[0] = 0
	for i in range(1, n + 1):
		(t, x, y) = getInts()
		for j in range(m):
			if ans[j] == -1 or ans[j] == i:
				continue
			nxt = j
			for _ in range(y):
				nxt = gnxt(nxt, t, x)
				if nxt > m or ans[nxt] != -1:
					break
				ans[nxt] = i
	print(*ans[1:])
solve()


from math import ceil
import sys
input = sys.stdin.readline
(n, m) = map(int, input().rstrip().split())
ans = [-1] * (m + 1)
ans[0] = 0
txy = []
for _ in range(n):
	txy.append(tuple(map(int, input().rstrip().split())))
for time in range(n):
	for b in range(m + 1):
		if time >= ans[b] >= 0:
			(t, x, y) = txy[time]
			banana = b
			if t == 1:
				banana = ceil(banana + x / 100000)
				while banana <= m and y > 0:
					if ans[banana] == -1:
						ans[banana] = time + 1
					else:
						break
					banana = ceil(banana + x / 100000)
					y -= 1
			else:
				banana = ceil(banana * x / 100000)
				while banana <= m and y > 0:
					if ans[banana] == -1:
						ans[banana] = time + 1
					else:
						break
					banana = ceil(banana * x / 100000)
					y -= 1
print(' '.join(map(str, ans[1:])))


import sys

def ceil(x, y):
	return (x + y - 1) // y

def input():
	return sys.stdin.readline().rstrip()
MOD = int(100000.0)

def slv():
	(n, m) = map(int, input().split())
	ans = [-1] * (m + 1)
	ans[0] = 0
	seen = [False] * (m + 1)
	seen[0] = True
	for i in range(n):
		(t, x, y) = map(int, input().split())
		tmpstack = []
		for ni in range(m + 1):
			cost = ans[ni]
			if not seen[ni]:
				continue
			for op in range(y):
				if t == 1:
					ni += ceil(x, MOD)
				else:
					ni *= x
					ni = ceil(ni, MOD)
				if ni > m:
					break
				if seen[ni]:
					break
				if ans[ni] < 0:
					tmpstack.append((ni, i + 1))
		for (idx, v) in tmpstack:
			ans[idx] = v
			seen[idx] = True
	print(*ans[1:m + 1])
	return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()


import sys

def ceil(x, y):
	return (x + y - 1) // y

class Solution:

	def __init__(self, m):
		self.list = [0]
		self.list += [-1] * m
		self.list_stack = [0]
		self.m = m
		self.div = 10 ** 5

	def update(self, t, x, y, step):
		new_list = []
		for el in self.list_stack:
			for _ in range(1, y + 1):
				if t == 1:
					el += ceil(x, self.div)
				else:
					el *= x
					el = ceil(el, self.div)
				if el > self.m or self.list[el] != -1:
					break
				else:
					new_list.append(el)
					self.list[el] = step
		self.list_stack += new_list
(n, m) = [int(el) for el in input().split()]
sol = Solution(m)
for i in range(n):
	(t, x, y) = [int(el) for el in input().split()]
	sol.update(t, x, y, i + 1)
sys.stdout.write(' '.join(map(str, sol.list[1:])))


from math import ceil
(n, m) = map(int, input().split())
visited = [-1 for i in range(m + 1)]
visited[0] = 0
for tim in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	if t == 1:
		x = ceil(x / 100000)
		for i in range(m, -1, -1):
			k = i
			if visited[k] == -1:
				continue
			for j in range(y):
				k += x
				if k > m or visited[k] != -1:
					break
				else:
					visited[k] = tim
	else:
		for i in range(m, -1, -1):
			k = i
			if visited[k] == -1:
				continue
			for j in range(y):
				k = ceil(k * x / 100000)
				if k > m or visited[k] != -1:
					break
				else:
					visited[k] = tim
for i in range(1, m + 1):
	print(visited[i], end=' ')
print()


import sys
from math import ceil
import io, os
from queue import PriorityQueue
input = lambda : sys.stdin.readline().rstrip()
XDIV = int(100000.0)

class Problem:

	def __init__(self):
		self.sol = []
		self.M = None

	def _next_step(self, t, x, y, step):
		i = self.M
		last = 0 if t == 1 else 1
		while i >= last:
			k = i
			i -= 1
			if self.sol[k] == -1:
				continue
			j = 0
			while j < y:
				j += 1
				if t == 1:
					k = k + ceil(x / XDIV)
				else:
					k = ceil(k * x / XDIV)
				if k > self.M or self.sol[k] != -1:
					break
				self.sol[k] = step

	def solve(self):
		(N, M) = map(int, input().split())
		self.M = M
		self.sol = [-1] * (M + 1)
		self.sol[0] = 0
		for i in range(N):
			(t, x, y) = map(int, input().split())
			self._next_step(t, x, y, i + 1)
		self.sol.pop(0)
		sys.stdout.write(' '.join(map(str, self.sol)))

def main():
	p = Problem()
	T = 1
	while T:
		p.solve()
		T -= 1
main()


from sys import stdin, stdout
import math
DIV = int(100000.0)

def ceil(x, y):
	return (x + y - 1) // y
(n, m) = map(int, stdin.readline().split())
r_a = [-1] * (m + 1)
d_a = [[-1, -1] for _ in range(m + 1)]
d_a[0] = [0, 0]
for i in range(1, n + 1):
	(t, x, y) = map(int, stdin.readline().split())
	for j in range(m + 1):
		nj = 0
		if t == 1:
			nj = j + ceil(x, DIV)
		else:
			nj = ceil(j * x, DIV)
		if nj > m:
			break
		if d_a[j][1] != -1:
			if d_a[j][0] == i and d_a[j][1] < y and (d_a[nj][0] == -1):
				r_a[nj] = i
				d_a[nj] = [i, d_a[j][1] + 1]
			elif d_a[j][0] != i and d_a[nj][0] == -1:
				r_a[nj] = i
				d_a[nj] = [i, 1]
r_a.pop(0)
stdout.write(' '.join(map(str, r_a)))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
(n, m) = map(int, input().split())
visited = [False for i in range(0, m + 1)]
ans = [-1 for i in range(0, m + 1)]
visited[0] = True
ans[0] = 0
queries = []
for i in range(n):
	k = list(map(int, input().split()))
	queries.append(k)

def opr(t, x, k):
	if t == 1:
		k = k + math.ceil(x / 10 ** 5)
	else:
		k = math.ceil(k * x / 10 ** 5)
	return k
for q in range(1, n + 1):
	new = visited.copy()
	(t, x, y) = queries[q - 1]
	for j in range(0, m + 1):
		if visited[j]:
			curr = j
			for i in range(y):
				curr = opr(t, x, curr)
				if m < curr:
					break
				if visited[curr]:
					break
				new[curr] = True
				ans[curr] = q
	visited = new
print(*ans[1:])


import math

def main():
	(n, m) = readIntArr()
	t = []
	x = []
	y = []
	for __ in range(n):
		(tt, xx, yy) = readIntArr()
		t.append(tt)
		x.append(xx)
		y.append(yy)
	minSteps = [-1 for __ in range(m + 1)]
	minSteps[0] = 0
	for i in range(n):
		tt = t[i]
		xx = x[i]
		yy = y[i]
		for j in range(m, -1, -1):
			if minSteps[j] != -1:
				curr = j
				for ___ in range(yy):
					if tt == 1:
						curr = curr + math.ceil(xx / 100000)
					else:
						curr = math.ceil(curr * xx / 100000)
					if curr > m or minSteps[curr] != -1:
						break
					else:
						minSteps[curr] = i + 1
	oneLineArrayPrint(minSteps[1:])
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultVal, dimensionArr):
	dv = defaultVal
	da = dimensionArr
	if len(da) == 1:
		return [dv for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import sys, os, io
input = sys.stdin.readline
from math import ceil
(N, M) = map(int, input().split())
visited = [False] * (M + 1)
visited[0] = True
ans = [-1] * (M + 1)
for i in range(1, N + 1):
	(t, x, y) = map(int, input().split())
	lis = []
	for k in range(M + 1):
		if visited[k]:
			z = k
			for _ in range(y):
				if t == 1:
					z = (z * 100000 + x + 99999) // 100000
				else:
					z = (z * x + 99999) // 100000
				if z > M or visited[z]:
					break
				ans[z] = i
				lis.append(z)
	for l in lis:
		visited[l] = True
print(*ans[1:])


from math import ceil
from sys import stdin
input = stdin.readline

def previous_iteration_generator(a, current_iteration):
	for (i, x) in enumerate(a):
		if x != -1 and x < current_iteration:
			yield i

def read_n_numbers():
	return map(int, input().split())

def main():
	(n, m) = read_n_numbers()
	a = [-1 for _ in range(m + 1)]
	a[0] = 0
	for i in range(1, n + 1):
		(t, x, y) = read_n_numbers()
		x = x
		for index in previous_iteration_generator(a, i):
			value = index
			for _ in range(y):
				value = ceil(value + x / 10 ** 5 if t == 1 else value * x / 10 ** 5)
				if value > m or a[value] != -1:
					break
				a[value] = i
	print(*a[1:])
main()


import io
import os
from collections import Counter, defaultdict, deque
from math import ceil, floor

def solve(N, M, TXY):

	def ceildiv(x, y):
		return floor((x + y - 1) / y)
	big = float(M * 10 ** 5)
	possible = {0}
	inf = float('inf')
	earliest = [inf] * (M + 1)
	for (ts, (t, x, y)) in enumerate(TXY, start=1):
		if t == 1:
			assert 1 <= x <= M * 10 ** 5
			x = ceildiv(x, 10 ** 5)
			for k in list(possible):
				for i in range(y):
					k = k + x
					if k > M or k in possible:
						break
					possible.add(k)
					earliest[k] = min(earliest[k], ts)
		else:
			assert t == 2
			assert 10 ** 5 < x <= M * 10 ** 5
			x = float(x)
			for k in list(possible):
				for i in range(y):
					if k * x > big:
						break
					k = ceildiv(k * x, 10 ** 5)
					if k > M or k in possible:
						break
					possible.add(k)
					earliest[k] = min(earliest[k], ts)
	return ' '.join((str(x) if x != inf else '-1' for x in earliest[1:]))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = 1
for tc in range(1, TC + 1):
	(N, M) = [int(x) for x in input().split()]
	TXY = [[int(x) for x in input().split()] for i in range(N)]
	ans = solve(N, M, TXY)
	print(ans)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, m) = map(int, input().split())
ANS = [[-1, -1] for i in range(m + 1)]
ANS[0] = [0, 0]
for i in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	for j in range(m):
		if t == 1:
			k = (j * 10 ** 5 + x + 10 ** 5 - 1) // 10 ** 5
		else:
			k = (j * x + 10 ** 5 - 1) // 10 ** 5
		if k > m:
			break
		if ANS[j][0] != -1 and ANS[j] != [i, y]:
			if ANS[j][0] == i:
				if ANS[k][0] == -1:
					ANS[k] = [i, ANS[j][1] + 1]
			elif ANS[k][0] == -1:
				ANS[k] = [i, 1]
ANS2 = [ANS[i][0] for i in range(1, m + 1)]
print(*ANS2)


import sys
input = lambda : sys.stdin.readline().rstrip()
DIV = int(100000.0)

def ceil(x, y):
	return (x + y - 1) // y
(T, M) = list(map(int, input().split()))
is_seen = [0 for _ in range(M + 1)]
is_seen[0] = 1
answer = [-1 for _ in range(M + 1)]
answer[0] = 0
o = 0
for timestep in range(1, T + 1):
	(t, x, y) = list(map(int, input().split()))

	def operation(val):
		if t == 1:
			return curr + ceil(x, DIV)
		else:
			return ceil(curr * x, DIV)
	k = 0
	setting = []
	while k <= M:
		if is_seen[k]:
			curr = k
			i = 0
			while i < y:
				i += 1
				o += 1
				curr = operation(curr)
				if curr > M:
					break
				if is_seen[curr]:
					break
				setting.append(curr)
				answer[curr] = timestep
		k += 1
	for idx in setting:
		is_seen[idx] = 1
sys.stdout.write(' '.join(map(str, answer[1:])))


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, m) = map(int, input().split())
ans = [[-1, -1] for i in range(m + 1)]
ans[0][0] = [0, 0]
for i in range(1, n + 1):
	(t, x, y) = map(int, input().split())
	for j in range(m):
		if t == 1:
			nex = int(math.ceil(j + x / 100000))
		else:
			nex = int(math.ceil(j * x / 100000))
		if nex > m:
			break
		if ans[j][0] != -1:
			if ans[j][0] == i:
				if ans[j][1] < y:
					if ans[nex][0] == -1:
						ans[nex] = [i, ans[j][1] + 1]
			elif ans[nex][0] == -1:
				ans[nex] = [i, 1]
for i in range(1, m + 1):
	print(ans[i][0], end=' ')