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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: E = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: G = None
        self.p: C = None
        self.v: G = None
        self.w: G = None
        self.z: F = None
        self.q: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: E = None
        self.q: D = None
        self.t: F = None
        self.u: A = None
        self.r: B = None
        self.s: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: E = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: G = None
        self.p: C = None
        self.v: G = None
        self.w: G = None
        self.z: F = None
        self.q: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: E = None
        self.q: D = None
        self.t: F = None
        self.u: A = None
        self.r: B = None
        self.s: D = None
        self.txt = txt

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

n.q = h
n.v = k
d.u = k
k.z = f
k.v = j
k.r = h
m.r = k
m.q = j
j.t = m
j.r = i
j.v = i
j.w = i
j.p = k
j.z = h
j.q = h
h.q = m
i.w = m
i.q = m
i.s = m
i.z = j
i.t = h
i.u = f
i.r = d
f.q = h
f.v = k
assert n.q.q.r.v.t.r.r.txt == "h"