Solving less-than inequalities with positive integers Write a program or function that takes in a nonempty list of mathematical inequalities that use the less than operator (&lt;). Each line in the list will have the form
[variable] &lt; [variable]

where a [variable] may be any nonempty string of lowercase a-z characters. As in normal math and programming, variables with the same name are identical.
If a positive integer can be assigned to each variable such that all the inequalities are satisfied, then print or return a list of the variables with such an assignment. Each line in this list should have the form
[variable] = [positive integer]

and all variables must occur exactly once in any order.
Note that there may be many possible positive integer solutions to the set of inequalities. Any one of them is valid output.
If there are no solutions to the inequalities, then either don't output anything or output a falsy value (it's up to you).
The shortest code in bytes wins.
Examples
If the input were
mouse &lt; cat
mouse &lt; dog

then all of these would be valid outputs:
mouse = 1
cat = 2
dog = 2
mouse = 37
cat = 194
dog = 204
mouse = 2
cat = 2000000004
dog = 3
If the input were
rickon &lt; bran
bran &lt; arya
arya &lt; sansa
sansa &lt; robb
robb &lt; rickon

then no assignment is possible because it boils down to rickon &lt; rickon, so there either is no output or a falsy output.
More examples with solutions:
x &lt; y

x = 90
y = 91

---

p &lt; q
p &lt; q

p = 1
q = 2

---

q &lt; p
q &lt; p

p = 2
q = 1

---

abcdefghijklmnopqrstuvwxyz &lt; abcdefghijklmnopqrstuvwxyzz

abcdefghijklmnopqrstuvwxyz = 123456789
abcdefghijklmnopqrstuvwxyzz = 1234567890

---

pot &lt; spot
pot &lt; spot
pot &lt; spots

pot = 5
spot = 7
spots = 6

---

d &lt; a
d &lt; b
d &lt; c
d &lt; e

d = 1
a = 4
b = 4
c = 5
e = 4

---

aa &lt; aaaaa
a &lt; aa
aaa &lt; aaaa
aa &lt; aaaa
a &lt; aaa
aaaa &lt; aaaaa
aaa &lt; aaaaa
a &lt; aaaaa

aaaa = 4
aa = 2
aaaaa = 5
a = 1
aaa = 3

---

frog &lt; toad
frog &lt; toaster
toad &lt; llama
llama &lt; hippo
raccoon &lt; science
science &lt; toast
toaster &lt; toad
tuna &lt; salmon
hippo &lt; science
toasted &lt; toast

raccoon = 1
frog = 2
toaster = 3
toasted = 4
toad = 5
llama = 6
hippo = 7
science = 8
toast = 9
tuna = 10
salmon = 11

More examples with no solutions: (separated by empty lines)
z &lt; z

ps &lt; ps
ps &lt; ps

q &lt; p
p &lt; q

p &lt; q
q &lt; p

a &lt; b
b &lt; c
c &lt; a

d &lt; a
d &lt; b
d &lt; c
d &lt; d

abcdefghijklmnopqrstuvwxyz &lt; abcdefghijklmnopqrstuvwxyz

bolero &lt; minuet
minuet &lt; bolero

aa &lt; aaaaa
a &lt; aa
aaa &lt; aaaa
aa &lt; aaaa
aaaaa &lt; aaaa
a &lt; aaa
aaaa &lt; aaaaa
aaa &lt; aaaaa
a &lt; aaaaa

g &lt; c
a &lt; g
b &lt; a
c &lt; a

g &lt; b
a &lt; g
b &lt; a
c &lt; a

g &lt; b
a &lt; g
b &lt; a
c &lt; b

g &lt; c
a &lt; g
b &lt; a
c &lt; b

geobits &lt; geoborts
geobrits &lt; geoborts
geology &lt; geobits
geoborts &lt; geology
Pyth, 39 bytes

V&gt;1f.A&lt;MxMLTN.pS{s=Nm%2cd).zVNjd[H\==hZ


Try it online: Demonstration

Brute-forces through all possible permutations (and interpret them as sortings), check if they match the inequalities, and assign them the values 1, 2, ...., n. 

Explanation

f.A&lt;MxMLTN.pS{s=Nm%2cd).z  
                 m     .z  map each input line d to:
                    cd)       split d by spaces
                  %2          and remove the second element
               =N          save this list of pairs to N
              s            combine these pairs to a big list of variable names
             {             set (remove duplicates)
          .pS              generate all permutations
f                          filter for permutations T, which satisfy:
     xMLTN                    replace each variable in N by their index in T
 .A&lt;M                         check if each pair is ascending

V&gt;1...VNjd[H\==hZ          implicit: Z = 0
 &gt;1                        remove all but the last filtered permutation (if any)
V                          for each permutation N in ^ (runs zero times or once):
      VN                      for each variable H in N:
          [                      generate a list containing:
           H                        H
            \=                      "="
              =hZ                   Z incremented by 1 (and update Z)
        jd                       join this list by spaces and print