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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.x: I = None
        self.p: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: I = None
        self.o: F = None
        self.y: A = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.q: H = None
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: D = None
        self.y: C = None
        self.t: B = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

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

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

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

a.v = h
a.s = e
d.v = m
d.o = e
d.x = b
d.p = f
m.v = b
m.o = i
m.y = a
m.q = f
h.v = n
h.q = f
h.x = f
e.p = f
e.x = h
e.y = h
i.w = a
i.x = h
i.y = m
i.t = d
i.s = g
i.o = e
g.z = b
g.o = a
g.y = i
f.x = d
f.s = h
b.y = a
n.z = b
n.o = a
n.y = i
assert d.o.p.x.o.x.q.x.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.x: I = None
        self.p: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: I = None
        self.o: F = None
        self.y: A = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.q: H = None
        self.x: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: D = None
        self.y: C = None
        self.t: B = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

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

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

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

a.v = h
a.s = e
d.v = m
d.o = e
d.x = b
d.p = f
m.v = b
m.o = i
m.y = a
m.q = f
h.v = n
h.q = f
h.x = f
e.p = f
e.x = h
e.y = h
i.w = a
i.x = h
i.y = m
i.t = d
i.s = g
i.o = e
g.z = b
g.o = a
g.y = i
f.x = d
f.s = h
b.y = a
n.z = b
n.o = a
n.y = i
assert d.o.p.x.o.x.q.x.o.y.txt == "h"