class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
d = A("d")
n = A("n")
l = B("l")
f = C("f")
m = A("m")
h = B("h")

j.o = g
k.z = h
k.t = h
g.x = f
d.o = g
n.o = f
l.z = k
l.t = k
f.x = g
m.o = f
h.z = l
h.t = l
assert l.z.z.z.t.z.z.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
d = A("d")
n = A("n")
l = B("l")
f = C("f")
m = A("m")
h = B("h")

j.o = g
k.z = h
k.t = h
g.x = f
d.o = g
n.o = f
l.z = k
l.t = k
f.x = g
m.o = f
h.z = l
h.t = l
assert l.z.z.z.t.z.z.t.t.t.txt == "l"