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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: F = None
        self.p: E = None
        self.z: A = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: G = None
        self.o: C = None
        self.t: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: F = None
        self.p: E = None
        self.z: A = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: G = None
        self.o: C = None
        self.t: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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