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

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

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

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

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

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

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

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

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

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

h.w = k
k.t = j
j.p = k
j.r = i
j.u = i
j.z = n
d.s = i
d.z = i
d.q = i
n.w = k
e.s = k
e.q = k
e.z = i
i.t = j
c.w = k
assert d.q.t.z.w.t.u.txt == "i"