class A:
    def __init__(self, txt: str):
        self.w: H = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: B = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

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

f.w = e
h.x = m
h.w = i
l.y = h
g.p = i
i.o = h
i.v = l
k.z = f
k.o = i
k.v = i
k.q = a
k.p = m
k.y = e
m.r = k
e.w = i
e.p = i
e.o = h
e.t = h
a.r = l
a.y = l
a.o = g
a.x = g
a.w = f
a.q = f
a.s = f
a.p = h
a.z = h
assert h.x.r.q.q.w.o.x.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: H = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: B = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

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

f.w = e
h.x = m
h.w = i
l.y = h
g.p = i
i.o = h
i.v = l
k.z = f
k.o = i
k.v = i
k.q = a
k.p = m
k.y = e
m.r = k
e.w = i
e.p = i
e.o = h
e.t = h
a.r = l
a.y = l
a.o = g
a.x = g
a.w = f
a.q = f
a.s = f
a.p = h
a.z = h
assert h.x.r.q.q.w.o.x.r.p.txt == "m"