class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: D = None
        self.o: C = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.v: G = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.v: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: D = None
        self.o: C = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.v: G = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: C = None
        self.v: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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