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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: E = None
        self.q: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: E = None
        self.q: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

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