Ansible error while evaluting condition with two group vars

abd,cde are two groups in inventory files. Getting error while running the playbook:

 hosts: abc,cde
  tasks:
- name: Check 
  shell: ls -ltrh /tmp/test1/ | wc -l
  register : something_result
  when: "'abc' in group_names"

- name: True
  shell: ls -ltrh /tmp/test1/ | wc -l
  register: something2_result
  when: "'cde' in group_names"
  failed_when: something2_result != something_result

Error: “The conditional check ‘something2_result.stdout == something_result.stdout’ failed. The error was: error while evaluating conditional (something2_result.stdout == something_result.stdout): ‘dict object’ has no attribute ‘stdout’”

The reason is, it is only picking getting variable value from abc group, not working for cde