class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: H = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: G = None
        self.p: D = None
        self.o: I = None
        self.v: C = None
        self.w: H = None
        self.y: A = None
        self.s: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.o: H = None
        self.p: G = None
        self.s: I = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: D = None
        self.x: E = None
        self.v: A = None
        self.y: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: G = None
        self.p: D = None
        self.o: I = None
        self.v: C = None
        self.w: H = None
        self.y: A = None
        self.s: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.o: H = None
        self.p: G = None
        self.s: I = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: D = None
        self.x: E = None
        self.v: A = None
        self.y: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.w: F = None
        self.txt = txt

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

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