test for deeply nested relation

close #2543