Questions along these lines get asked fairly regularly on the Esri Community, probably every 4-6 months. Although it is possible to answer your question using Field Calculator, it is quite a clunky approach in my mind. This kind of question is best suited for ArcPy cursors:
lyr = # name of layer or path to data set
flds = ["ID", "AdjRiverLe", "River"]
sql = "ORDER BY ID, AdjRiverLe DESC"
with arcpy.da.UpdateCursor(lyr, flds, sql_clause=(None, sql)) as cur:
rid, adj_river, river = next(cur)
river = "YES"
cur.updateRow([rid, adj_river, river])
prev_rid = rid
for rid, adj_river, _ in cur:
if rid == prev_rid:
river = "NO"
else:
river = "YES"
cur.updateRow([rid, adj_river, river])
prev_rid = rid