works for given test case of simple AND