class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: F = None
        self.x: E = None
        self.o: D = None
        self.u: C = None
        self.w: B = None
        self.v: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: A = None
        self.o: F = None
        self.w: F = None
        self.r: D = None
        self.txt = txt

a = A("a")
c = B("c")
n = C("n")
h = D("h")
j = E("j")
d = F("d")
m = G("m")
b = B("b")
i = C("i")

a.z = h
a.v = d
c.v = n
n.t = c
n.z = d
n.x = j
n.v = j
n.o = h
n.u = i
n.w = b
h.z = m
h.y = a
j.x = h
j.o = m
d.o = j
d.z = j
d.u = n
m.s = h
m.r = h
m.u = a
m.o = d
m.w = d
b.v = i
i.t = b
i.w = b
i.z = d
i.x = j
i.v = j
i.o = h
i.u = n
assert m.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: F = None
        self.x: E = None
        self.o: D = None
        self.u: C = None
        self.w: B = None
        self.v: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: A = None
        self.o: F = None
        self.w: F = None
        self.r: D = None
        self.txt = txt

a = A("a")
c = B("c")
n = C("n")
h = D("h")
j = E("j")
d = F("d")
m = G("m")
b = B("b")
i = C("i")

a.z = h
a.v = d
c.v = n
n.t = c
n.z = d
n.x = j
n.v = j
n.o = h
n.u = i
n.w = b
h.z = m
h.y = a
j.x = h
j.o = m
d.o = j
d.z = j
d.u = n
m.s = h
m.r = h
m.u = a
m.o = d
m.w = d
b.v = i
i.t = b
i.w = b
i.z = d
i.x = j
i.v = j
i.o = h
i.u = n
assert m.u.z.z.txt == "m"