class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.z: A = None
        self.y: C = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
l = C("l")
b = D("b")
m = C("m")
j = A("j")
i = B("i")

a.o = b
a.u = i
a.z = j
a.y = l
c.t = i
c.p = b
l.q = b
b.o = m
b.z = m
m.q = b
j.o = b
j.u = c
j.z = a
j.y = l
i.t = c
i.p = b
assert c.t.p.o.q.z.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.z: A = None
        self.y: C = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
l = C("l")
b = D("b")
m = C("m")
j = A("j")
i = B("i")

a.o = b
a.u = i
a.z = j
a.y = l
c.t = i
c.p = b
l.q = b
b.o = m
b.z = m
m.q = b
j.o = b
j.u = c
j.z = a
j.y = l
i.t = c
i.p = b
assert c.t.p.o.q.z.q.o.txt == "m"