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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: C = None
        self.y: G = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

c.w = a
c.r = e
c.z = g
d.v = b
d.w = g
d.y = h
d.z = h
d.u = h
h.q = k
h.s = i
b.r = k
b.u = k
b.w = g
b.s = a
e.s = c
e.t = h
e.y = k
e.r = d
g.p = d
k.u = m
k.s = b
a.v = h
a.r = h
m.x = d
i.w = a
i.r = e
i.z = g
assert e.y.s.w.p.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: H = None
        self.r: E = None
        self.z: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: C = None
        self.y: G = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

c.w = a
c.r = e
c.z = g
d.v = b
d.w = g
d.y = h
d.z = h
d.u = h
h.q = k
h.s = i
b.r = k
b.u = k
b.w = g
b.s = a
e.s = c
e.t = h
e.y = k
e.r = d
g.p = d
k.u = m
k.s = b
a.v = h
a.r = h
m.x = d
i.w = a
i.r = e
i.z = g
assert e.y.s.w.p.w.p.txt == "d"