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

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

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

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

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

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

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

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

a.v = g
g.w = d
g.t = d
g.o = k
b.t = a
b.s = k
b.w = d
f.t = k
f.s = k
f.w = d
d.w = g
d.t = g
d.o = a
k.v = g
assert g.t.o.v.txt == "g"