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

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

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

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

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

f.z = h
f.x = n
h.q = d
h.y = d
h.p = e
e.o = d
e.w = n
e.s = n
e.t = c
c.u = e
n.o = h
n.w = e
n.s = e
n.t = c
d.q = h
d.y = h
d.p = e
assert e.s.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: C = None
        self.txt = txt

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

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

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

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

f.z = h
f.x = n
h.q = d
h.y = d
h.p = e
e.o = d
e.w = n
e.s = n
e.t = c
c.u = e
n.o = h
n.w = e
n.s = e
n.t = c
d.q = h
d.y = h
d.p = e
assert e.s.w.t.txt == "c"