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

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

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

f = A("f")
e = B("e")
m = C("m")
b = A("b")
n = B("n")
k = C("k")

f.t = b
e.v = n
m.z = n
b.t = f
n.v = e
k.z = e
assert e.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
m = C("m")
b = A("b")
n = B("n")
k = C("k")

f.t = b
e.v = n
m.z = n
b.t = f
n.v = e
k.z = e
assert e.v.v.v.v.v.v.txt == "e"