Deciding the Logic of Subsequences