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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: B = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: E = None
        self.w: A = None
        self.z: H = None
        self.u: D = None
        self.x: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: G = None
        self.w: H = None
        self.o: B = None
        self.q: B = None
        self.x: A = None
        self.s: C = None
        self.txt = txt

m = A("m")
g = B("g")
b = C("b")
j = D("j")
f = E("f")
d = F("d")
i = G("i")
l = H("l")
k = I("k")
n = J("n")

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: B = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: E = None
        self.w: A = None
        self.z: H = None
        self.u: D = None
        self.x: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: G = None
        self.w: H = None
        self.o: B = None
        self.q: B = None
        self.x: A = None
        self.s: C = None
        self.txt = txt

m = A("m")
g = B("g")
b = C("b")
j = D("j")
f = E("f")
d = F("d")
i = G("i")
l = H("l")
k = I("k")
n = J("n")

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