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

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

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

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

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

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

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

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

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

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

d.z = j
d.u = n
d.t = n
d.s = i
a.t = j
a.y = c
c.p = i
c.y = i
c.r = i
c.t = j
k.s = c
k.y = c
k.q = n
k.z = d
n.s = i
n.q = k
n.y = c
n.z = d
i.p = c
i.y = c
i.r = c
i.t = j
j.t = a
j.y = i
assert a.t.y.p.t.txt == "j"