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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: G = None
        self.q: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.u: E = None
        self.v: D = None
        self.q: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.t: H = None
        self.v: H = None
        self.y: A = None
        self.z: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: G = None
        self.q: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.u: E = None
        self.v: D = None
        self.q: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.t: H = None
        self.v: H = None
        self.y: A = None
        self.z: D = None
        self.txt = txt

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

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