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

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

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

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

k = A("k")
n = B("n")
c = C("c")
a = D("a")
d = D("d")

k.p = c
k.z = c
k.y = d
k.t = n
n.u = c
c.y = k
c.o = n
a.t = c
a.o = c
a.s = k
d.t = c
d.o = c
d.s = k
assert c.o.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.y: D = None
        self.t: B = None
        self.txt = txt

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

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

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

k = A("k")
n = B("n")
c = C("c")
a = D("a")
d = D("d")

k.p = c
k.z = c
k.y = d
k.t = n
n.u = c
c.y = k
c.o = n
a.t = c
a.o = c
a.s = k
d.t = c
d.o = c
d.s = k
assert c.o.u.y.txt == "k"