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

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

c = A("c")
f = B("f")
l = A("l")
a = B("a")
m = B("m")
i = B("i")
k = B("k")
e = A("e")

c.v = e
c.q = e
f.q = k
l.v = c
l.q = e
a.q = m
m.q = f
i.q = m
k.q = a
e.v = c
e.q = c
assert i.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: A = None
        self.txt = txt

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

c = A("c")
f = B("f")
l = A("l")
a = B("a")
m = B("m")
i = B("i")
k = B("k")
e = A("e")

c.v = e
c.q = e
f.q = k
l.v = c
l.q = e
a.q = m
m.q = f
i.q = m
k.q = a
e.v = c
e.q = c
assert i.q.q.q.txt == "k"