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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: A = None
        self.txt = txt

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

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

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

m.o = c
f.t = c
f.y = c
f.q = l
l.z = c
l.p = m
e.z = l
e.q = h
e.p = h
c.r = m
c.u = m
b.z = l
b.q = h
b.p = f
h.t = c
h.y = c
h.q = l
assert c.r.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: A = None
        self.txt = txt

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

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

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

m.o = c
f.t = c
f.y = c
f.q = l
l.z = c
l.p = m
e.z = l
e.q = h
e.p = h
c.r = m
c.u = m
b.z = l
b.q = h
b.p = f
h.t = c
h.y = c
h.q = l
assert c.r.o.r.o.txt == "c"