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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: F = None
        self.u: I = None
        self.q: E = None
        self.o: E = None
        self.r: J = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: J = None
        self.t: B = None
        self.p: H = None
        self.u: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: J = None
        self.y: E = None
        self.z: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: D = None
        self.y: C = None
        self.s: B = None
        self.v: H = None
        self.u: J = None
        self.p: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: F = None
        self.u: I = None
        self.q: E = None
        self.o: E = None
        self.r: J = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: J = None
        self.t: B = None
        self.p: H = None
        self.u: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: J = None
        self.y: E = None
        self.z: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: D = None
        self.y: C = None
        self.s: B = None
        self.v: H = None
        self.u: J = None
        self.p: A = None
        self.txt = txt

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

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

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