class A:
    def __init__(self, txt: str):
        self.y: J = None
        self.z: J = None
        self.p: I = None
        self.v: I = None
        self.t: E = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: I = None
        self.s: B = None
        self.w: J = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: J = None
        self.z: H = None
        self.q: F = None
        self.p: A = None
        self.r: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: B = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: G = None
        self.r: G = None
        self.t: J = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: I = None
        self.s: B = None
        self.w: J = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: J = None
        self.z: H = None
        self.q: F = None
        self.p: A = None
        self.r: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: B = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: G = None
        self.r: G = None
        self.t: J = None
        self.txt = txt

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

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

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