class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: H = None
        self.q: A = None
        self.o: F = None
        self.v: B = None
        self.w: A = None
        self.x: H = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: B = None
        self.t: G = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.o: B = None
        self.q: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.s: C = None
        self.v: F = None
        self.r: H = None
        self.z: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: H = None
        self.q: A = None
        self.o: F = None
        self.v: B = None
        self.w: A = None
        self.x: H = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: B = None
        self.t: G = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.o: B = None
        self.q: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.s: C = None
        self.v: F = None
        self.r: H = None
        self.z: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

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

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