(
(let $1 (DataType 'String))
(let $2 '('"key" $1))
(let $3 '('('"_logical_id" '1657) '('"_id" '"9d18abdb-ef868471-bb6fd378-b03704b1") '('"_wide_channels" (StructType $2 '('"subkey" $1)))))
(let $4 (DqPhyStage '() (lambda '() (block '(
  (let $14 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $15 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $14)))
  (let $16 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $17 (YtStat '('Id '"Input") '('RecordsCount '"9") '('DataSize '"369") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $18 (YtTable '"Input" $15 $16 $17 '() (Void) (Void) '"/Root/plato"))
  (let $19 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $18 '('"key" '"subkey") (Void) (Void))) '()))))
  (return (FromFlow (DqReadWideWrap $19 '())))
))) $3))
(let $5 (DqCnHashShuffle (TDqOutput $4 '0) '('0) '0 '"HashV2"))
(let $6 (DataType 'Double))
(let $7 (StructType $2 '('"sq" $6)))
(let $8 '('('"_logical_id" '2127) '('"_id" '"3f2fa8f7-113e5651-40fcf8c-3b2d57be") '('"_wide_channels" $7)))
(let $9 (DqPhyStage '($5) (lambda '($20) (block '(
  (let $21 (NarrowSqueezeToDict (ToFlow $20) (lambda '($26 $27) $26) (lambda '($28 $29) (AsStruct '('"key" $28) '('"subkey" $29))) '('Auto 'Many)))
  (let $22 (Bool 'true))
  (let $23 (Chopper (OrderedFlatMap $21 (lambda '($30) (OrderedFlatMap (DictPayloads $30) (lambda '($31) (Sort $31 $22 (lambda '($32) (Member $32 '"subkey"))))))) (lambda '($33) (Member $33 '"key")) (lambda '($34 $35) (AggrNotEquals $34 (Member $35 '"key"))) (lambda '($36 $37) (block '(
    (let $38 (Chain1Map $37 (lambda '($39) (block '(
      (let $40 '('_yql_RowNumber0 (Uint64 '1)))
      (let $41 (AsStruct $40 '('"key" (Member $39 '"key")) '('"subkey" (Member $39 '"subkey"))))
      (return '($41 (AsStruct $40)))
    ))) (lambda '($42 $43) (block '(
      (let $44 '('_yql_RowNumber0 (Inc (Member (Nth $43 '1) '_yql_RowNumber0))))
      (let $45 (AsStruct $44 '('"key" (Member $42 '"key")) '('"subkey" (Member $42 '"subkey"))))
      (return '($45 (AsStruct $44)))
    )))))
    (return (OrderedMap $38 (lambda '($46) (block '(
      (let $47 (Nth $46 '0))
      (return (AsStruct '('_yql_RowNumber0 (Member $47 '_yql_RowNumber0)) '('"key" (Member $47 '"key"))))
    )))))
  )))))
  (let $24 (Sort (Map $23 (lambda '($48) (block '(
    (let $49 '($6 '"" '1))
    (let $50 (CallableType '() '($6) $49))
    (let $51 (Udf '"Math.Sqrt" (Void) (VoidType) '"" $50 (VoidType) '"" '('('"strict"))))
    (return (AsStruct '('"key" (Member $48 '"key")) '('"sq" (Apply $51 (SafeCast (Member $48 '_yql_RowNumber0) $6)))))
  )))) '($22 $22) (lambda '($52) '((Member $52 '"key") (Member $52 '"sq")))))
  (let $25 (lambda '($53) (Member $53 '"key") (Member $53 '"sq")))
  (return (FromFlow (ExpandMap $24 $25)))
))) $8))
(let $10 (DqCnMerge (TDqOutput $9 '0) '('('0 '"Asc") '('1 '"Asc"))))
(let $11 (DqPhyStage '($10) (lambda '($54) (FromFlow (NarrowMap (ToFlow $54) (lambda '($55 $56) (AsStruct '('"key" $55) '('"sq" $56)))))) '('('"_logical_id" '2139) '('"_id" '"40f3def9-ac3b2522-ff89ee9d-c809fd00"))))
(let $12 '($4 $9 $11))
(let $13 (DqCnResult (TDqOutput $11 '0) '('"key" '"sq")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $12 '($13) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $7) '0 '0)) '('('"type" '"query"))))
)
