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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: F = None
        self.p: B = None
        self.z: H = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.p: C = None
        self.z: B = None
        self.u: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: H = None
        self.w: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: B = None
        self.r: A = None
        self.z: A = None
        self.txt = txt

m = A("m")
a = B("a")
n = C("n")
g = D("g")
e = E("e")
h = F("h")
i = G("i")
k = H("k")
b = C("b")
d = B("d")

m.y = g
m.r = g
m.w = g
m.u = i
m.q = i
m.x = b
m.z = b
a.r = e
n.x = b
n.u = h
n.p = d
n.z = k
n.w = m
n.v = g
g.r = k
g.p = b
g.z = a
g.u = i
e.r = h
e.s = d
e.y = k
e.u = g
e.v = m
e.x = m
h.q = a
i.r = k
i.z = k
i.w = k
k.y = g
k.x = d
k.r = m
k.z = m
b.x = n
b.u = h
b.p = a
b.z = k
b.w = m
b.v = g
d.r = e
assert d.r.x.q.r.r.x.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.u: G = None
        self.w: D = None
        self.q: G = None
        self.x: C = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: F = None
        self.p: B = None
        self.z: H = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.p: C = None
        self.z: B = None
        self.u: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: H = None
        self.w: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: B = None
        self.r: A = None
        self.z: A = None
        self.txt = txt

m = A("m")
a = B("a")
n = C("n")
g = D("g")
e = E("e")
h = F("h")
i = G("i")
k = H("k")
b = C("b")
d = B("d")

m.y = g
m.r = g
m.w = g
m.u = i
m.q = i
m.x = b
m.z = b
a.r = e
n.x = b
n.u = h
n.p = d
n.z = k
n.w = m
n.v = g
g.r = k
g.p = b
g.z = a
g.u = i
e.r = h
e.s = d
e.y = k
e.u = g
e.v = m
e.x = m
h.q = a
i.r = k
i.z = k
i.w = k
k.y = g
k.x = d
k.r = m
k.z = m
b.x = n
b.u = h
b.p = a
b.z = k
b.w = m
b.v = g
d.r = e
assert d.r.x.q.r.r.x.z.r.txt == "m"