class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: D = None
        self.s: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.q: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.q: C = None
        self.w: E = None
        self.txt = txt

h = A("h")
d = B("d")
n = C("n")
b = D("b")
m = E("m")
f = F("f")
g = G("g")
j = C("j")
a = G("a")

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.q: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.q: C = None
        self.w: E = None
        self.txt = txt

h = A("h")
d = B("d")
n = C("n")
b = D("b")
m = E("m")
f = F("f")
g = G("g")
j = C("j")
a = G("a")

h.u = g
h.v = b
h.s = a
d.t = b
d.w = n
d.q = f
n.u = h
b.u = n
b.x = h
b.z = a
b.q = m
m.u = j
f.p = b
f.w = g
g.y = h
g.z = m
g.w = m
g.q = n
j.u = h
a.y = h
a.z = m
a.w = m
a.q = n
assert m.u.u.s.y.u.q.u.v.u.txt == "n"