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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.u: C = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

d.o = e
d.y = i
d.p = m
f.t = e
f.w = m
h.w = f
m.y = i
e.x = f
e.s = f
e.y = f
e.u = h
e.v = i
a.o = e
a.y = h
a.p = m
i.w = f
assert d.y.w.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: C = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.u: C = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

d.o = e
d.y = i
d.p = m
f.t = e
f.w = m
h.w = f
m.y = i
e.x = f
e.s = f
e.y = f
e.u = h
e.v = i
a.o = e
a.y = h
a.p = m
i.w = f
assert d.y.w.w.y.w.txt == "f"