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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: A = None
        self.w: G = None
        self.u: G = None
        self.v: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: E = None
        self.t: G = None
        self.w: C = None
        self.q: D = None
        self.p: G = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
a = B("a")
k = C("k")
b = D("b")
f = E("f")
l = F("l")
e = G("e")
g = G("g")
h = E("h")
n = G("n")

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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: A = None
        self.w: G = None
        self.u: G = None
        self.v: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: E = None
        self.t: G = None
        self.w: C = None
        self.q: D = None
        self.p: G = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
a = B("a")
k = C("k")
b = D("b")
f = E("f")
l = F("l")
e = G("e")
g = G("g")
h = E("h")
n = G("n")

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