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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: I = None
        self.w: C = None
        self.q: E = None
        self.u: I = None
        self.y: F = None
        self.p: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: B = None
        self.o: D = None
        self.y: D = None
        self.p: C = None
        self.txt = txt

m = A("m")
e = B("e")
d = C("d")
f = D("f")
g = E("g")
i = F("i")
k = G("k")
l = H("l")
h = I("h")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: I = None
        self.w: C = None
        self.q: E = None
        self.u: I = None
        self.y: F = None
        self.p: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: B = None
        self.o: D = None
        self.y: D = None
        self.p: C = None
        self.txt = txt

m = A("m")
e = B("e")
d = C("d")
f = D("f")
g = E("g")
i = F("i")
k = G("k")
l = H("l")
h = I("h")

m.w = k
m.y = f
e.p = f
e.r = h
e.z = m
e.v = g
d.t = e
f.y = m
f.u = e
f.q = e
f.z = l
f.w = l
f.p = i
g.v = i
i.o = l
k.v = f
k.x = l
l.r = h
l.u = h
l.w = d
l.q = g
l.p = g
l.y = i
h.r = f
h.o = f
h.y = f
h.s = e
h.p = d
assert g.v.o.q.txt == "g"