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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

k.p = m
k.v = b
n.q = d
j.y = k
b.p = d
m.q = j
g.y = m
g.v = b
g.s = d
g.z = j
g.x = k
d.s = i
a.y = m
a.v = b
a.s = d
a.z = j
a.x = k
i.q = d
l.y = m
l.v = b
l.s = d
l.z = j
l.x = k
assert m.q.y.v.p.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

k.p = m
k.v = b
n.q = d
j.y = k
b.p = d
m.q = j
g.y = m
g.v = b
g.s = d
g.z = j
g.x = k
d.s = i
a.y = m
a.v = b
a.s = d
a.z = j
a.x = k
i.q = d
l.y = m
l.v = b
l.s = d
l.z = j
l.x = k
assert m.q.y.v.p.s.q.txt == "d"