Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            max_h = max(max_h, happy[i-1][k] + tmp[i][j])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""
    


Fixed submission:
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            #print(i, j, k)
            #print(tmp)
            max_h = max(max_h, happy[i-1][k] + tmp[j][i])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c

tmp = [a_list, b_list, c_list]
happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
    
        

    


Fixed submission:
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            #print(i, j, k)
            #print(tmp)
            max_h = max(max_h, happy[i-1][k] + tmp[j][i])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c

tmp = [a_list, b_list, c_list]
happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
    
        

    


Fixed submission:
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            #print(i, j, k)
            #print(tmp)
            max_h = max(max_h, happy[i-1][k] + tmp[j][i])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c

tmp = [a_list, b_list, c_list]
happy = [0 for _ in range(N)]
select = [None for _ in range(N)]
ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select = [1, 2, 0, 2, 0, 1][ind]

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            max_h = max(max_h, tmp[k][i] + tmp[j][i-1] + happy[i-2])
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
    
        

    


Fixed submission:
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            #print(i, j, k)
            #print(tmp)
            max_h = max(max_h, happy[i-1][k] + tmp[j][i])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""