# -*- coding: utf-8 -*-
def ishangul(c):
return 44032 <= ord(c) <= 55203
def hangulfirst(x, y):
if not x or not y:
return cmp(x, y)
xh = ishangul(x[0])
yh = ishangul(y[0])
if xh and not yh:
return -1
elif not xh and yh:
return +1
else:
return cmp(x, y)
lst = [u'a', u'b', u'한글', u'가나다']
lst.sort(cmp=hangulfirst)
print u', '.join(lst).encode('utf8')