class A:
    def __init__(self, txt: str):
        self.q: I = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: G = None
        self.y: I = None
        self.x: A = None
        self.t: C = None
        self.s: E = None
        self.o: F = None
        self.z: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.o: G = None
        self.u: H = None
        self.x: G = None
        self.t: D = None
        self.y: G = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: G = None
        self.y: I = None
        self.x: A = None
        self.t: C = None
        self.s: E = None
        self.o: F = None
        self.z: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.o: G = None
        self.u: H = None
        self.x: G = None
        self.t: D = None
        self.y: G = None
        self.txt = txt

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

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