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

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

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

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

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

m = A("m")
f = B("f")
l = C("l")
g = D("g")
h = E("h")
c = C("c")

m.w = g
m.t = f
m.z = f
f.o = l
f.q = l
f.s = m
f.u = g
l.x = m
l.t = c
l.o = c
l.u = h
l.w = f
g.x = l
h.t = l
c.x = m
c.t = l
c.o = l
c.u = h
c.w = f
assert h.t.x.w.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

m = A("m")
f = B("f")
l = C("l")
g = D("g")
h = E("h")
c = C("c")

m.w = g
m.t = f
m.z = f
f.o = l
f.q = l
f.s = m
f.u = g
l.x = m
l.t = c
l.o = c
l.u = h
l.w = f
g.x = l
h.t = l
c.x = m
c.t = l
c.o = l
c.u = h
c.w = f
assert h.t.x.w.x.w.txt == "f"