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

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

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

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

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

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

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

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

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

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

j.w = i
j.t = a
j.z = n
a.s = n
i.y = a
n.z = a
n.v = a
n.q = i
n.w = i
h.w = i
h.t = a
h.z = n
c.w = i
c.t = a
c.z = k
k.z = a
k.v = a
k.q = i
k.w = i
assert j.w.y.s.z.s.q.txt == "i"