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

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

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

a = A("a")
k = B("k")
g = C("g")
i = C("i")

a.w = i
a.o = k
a.v = k
k.r = i
g.v = i
g.y = i
i.v = g
i.y = g
assert k.r.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
g = C("g")
i = C("i")

a.w = i
a.o = k
a.v = k
k.r = i
g.v = i
g.y = i
i.v = g
i.y = g
assert k.r.y.v.y.txt == "g"