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

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
d = D("d")
l = E("l")
e = E("e")

f.p = c
f.x = c
f.z = c
f.w = d
j.r = d
c.z = j
c.p = e
d.s = f
d.u = f
l.v = c
l.t = c
l.p = d
l.q = j
l.y = f
e.v = c
e.t = c
e.p = d
e.q = j
e.y = f
assert f.w.u.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.w: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
d = D("d")
l = E("l")
e = E("e")

f.p = c
f.x = c
f.z = c
f.w = d
j.r = d
c.z = j
c.p = e
d.s = f
d.u = f
l.v = c
l.t = c
l.p = d
l.q = j
l.y = f
e.v = c
e.t = c
e.p = d
e.q = j
e.y = f
assert f.w.u.w.s.txt == "f"