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

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

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

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

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

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

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

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

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

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

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

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

n.q = k
n.u = g
n.z = g
n.t = c
h.q = g
h.s = g
d.s = g
k.v = d
k.r = c
k.s = c
k.x = n
k.q = n
g.z = d
c.v = i
c.r = k
c.s = k
c.x = l
c.q = n
i.s = g
l.q = c
l.u = g
l.z = g
l.t = k
assert l.z.z.s.z.s.z.s.txt == "g"