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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: G = None
        self.y: A = None
        self.t: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: B = None
        self.t: G = None
        self.q: B = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: G = None
        self.y: A = None
        self.t: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: B = None
        self.t: G = None
        self.q: B = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

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

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