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

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

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

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

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

e.z = k
e.q = k
e.w = h
c.u = h
c.p = k
c.s = d
k.w = h
h.w = d
h.s = c
h.u = k
h.v = k
d.z = k
d.q = k
d.w = h
assert c.p.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

e.z = k
e.q = k
e.w = h
c.u = h
c.p = k
c.s = d
k.w = h
h.w = d
h.s = c
h.u = k
h.v = k
d.z = k
d.q = k
d.w = h
assert c.p.w.w.w.txt == "h"