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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: C = None
        self.y: C = None
        self.x: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
g = D("g")
n = C("n")
h = A("h")
a = B("a")
e = A("e")
m = B("m")
j = D("j")

c.z = h
k.s = j
k.q = e
k.r = e
i.w = m
i.r = n
i.y = n
i.x = j
g.r = i
g.u = n
g.x = m
g.v = e
n.w = a
n.r = i
n.y = i
n.x = g
h.z = e
a.s = g
a.q = e
a.r = h
e.z = c
m.s = g
m.q = h
m.r = e
j.r = i
j.u = n
j.x = m
j.v = h
assert e.z.z.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: C = None
        self.y: C = None
        self.x: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
g = D("g")
n = C("n")
h = A("h")
a = B("a")
e = A("e")
m = B("m")
j = D("j")

c.z = h
k.s = j
k.q = e
k.r = e
i.w = m
i.r = n
i.y = n
i.x = j
g.r = i
g.u = n
g.x = m
g.v = e
n.w = a
n.r = i
n.y = i
n.x = g
h.z = e
a.s = g
a.q = e
a.r = h
e.z = c
m.s = g
m.q = h
m.r = e
j.r = i
j.u = n
j.x = m
j.v = h
assert e.z.z.z.z.z.z.z.z.z.txt == "e"