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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: D = None
        self.s: F = None
        self.q: F = None
        self.x: G = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: F = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: C = None
        self.w: E = None
        self.txt = txt

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

k.v = j
k.x = d
k.p = c
k.q = n
n.w = l
n.z = l
n.s = h
n.q = j
n.x = i
n.y = g
n.o = k
d.p = i
d.q = h
d.u = c
l.v = d
l.r = n
m.w = i
j.u = k
j.v = g
j.o = g
i.t = d
i.r = d
i.w = m
g.w = i
c.v = h
c.x = d
c.p = k
c.q = n
h.u = k
h.v = m
h.o = m
assert c.x.q.v.w.r.u.v.o.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: C = None
        self.p: A = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: D = None
        self.s: F = None
        self.q: F = None
        self.x: G = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: F = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: C = None
        self.w: E = None
        self.txt = txt

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

k.v = j
k.x = d
k.p = c
k.q = n
n.w = l
n.z = l
n.s = h
n.q = j
n.x = i
n.y = g
n.o = k
d.p = i
d.q = h
d.u = c
l.v = d
l.r = n
m.w = i
j.u = k
j.v = g
j.o = g
i.t = d
i.r = d
i.w = m
g.w = i
c.v = h
c.x = d
c.p = k
c.q = n
h.u = k
h.v = m
h.o = m
assert c.x.q.v.w.r.u.v.o.w.w.txt == "m"