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

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

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

l = A("l")
n = B("n")
k = C("k")
b = A("b")
f = C("f")
i = B("i")

l.q = i
n.v = l
n.y = i
n.t = k
k.v = n
k.o = f
b.q = n
f.v = n
f.o = k
i.v = l
i.y = n
i.t = k
assert k.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

l = A("l")
n = B("n")
k = C("k")
b = A("b")
f = C("f")
i = B("i")

l.q = i
n.v = l
n.y = i
n.t = k
k.v = n
k.o = f
b.q = n
f.v = n
f.o = k
i.v = l
i.y = n
i.t = k
assert k.v.y.v.txt == "l"