class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: A = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
d = C("d")
l = D("l")
c = A("c")
g = B("g")
b = B("b")

k.z = i
k.p = c
k.u = g
k.q = b
i.s = l
i.z = d
i.p = d
d.p = k
l.t = c
c.z = i
c.p = k
c.u = g
c.q = b
g.s = l
g.z = d
g.p = d
b.s = l
b.z = d
b.p = d
assert b.s.t.p.u.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: A = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
d = C("d")
l = D("l")
c = A("c")
g = B("g")
b = B("b")

k.z = i
k.p = c
k.u = g
k.q = b
i.s = l
i.z = d
i.p = d
d.p = k
l.t = c
c.z = i
c.p = k
c.u = g
c.q = b
g.s = l
g.z = d
g.p = d
b.s = l
b.z = d
b.p = d
assert b.s.t.p.u.s.t.txt == "c"