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

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

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

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

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

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

c.o = e
c.r = d
m.u = h
m.p = c
e.r = g
e.t = m
e.q = m
e.o = h
h.u = m
h.v = m
h.t = g
g.z = m
g.s = h
d.r = g
d.t = m
d.q = m
d.o = h
assert e.r.s.u.p.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

c.o = e
c.r = d
m.u = h
m.p = c
e.r = g
e.t = m
e.q = m
e.o = h
h.u = m
h.v = m
h.t = g
g.z = m
g.s = h
d.r = g
d.t = m
d.q = m
d.o = h
assert e.r.s.u.p.o.t.txt == "m"