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

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

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

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

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

e = A("e")
g = B("g")
b = C("b")
j = D("j")
h = E("h")
i = C("i")
m = D("m")

e.v = h
g.o = j
g.z = b
g.q = b
g.p = e
b.o = h
j.o = m
j.r = h
h.v = m
h.t = g
i.o = h
m.o = j
m.r = h
assert h.v.o.r.v.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

e = A("e")
g = B("g")
b = C("b")
j = D("j")
h = E("h")
i = C("i")
m = D("m")

e.v = h
g.o = j
g.z = b
g.q = b
g.p = e
b.o = h
j.o = m
j.r = h
h.v = m
h.t = g
i.o = h
m.o = j
m.r = h
assert h.v.o.r.v.o.r.txt == "h"