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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: D = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: C = None
        self.w: G = None
        self.txt = txt

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

d = A("d")
n = B("n")
c = C("c")
m = D("m")
g = E("g")
h = F("h")
b = G("b")
f = G("f")
e = C("e")
i = C("i")

d.z = h
n.p = f
n.y = h
n.t = c
c.v = g
c.s = m
c.w = d
c.t = d
m.s = f
m.z = d
m.q = n
m.r = c
g.z = d
g.t = n
g.p = m
g.v = b
g.s = h
h.x = d
h.t = c
h.w = f
b.t = d
b.z = d
b.q = d
b.x = i
b.w = m
f.t = d
f.z = d
f.q = d
f.x = c
f.w = m
e.v = g
e.s = m
e.w = d
e.t = d
i.v = g
i.s = m
i.w = d
i.t = d
assert m.z.z.x.z.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: D = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: C = None
        self.w: G = None
        self.txt = txt

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

d = A("d")
n = B("n")
c = C("c")
m = D("m")
g = E("g")
h = F("h")
b = G("b")
f = G("f")
e = C("e")
i = C("i")

d.z = h
n.p = f
n.y = h
n.t = c
c.v = g
c.s = m
c.w = d
c.t = d
m.s = f
m.z = d
m.q = n
m.r = c
g.z = d
g.t = n
g.p = m
g.v = b
g.s = h
h.x = d
h.t = c
h.w = f
b.t = d
b.z = d
b.q = d
b.x = i
b.w = m
f.t = d
f.z = d
f.q = d
f.x = c
f.w = m
e.v = g
e.s = m
e.w = d
e.t = d
i.v = g
i.s = m
i.w = d
i.t = d
assert m.z.z.x.z.x.z.txt == "h"