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

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.r: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: H = None
        self.y: B = None
        self.w: H = None
        self.r: G = None
        self.s: H = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.y: G = None
        self.p: D = None
        self.s: H = None
        self.z: E = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.z: H = None
        self.v: E = None
        self.q: C = None
        self.x: H = None
        self.p: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: G = None
        self.t: A = None
        self.o: E = None
        self.p: G = None
        self.v: A = None
        self.x: F = None
        self.s: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.r: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: H = None
        self.y: B = None
        self.w: H = None
        self.r: G = None
        self.s: H = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.y: G = None
        self.p: D = None
        self.s: H = None
        self.z: E = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.z: H = None
        self.v: E = None
        self.q: C = None
        self.x: H = None
        self.p: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: G = None
        self.t: A = None
        self.o: E = None
        self.p: G = None
        self.v: A = None
        self.x: F = None
        self.s: C = None
        self.txt = txt

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

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