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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: D = None
        self.t: I = None
        self.o: J = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: A = None
        self.o: B = None
        self.u: J = None
        self.v: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: C = None
        self.v: F = None
        self.w: E = None
        self.o: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: D = None
        self.t: I = None
        self.o: J = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: A = None
        self.o: B = None
        self.u: J = None
        self.v: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: C = None
        self.v: F = None
        self.w: E = None
        self.o: G = None
        self.txt = txt

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

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

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