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

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

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

f = A("f")
n = B("n")
g = C("g")
l = B("l")
m = C("m")

f.x = g
n.v = f
g.w = m
g.t = f
l.v = f
m.w = g
m.t = f
assert m.t.x.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
g = C("g")
l = B("l")
m = C("m")

f.x = g
n.v = f
g.w = m
g.t = f
l.v = f
m.w = g
m.t = f
assert m.t.x.w.t.txt == "f"