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

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

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

j = A("j")
a = B("a")
k = C("k")
h = B("h")
e = C("e")
l = B("l")
d = A("d")
i = B("i")
n = C("n")

j.x = d
a.o = e
a.p = k
a.z = h
k.y = j
h.o = k
h.p = k
h.z = a
e.y = d
l.o = k
l.p = e
l.z = i
d.x = j
i.o = e
i.p = k
i.z = a
n.y = d
assert l.p.y.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
k = C("k")
h = B("h")
e = C("e")
l = B("l")
d = A("d")
i = B("i")
n = C("n")

j.x = d
a.o = e
a.p = k
a.z = h
k.y = j
h.o = k
h.p = k
h.z = a
e.y = d
l.o = k
l.p = e
l.z = i
d.x = j
i.o = e
i.p = k
i.z = a
n.y = d
assert l.p.y.x.x.x.x.x.txt == "j"