class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

i = A("i")
f = B("f")
d = C("d")
g = D("g")
h = E("h")

i.t = d
f.o = h
f.s = h
f.w = d
d.s = g
d.o = h
g.u = f
h.r = f
assert d.s.u.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

i = A("i")
f = B("f")
d = C("d")
g = D("g")
h = E("h")

i.t = d
f.o = h
f.s = h
f.w = d
d.s = g
d.o = h
g.u = f
h.r = f
assert d.s.u.w.s.txt == "g"