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

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

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

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

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

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

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

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

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

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

c.w = f
f.x = n
d.z = f
d.y = e
d.p = e
d.t = c
e.t = g
e.s = f
l.z = f
l.y = e
l.p = e
l.t = c
g.w = f
n.z = f
n.y = e
n.p = e
n.t = c
assert d.t.w.x.txt == "n"