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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: E = None
        self.p: D = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

m.o = j
m.v = l
m.s = l
j.r = l
j.w = l
j.s = h
h.r = c
h.o = l
h.u = l
h.y = m
l.u = h
c.r = m
c.z = m
c.o = m
c.u = f
c.p = l
f.r = m
f.z = m
f.o = m
f.u = c
f.p = l
assert h.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: E = None
        self.p: D = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

m.o = j
m.v = l
m.s = l
j.r = l
j.w = l
j.s = h
h.r = c
h.o = l
h.u = l
h.y = m
l.u = h
c.r = m
c.z = m
c.o = m
c.u = f
c.p = l
f.r = m
f.z = m
f.o = m
f.u = c
f.p = l
assert h.u.u.u.u.u.txt == "l"