class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: F = None
        self.x: E = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.x: B = None
        self.s: A = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.s: B = None
        self.r: D = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.x: B = None
        self.s: A = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.s: B = None
        self.r: D = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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