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

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

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

h = A("h")
g = B("g")
i = C("i")
e = B("e")
c = C("c")
a = C("a")
l = A("l")
j = A("j")
f = C("f")
d = B("d")

h.t = a
g.o = f
i.r = f
i.x = g
e.o = a
c.r = a
c.x = g
a.r = c
a.x = e
l.t = c
j.t = a
f.r = c
f.x = g
d.o = i
assert c.x.o.x.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

h = A("h")
g = B("g")
i = C("i")
e = B("e")
c = C("c")
a = C("a")
l = A("l")
j = A("j")
f = C("f")
d = B("d")

h.t = a
g.o = f
i.r = f
i.x = g
e.o = a
c.r = a
c.x = g
a.r = c
a.x = e
l.t = c
j.t = a
f.r = c
f.x = g
d.o = i
assert c.x.o.x.o.x.o.txt == "f"