class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: G = None
        self.v: C = None
        self.s: G = None
        self.o: G = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.w: G = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: A = None
        self.x: B = None
        self.y: A = None
        self.v: F = None
        self.u: D = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: H = None
        self.t: C = None
        self.z: A = None
        self.v: C = None
        self.x: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.w: G = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: A = None
        self.x: B = None
        self.y: A = None
        self.v: F = None
        self.u: D = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: H = None
        self.t: C = None
        self.z: A = None
        self.v: C = None
        self.x: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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