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

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

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

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

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

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

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

h = A("h")
m = B("m")
a = C("a")
g = D("g")
n = E("n")
f = F("f")
i = G("i")

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

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

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

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

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

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

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

h = A("h")
m = B("m")
a = C("a")
g = D("g")
n = E("n")
f = F("f")
i = G("i")

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