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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: A = None
        self.y: E = None
        self.t: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: A = None
        self.y: E = None
        self.t: A = None
        self.txt = txt

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

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