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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: E = None
        self.q: A = None
        self.w: E = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
g = C("g")
l = D("l")
n = E("n")

h.y = g
h.o = g
h.z = l
h.q = i
i.s = n
i.q = l
g.t = n
g.s = n
g.w = n
g.q = h
l.u = g
l.w = g
l.z = i
l.r = h
n.s = h
n.q = i
assert h.y.t.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: D = None
        self.o: C = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: E = None
        self.q: A = None
        self.w: E = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
g = C("g")
l = D("l")
n = E("n")

h.y = g
h.o = g
h.z = l
h.q = i
i.s = n
i.q = l
g.t = n
g.s = n
g.w = n
g.q = h
l.u = g
l.w = g
l.z = i
l.r = h
n.s = h
n.q = i
assert h.y.t.s.q.q.txt == "l"