class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: G = None
        self.q: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.t: D = None
        self.p: D = None
        self.z: D = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.t: D = None
        self.p: D = None
        self.z: D = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

i.x = b
i.q = b
i.u = b
i.t = n
g.w = n
g.x = n
g.t = a
g.p = a
g.z = a
g.u = a
b.r = g
a.r = k
a.x = i
a.w = i
a.z = b
a.v = n
m.v = a
k.p = b
n.p = m
n.o = b
assert m.v.z.r.txt == "g"