class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: I = None
        self.x: B = None
        self.q: A = None
        self.u: E = None
        self.z: E = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.o: F = None
        self.z: C = None
        self.s: I = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: I = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: I = None
        self.x: B = None
        self.q: A = None
        self.u: E = None
        self.z: E = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.o: F = None
        self.z: C = None
        self.s: I = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: I = None
        self.txt = txt

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

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

a.y = e
a.p = n
m.v = c
m.y = f
m.p = d
m.u = i
d.s = b
d.x = m
d.o = m
d.q = a
d.u = e
d.z = e
i.u = a
i.y = a
i.o = c
i.z = d
i.s = b
e.w = i
c.o = f
c.z = m
c.r = m
c.s = m
n.p = f
n.y = f
n.w = m
f.q = b
b.y = n
b.z = e
assert e.w.z.s.z.w.o.o.txt == "f"