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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: H = None
        self.p: A = None
        self.o: D = None
        self.s: F = None
        self.w: F = None
        self.r: H = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.t: C = None
        self.s: G = None
        self.v: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: H = None
        self.p: A = None
        self.o: D = None
        self.s: F = None
        self.w: F = None
        self.r: H = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.t: C = None
        self.s: G = None
        self.v: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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