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

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

class C:
    def __init__(self, txt: str):
        self.r: I = None
        self.z: B = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: H = None
        self.p: J = None
        self.q: H = None
        self.txt = txt

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: C = None
        self.y: F = None
        self.p: B = None
        self.txt = txt

b = A("b")
h = B("h")
n = C("n")
l = D("l")
e = E("e")
m = F("m")
c = G("c")
j = H("j")
g = I("g")
i = J("i")

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

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

class C:
    def __init__(self, txt: str):
        self.r: I = None
        self.z: B = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: H = None
        self.p: J = None
        self.q: H = None
        self.txt = txt

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: C = None
        self.y: F = None
        self.p: B = None
        self.txt = txt

b = A("b")
h = B("h")
n = C("n")
l = D("l")
e = E("e")
m = F("m")
c = G("c")
j = H("j")
g = I("g")
i = J("i")

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