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

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.t: B = None
        self.s: F = None
        self.x: F = None
        self.y: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: A = None
        self.u: I = None
        self.o: G = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: G = None
        self.v: H = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: H = None
        self.v: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.t: B = None
        self.s: F = None
        self.x: F = None
        self.y: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: A = None
        self.u: I = None
        self.o: G = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: G = None
        self.v: H = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: H = None
        self.v: C = None
        self.txt = txt

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

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