(define (same-structure? lst1 lst2)
  (cond ((and (null? lst1) (null? lst2)) #t)
        ((and (pair? (car lst1)) (pair? (car lst2))) (same-structure? (cdr lst1) (cdr lst2)))
        ((and (list? (car lst1)) (list? (car lst2))) (same-structure? (cdr lst1) (cdr lst2)))
        ((and (atom? (car lst1)) (atom? (car lst2))) (same-structure? (cdr lst1) (cdr lst2)))
        (else #f)))