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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: E = None
        self.o: A = None
        self.r: B = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.t: C = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: B = None
        self.txt = txt

h = A("h")
c = B("c")
a = C("a")
n = D("n")
k = E("k")
b = B("b")
g = E("g")
i = C("i")

h.q = g
h.z = g
h.o = b
c.s = a
c.z = g
c.o = h
c.u = h
c.r = b
a.x = h
n.u = c
n.q = c
n.t = i
n.v = g
n.r = g
k.x = g
k.z = b
b.s = i
b.z = g
b.o = h
b.u = h
b.r = c
g.x = k
g.z = b
i.x = h
assert a.x.o.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: E = None
        self.o: A = None
        self.r: B = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.t: C = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: B = None
        self.txt = txt

h = A("h")
c = B("c")
a = C("a")
n = D("n")
k = E("k")
b = B("b")
g = E("g")
i = C("i")

h.q = g
h.z = g
h.o = b
c.s = a
c.z = g
c.o = h
c.u = h
c.r = b
a.x = h
n.u = c
n.q = c
n.t = i
n.v = g
n.r = g
k.x = g
k.z = b
b.s = i
b.z = g
b.o = h
b.u = h
b.r = c
g.x = k
g.z = b
i.x = h
assert a.x.o.z.x.txt == "k"