Python3 creating Tuple works backwards in one case
<p>I am creating a graph of minimum heap queues and when I read input like this:</p>

<pre><code>3
1 2 7
6 5 4
3 8 9
</code></pre>

<p>Into this python program:</p>

<pre><code>n = int(input())

G = {}

for u in range(n):
    line = input().split()
    minimum_q = []
    for v in range(len(line)):
        if u != v:
            w = int(line[v])
            #obj = {w, (u, v)}
            #heappush(minimum_q, obj)
            heappush(minimum_q, (w, (u, v)))

    G[u] = minimum_q
</code></pre>

<p>I get some weird behavior. When the obj variable is created to be pushed into the queue, the object looks like this: obj: {(0, 1), 2}
This is anticipated, but when I get to the element "8" in which u = 2, v = 1, w = 8. But the obj looks like this: {8, (2, 1)} </p>

<p>Does anyone have any ideas?</p>

<p>edit: Changed the code to what worked.</p>