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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: G = None
        self.r: G = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: B = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

e.p = g
e.y = l
k.v = g
k.t = j
k.r = j
k.z = f
g.x = a
g.w = a
g.y = k
l.y = a
l.v = k
a.r = g
f.q = e
j.t = g
j.z = g
j.p = e
j.v = e
j.x = f
n.t = g
n.z = g
n.p = e
n.v = e
n.x = f
assert f.q.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: G = None
        self.r: G = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: B = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

e.p = g
e.y = l
k.v = g
k.t = j
k.r = j
k.z = f
g.x = a
g.w = a
g.y = k
l.y = a
l.v = k
a.r = g
f.q = e
j.t = g
j.z = g
j.p = e
j.v = e
j.x = f
n.t = g
n.z = g
n.p = e
n.v = e
n.x = f
assert f.q.y.v.txt == "k"