x = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5}
accending_x_keys = sorted(x, key=x.get)
descending_x_keys = sorted(x, key=x.get, reverse=True)
for k in accending_x_keys:
print(k, x.get(k), end=" ")
#output: a 1 b 2 c 3 d 4 e 5
for v in descending_x_keys:
print(v, x.get(v), end=" ")
#output: e 5 d 4 c 3 b 2 a 1