How to identify the boundary label for an import mesh

Thanks so much for you kind help.
It does work!
I tried your method for 2D and 3D problem, it works fine!

Thanks agian.

Sincerely yours,
Hao