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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.z: A = None
        self.p: G = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.w: G = None
        self.z: B = None
        self.x: C = None
        self.o: F = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.v: A = None
        self.x: A = None
        self.o: C = None
        self.t: E = None
        self.txt = txt

g = A("g")
n = B("n")
m = C("m")
a = D("a")
d = E("d")
e = F("e")
k = G("k")

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.z: A = None
        self.p: G = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.w: G = None
        self.z: B = None
        self.x: C = None
        self.o: F = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.v: A = None
        self.x: A = None
        self.o: C = None
        self.t: E = None
        self.txt = txt

g = A("g")
n = B("n")
m = C("m")
a = D("a")
d = E("d")
e = F("e")
k = G("k")

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