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

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

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

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

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

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

a.q = l
i.r = h
i.x = a
i.o = f
h.z = e
h.p = e
h.t = f
h.o = a
l.y = e
m.o = a
f.z = l
f.t = h
f.o = a
f.p = e
e.y = l
assert f.o.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

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

a.q = l
i.r = h
i.x = a
i.o = f
h.z = e
h.p = e
h.t = f
h.o = a
l.y = e
m.o = a
f.z = l
f.t = h
f.o = a
f.p = e
e.y = l
assert f.o.q.y.txt == "e"