class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: F = None
        self.x: A = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: F = None
        self.x: A = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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