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

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

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

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

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

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

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

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

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

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

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

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

f.w = m
f.t = e
f.o = d
m.s = e
m.t = d
m.o = c
c.y = f
c.w = m
c.p = h
h.o = c
h.x = c
h.s = f
d.t = c
e.o = c
e.x = c
e.s = f
assert m.t.t.p.s.o.t.txt == "c"