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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: A = None
        self.w: A = None
        self.o: H = None
        self.p: G = None
        self.q: F = None
        self.s: G = None
        self.v: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: H = None
        self.s: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: C = None
        self.y: H = None
        self.t: G = None
        self.u: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: D = None
        self.v: I = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: A = None
        self.w: A = None
        self.o: H = None
        self.p: G = None
        self.q: F = None
        self.s: G = None
        self.v: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: H = None
        self.s: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: C = None
        self.y: H = None
        self.t: G = None
        self.u: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: D = None
        self.v: I = None
        self.txt = txt

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

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

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