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

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

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

h = A("h")
f = B("f")
l = C("l")
c = A("c")
m = A("m")
j = B("j")
b = B("b")
g = B("g")
a = A("a")
d = C("d")

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

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

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

h = A("h")
f = B("f")
l = C("l")
c = A("c")
m = A("m")
j = B("j")
b = B("b")
g = B("g")
a = A("a")
d = C("d")

h.t = d
h.o = b
f.x = m
l.y = a
c.t = l
c.o = g
m.t = l
m.o = f
j.x = m
b.x = m
g.x = m
a.t = l
a.o = j
d.y = c
assert c.o.x.o.x.t.y.o.txt == "j"