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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
m = C("m")
f = D("f")
c = E("c")
a = A("a")

h.o = c
j.o = h
j.x = m
m.v = a
m.o = h
m.r = j
f.o = m
f.s = m
f.r = m
f.u = j
f.w = c
c.w = j
c.s = m
a.o = c
assert m.v.o.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
m = C("m")
f = D("f")
c = E("c")
a = A("a")

h.o = c
j.o = h
j.x = m
m.v = a
m.o = h
m.r = j
f.o = m
f.s = m
f.r = m
f.u = j
f.w = c
c.w = j
c.s = m
a.o = c
assert m.v.o.w.x.txt == "m"