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

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

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

k = A("k")
b = B("b")
f = C("f")
i = B("i")
m = B("m")
c = B("c")
d = C("d")
e = A("e")
l = A("l")

k.v = f
b.w = i
b.x = e
f.t = k
f.s = d
i.w = c
i.x = k
m.w = i
m.x = k
c.w = m
c.x = e
d.t = k
d.s = f
e.v = f
l.v = f
assert b.x.v.s.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
f = C("f")
i = B("i")
m = B("m")
c = B("c")
d = C("d")
e = A("e")
l = A("l")

k.v = f
b.w = i
b.x = e
f.t = k
f.s = d
i.w = c
i.x = k
m.w = i
m.x = k
c.w = m
c.x = e
d.t = k
d.s = f
e.v = f
l.v = f
assert b.x.v.s.t.v.txt == "f"