(defun chek-punkt (punkt1 punkt2 flag / )
  (defun add-comment-and-elevation-chek-punkt (punct-mj punct-mn / result-punct)
    (defun add-comment-by-item_add-comment-and-elevation-chek-punkt (result-punct punct-mn text /)
      (if(cadr(assoc"comment" result-punct))
      (subst (list "comment" (strcat (cadr(assoc"comment" result-punct))
				     (strcat text "отметка пункта "(if(> (get-year-in-punct-chek-punkt punct-mn) 0)
								     (strcat (itoa (get-year-in-punct-chek-punkt punct-mn)) " года")
								     "под вопросом"))))
	     (assoc "comment" result-punct)
	     result-punct)
	(append result-punct(list (list "comment"(strcat text "отметка пункта "(if(> (get-year-in-punct-chek-punkt punct-mn) 0)
								     (strcat (itoa (get-year-in-punct-chek-punkt punct-mn)) " года")
								     "под вопросом"))))))
      )
    (defun add-if-not_add-comment-and-elevation-chek-punkt (punct-mj punct-mn result-punct item / )
      (if (and(not(cadr(assoc item punct-mj)))
	      (cadr(assoc item punct-mn)))
	(setq result-punct (append result-punct (list (assoc item punct-mn))))
	)
      result-punct
      )
    (setq result-punct punct-mj)
    (if (and(not(cadr(assoc"Z"punct-mj)))
	    (cadr(assoc"Z"punct-mn)))
      (progn
	(setq result-punct (append result-punct (list (assoc"Z"punct-mn))))
	(if (cadr(assoc"comment"result-punct))
	  (setq result-punct (add-comment-by-item_add-comment-and-elevation-chek-punkt result-punct punct-mn ", "))
	  (setq result-punct (add-comment-by-item_add-comment-and-elevation-chek-punkt result-punct punct-mn ""))
	  )
	)
      )
    (setq result-punct(add-if-not_add-comment-and-elevation-chek-punkt punct-mj punct-mn result-punct "address"))
    (setq result-punct(add-if-not_add-comment-and-elevation-chek-punkt punct-mj punct-mn result-punct "type"))
    (setq result-punct(add-comment-if-year=add-comment-by-item_add-comment-and-elevation-chek-punkt result-punct punct-mj punct-mn))
    result-punct
    )
  (defun get-year-in-punct-chek-punkt (punkt / temp)
    (if(not(setq temp (cadr(assoc"year"punkt))))
      0
      (atoi temp))
    )
  (defun add-comment-if-year=add-comment-by-item_add-comment-and-elevation-chek-punkt (new-punct punct-mj punct-mn / result-punct)
    (defun add-comment-alt (result-punct punct-mj punct-mn item / )
      (defun add-comment-alt-item (result-punct punct-mj punct-mn item text /)
	(if(cadr(assoc"comment" result-punct))
	  (subst (list "comment" (strcat (cadr(assoc"comment" result-punct))text "Алт. " item "="(cadr(assoc item punct-mn))))
		 (assoc "comment" result-punct)
		 result-punct)
	  (append result-punct (list (list "comment" (strcat text "Алт. " item "="(cadr(assoc item punct-mn))))))
	  )
	)
      (if(and (/=(cadr(assoc item result-punct))(cadr(assoc item punct-mn)))(cadr(assoc item punct-mn)))
	(if(cadr(assoc "comment" result-punct))
	  (setq result-punct(add-comment-alt-item result-punct punct-mj punct-mn item ", "))
	  (setq result-punct(add-comment-alt-item result-punct punct-mj punct-mn item ""))
	  )
	)
      result-punct
      )
    (setq result-punct new-punct)
    (if (=(get-year-in-punct-chek-punkt punct-mj)(get-year-in-punct-chek-punkt punct-mn))
      (progn
	(setq result-punct(add-comment-alt result-punct punct-mj punct-mn "name"))
	(setq result-punct(add-comment-alt result-punct punct-mj punct-mn "N"))
	(setq result-punct(add-comment-alt result-punct punct-mj punct-mn "E"))
	(setq result-punct(add-comment-alt result-punct punct-mj punct-mn "Z"))
	(setq result-punct(add-comment-alt result-punct punct-mj punct-mn "address"))
	result-punct
	)
      result-punct
      )
    )

  
  (if flag
    (if
      (equal (list (atof(cadr(assoc"N"punkt1)))(atof(cadr(assoc"E"punkt1))))
	     (list (atof(cadr(assoc"N"punkt2)))(atof(cadr(assoc"E"punkt2))))1.5)
      (cond
	((or(> (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2))
	    (= (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2)))
	 (add-comment-and-elevation-chek-punkt punkt1 punkt2)
	 )
	((< (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2))
	 (add-comment-and-elevation-chek-punkt punkt2 punkt1)
	 )
	)
      nil
      )
    (if
      (and (=(cadr(assoc"name"punkt1))(cadr(assoc"name"punkt2)))
	   (equal
	     (atof(cadr(assoc"Z"punkt1)))
	     (atof(cadr(assoc"Z"punkt2)))0.20))
      (cond
	((or(> (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2))
	    (= (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2)))
	 (add-comment-and-elevation-chek-punkt punkt1 punkt2)
	 )
	((< (get-year-in-punct-chek-punkt punkt1)(get-year-in-punct-chek-punkt punkt2))
	 (add-comment-and-elevation-chek-punkt punkt2 punkt1)
	 )
	)
      nil
      )
    )
  )