class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.u: F = None
        self.w: E = None
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: I = None
        self.p: C = None
        self.x: E = None
        self.s: C = None
        self.t: I = None
        self.w: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.s: B = None
        self.x: D = None
        self.y: C = None
        self.v: G = None
        self.u: C = None
        self.z: G = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.u: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: F = None
        self.p: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.u: F = None
        self.w: E = None
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: I = None
        self.p: C = None
        self.x: E = None
        self.s: C = None
        self.t: I = None
        self.w: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.s: B = None
        self.x: D = None
        self.y: C = None
        self.v: G = None
        self.u: C = None
        self.z: G = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.u: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: F = None
        self.p: B = None
        self.txt = txt

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

h.u = i
l.q = i
l.p = h
l.u = b
l.w = c
l.t = c
i.w = c
i.q = c
i.z = m
i.y = g
i.u = f
f.q = k
f.t = k
f.p = i
f.s = i
f.w = i
f.x = c
f.v = h
c.q = m
c.v = m
c.z = m
c.s = l
c.x = f
c.y = i
c.u = i
c.w = b
b.w = k
m.u = b
m.w = h
m.p = i
m.y = f
g.v = i
g.s = i
g.u = k
k.x = b
k.p = l
a.q = i
a.p = h
a.u = b
a.w = c
a.t = c
assert g.s.w.z.u.w.x.w.p.q.txt == "i"