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

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

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

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

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

a = A("a")
h = B("h")
i = C("i")
j = D("j")
e = E("e")
f = D("f")

a.w = h
h.u = i
i.w = e
i.u = e
j.z = f
j.o = h
j.s = h
e.w = h
f.z = j
f.o = h
f.s = h
assert f.o.u.w.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
i = C("i")
j = D("j")
e = E("e")
f = D("f")

a.w = h
h.u = i
i.w = e
i.u = e
j.z = f
j.o = h
j.s = h
e.w = h
f.z = j
f.o = h
f.s = h
assert f.o.u.w.w.u.txt == "i"