class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

c = A("c")
g = B("g")
f = B("f")
k = A("k")
l = B("l")
a = B("a")
b = B("b")
e = B("e")

c.t = k
c.u = k
g.s = b
g.t = b
f.s = a
f.t = e
k.t = c
k.u = c
l.s = g
l.t = b
a.s = f
a.t = l
b.s = g
b.t = g
e.s = b
e.t = g
assert l.t.t.t.t.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

c = A("c")
g = B("g")
f = B("f")
k = A("k")
l = B("l")
a = B("a")
b = B("b")
e = B("e")

c.t = k
c.u = k
g.s = b
g.t = b
f.s = a
f.t = e
k.t = c
k.u = c
l.s = g
l.t = b
a.s = f
a.t = l
b.s = g
b.t = g
e.s = b
e.t = g
assert l.t.t.t.t.s.s.txt == "g"