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

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

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

k = A("k")
f = B("f")
g = C("g")
n = A("n")
a = B("a")
e = C("e")
b = A("b")
d = C("d")

k.v = d
k.w = a
k.o = n
f.w = a
g.y = n
n.v = e
n.w = a
n.o = b
a.w = f
e.y = n
b.v = e
b.w = a
b.o = k
d.y = b
assert a.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: B = None
        self.o: A = None
        self.txt = txt

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

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

k = A("k")
f = B("f")
g = C("g")
n = A("n")
a = B("a")
e = C("e")
b = A("b")
d = C("d")

k.v = d
k.w = a
k.o = n
f.w = a
g.y = n
n.v = e
n.w = a
n.o = b
a.w = f
e.y = n
b.v = e
b.w = a
b.o = k
d.y = b
assert a.w.w.w.w.txt == "a"