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

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

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

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

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

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

d.x = c
d.v = l
c.p = b
l.t = f
l.s = f
l.x = c
f.r = b
b.u = f
b.w = f
b.s = f
assert f.r.u.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

d.x = c
d.v = l
c.p = b
l.t = f
l.s = f
l.x = c
f.r = b
b.u = f
b.w = f
b.s = f
assert f.r.u.r.w.txt == "f"