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

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

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

c = A("c")
h = B("h")
n = C("n")
a = A("a")
f = C("f")
b = C("b")
e = B("e")
g = C("g")
i = C("i")

c.w = h
c.v = a
c.o = e
h.z = b
h.u = f
n.y = h
n.p = a
a.w = e
a.o = e
a.v = c
f.y = e
f.p = c
b.y = e
b.p = c
e.z = f
e.u = b
g.y = e
g.p = c
i.y = h
i.p = a
assert n.p.v.w.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: A = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
n = C("n")
a = A("a")
f = C("f")
b = C("b")
e = B("e")
g = C("g")
i = C("i")

c.w = h
c.v = a
c.o = e
h.z = b
h.u = f
n.y = h
n.p = a
a.w = e
a.o = e
a.v = c
f.y = e
f.p = c
b.y = e
b.p = c
e.z = f
e.u = b
g.y = e
g.p = c
i.y = h
i.p = a
assert n.p.v.w.z.y.txt == "e"