<pre>
from math import *

class Chain:
	def __init__(self, final_product):
		self.infinite = False
		self.steps = list()
		self.got_final_product = False
		self.gain = 1
		self.final_product = final_product

	def add_step(self, offer):
		self.steps.append(offer)
		self.gain *= offer[2]
		if offer[1] == self.final_product:
			self.got_final_product = True

	def copy(self):
		n = Chain(self.final_product)
		n.infinite = self.infinite
		n.steps = list(self.steps)
		n.got_final_product = self.got_final_product
		n.gain = self.gain
		return n

while True:
	try:
		data = input().strip().split(' ')
	except:
		exit(0)
	T = int(data[0])
	F = int(data[1])
	F_u = int(data[2])
	F_n = int(data[3])

	if T == 0 and F == 0 and F_u == 0 and F_n == 0:
		exit(0)

	offers = []
	#print(&quot;T&quot;, T, F, F_u, F_n)
	for i in range(T):
		data = input().strip().split(' ')
		offers.append((
			int(data[0]),
			int(data[1]),
			e**float(data[2])
			))
	#print(offers)
	chains = list()
	for offer in offers:
		if offer[0] == F_u:
			c = Chain(F_n)
			c.add_step(offer)
			chains.append(c)
	flow = True

	while len(chains) &gt; 0 and flow:
		c = chains.pop()
		#print(id(c), c.infinite, c.steps, c.got_final_product, c.gain, c.final_product )
		if c.infinite and c.got_final_product:
			print( &quot;TRUE&quot; )
			chains.append(c)
			flow = False
			continue

		possible_offers = list()

		for offer in offers:

			if c.steps[-1][1] != offer[0]:
				continue

			possible_offers.append(offer)


		for offer in possible_offers:
			if offer in c.steps:
				if c.gain &gt; 1:
					c.infinite = True
					chains.append(c)
				continue

			n = c.copy()

			n.add_step(offer)
			chains.append(n)
	
	if len(chains) == 0:
		print (&quot;FALSE&quot;)
</pre>
