class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: C = None
        self.p: G = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: E = None
        self.s: B = None
        self.r: H = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: C = None
        self.p: G = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: E = None
        self.s: B = None
        self.r: H = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

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

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