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

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

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

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

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

h = A("h")
e = B("e")
n = C("n")
k = D("k")
g = E("g")

h.p = g
h.z = n
h.y = n
h.x = k
h.t = k
e.w = n
e.s = g
e.u = g
e.q = k
e.y = k
n.u = e
n.o = g
n.y = g
n.t = g
k.t = n
g.w = h
g.o = h
g.s = n
g.x = e
assert g.x.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: C = None
        self.x: D = None
        self.t: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

h = A("h")
e = B("e")
n = C("n")
k = D("k")
g = E("g")

h.p = g
h.z = n
h.y = n
h.x = k
h.t = k
e.w = n
e.s = g
e.u = g
e.q = k
e.y = k
n.u = e
n.o = g
n.y = g
n.t = g
k.t = n
g.w = h
g.o = h
g.s = n
g.x = e
assert g.x.y.t.txt == "n"