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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: F = None
        self.r: F = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.y: C = None
        self.z: D = None
        self.w: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.s: D = None
        self.v: F = None
        self.txt = txt

g = A("g")
e = B("e")
j = C("j")
d = D("d")
n = E("n")
l = F("l")
i = G("i")
f = B("f")
k = A("k")
m = A("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: F = None
        self.r: F = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.y: C = None
        self.z: D = None
        self.w: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.s: D = None
        self.v: F = None
        self.txt = txt

g = A("g")
e = B("e")
j = C("j")
d = D("d")
n = E("n")
l = F("l")
i = G("i")
f = B("f")
k = A("k")
m = A("m")

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