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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.p: G = None
        self.z: A = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: H = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.x: C = None
        self.o: G = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.x: B = None
        self.r: F = None
        self.w: G = None
        self.s: D = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.s: F = None
        self.t: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.p: G = None
        self.z: A = None
        self.r: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: H = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.x: C = None
        self.o: G = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.x: B = None
        self.r: F = None
        self.w: G = None
        self.s: D = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.s: F = None
        self.t: G = None
        self.txt = txt

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

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