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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: J = None
        self.y: F = None
        self.x: I = None
        self.z: I = None
        self.txt = txt

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.o: A = None
        self.z: D = None
        self.p: C = None
        self.v: G = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: J = None
        self.y: F = None
        self.x: I = None
        self.z: I = None
        self.txt = txt

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.o: A = None
        self.z: D = None
        self.p: C = None
        self.v: G = None
        self.t: A = None
        self.txt = txt

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

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