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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: C = None
        self.w: A = None
        self.y: I = None
        self.q: J = None
        self.p: J = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: F = None
        self.y: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: A = None
        self.q: E = None
        self.y: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: C = None
        self.u: D = None
        self.o: F = None
        self.v: B = None
        self.q: I = None
        self.x: B = None
        self.txt = txt

h = A("h")
n = B("n")
d = C("d")
k = D("k")
j = E("j")
m = F("m")
e = G("e")
g = H("g")
a = I("a")
b = J("b")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: C = None
        self.w: A = None
        self.y: I = None
        self.q: J = None
        self.p: J = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: F = None
        self.y: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: A = None
        self.q: E = None
        self.y: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: C = None
        self.u: D = None
        self.o: F = None
        self.v: B = None
        self.q: I = None
        self.x: B = None
        self.txt = txt

h = A("h")
n = B("n")
d = C("d")
k = D("k")
j = E("j")
m = F("m")
e = G("e")
g = H("g")
a = I("a")
b = J("b")

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