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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.q: C = None
        self.txt = txt

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

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

c.y = n
c.u = k
c.t = d
g.r = i
g.s = i
e.q = g
e.x = c
e.r = k
n.y = i
n.v = i
n.q = e
d.p = g
d.x = g
d.u = n
d.z = i
i.p = g
i.x = g
i.u = n
i.z = d
k.q = g
k.x = c
k.r = e
assert k.q.s.z.z.u.txt == "n"