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

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

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

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: A = None
        self.w: A = None
        self.q: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: A = None
        self.w: A = None
        self.q: D = None
        self.txt = txt

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

f.v = h
f.x = j
f.t = c
g.z = j
g.r = m
g.u = k
g.s = k
d.z = k
m.x = h
m.q = h
m.u = f
m.w = a
n.z = k
k.z = n
k.r = h
k.u = g
k.s = g
j.z = g
a.v = m
a.x = n
a.t = c
c.v = m
c.x = j
c.t = a
h.x = m
h.q = m
h.u = f
h.w = c
assert j.z.z.z.z.z.r.u.t.txt == "c"