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

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

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

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

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

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

c.p = l
c.z = i
c.u = e
c.y = h
m.v = h
m.z = e
m.r = c
e.r = c
e.x = h
h.q = e
i.o = c
i.q = e
i.z = e
l.o = c
l.q = e
l.z = e
assert h.q.r.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: E = None
        self.u: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

c.p = l
c.z = i
c.u = e
c.y = h
m.v = h
m.z = e
m.r = c
e.r = c
e.x = h
h.q = e
i.o = c
i.q = e
i.z = e
l.o = c
l.q = e
l.z = e
assert h.q.r.y.q.txt == "e"