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

class B:
    def __init__(self, txt: str):
        self.y: H = None
        self.q: A = None
        self.z: H = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: A = None
        self.r: F = None
        self.x: H = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.z: B = None
        self.r: E = None
        self.v: C = None
        self.x: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.v: D = None
        self.r: C = None
        self.u: D = None
        self.q: E = None
        self.w: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: H = None
        self.q: A = None
        self.z: H = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: A = None
        self.r: F = None
        self.x: H = None
        self.z: B = None
        self.p: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.z: B = None
        self.r: E = None
        self.v: C = None
        self.x: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.v: D = None
        self.r: C = None
        self.u: D = None
        self.q: E = None
        self.w: B = None
        self.txt = txt

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

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