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

class B:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: D = None
        self.p: G = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: I = None
        self.z: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: A = None
        self.p: B = None
        self.s: H = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.s: F = None
        self.x: I = None
        self.u: D = None
        self.w: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.x: D = None
        self.s: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: D = None
        self.p: G = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: I = None
        self.z: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: A = None
        self.p: B = None
        self.s: H = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.s: F = None
        self.x: I = None
        self.u: D = None
        self.w: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.x: D = None
        self.s: E = None
        self.txt = txt

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

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