execute as @e[type=block_display,tag=flag,distance=..250] at @n[type=marker,tag=map_center,distance=..250] run tp @s ~ 175 ~

execute as @e[type=marker,tag=flag_location,sort=random,limit=1,distance=..250] run tag @s add tp_here1
execute as @e[type=block_display,tag=flag,distance=..250,sort=random,limit=1] run tag @s add tp_flag1
execute as @n[tag=tp_flag1] at @n[tag=tp_here1] run tp @s ~ ~1 ~

#say @e[tag=tp_flag1] @e[tag=tp_here1]

execute as @e[type=marker,tag=flag_location,sort=random,limit=1,tag=!tp_here1,distance=..250] run tag @s add tp_here2
execute as @e[type=block_display,tag=flag,distance=..250,sort=random,limit=1,tag=!tp_flag1] run tag @s add tp_flag2
execute as @n[tag=tp_flag2] at @n[tag=tp_here2] run tp @s ~ ~1 ~

#say @e[tag=tp_flag2] @e[tag=tp_here2]

execute as @e[type=marker,tag=flag_location,sort=random,limit=1,tag=!tp_here1,tag=!tp_here2,distance=..250] run tag @s add tp_here3
execute as @e[type=block_display,tag=flag,distance=..250,sort=random,limit=1,tag=!tp_flag1,tag=!tp_flag2] run tag @s add tp_flag3
execute as @n[tag=tp_flag3] at @n[tag=tp_here3] run tp @s ~ ~1 ~

#say @e[tag=tp_flag3] @e[tag=tp_here3]

execute as @e[type=marker,tag=flag_location,sort=random,limit=1,tag=!tp_here1,tag=!tp_here2,tag=!tp_here3,distance=..250] run tag @s add tp_here4
execute as @e[type=block_display,tag=flag,distance=..250,sort=random,limit=1,tag=!tp_flag1,tag=!tp_flag2,tag=!tp_flag3] run tag @s add tp_flag4
execute as @n[tag=tp_flag4] at @n[tag=tp_here4] run tp @s ~ ~1 ~

#say @e[tag=tp_flag4] @e[tag=tp_here4]

tag @e[type=marker,tag=tp_here1] remove tp_here1
tag @e[type=marker,tag=tp_here2] remove tp_here2
tag @e[type=marker,tag=tp_here3] remove tp_here3
tag @e[type=marker,tag=tp_here4] remove tp_here4

tag @e[type=block_display,tag=tp_flag1] remove tp_flag1
tag @e[type=block_display,tag=tp_flag2] remove tp_flag2
tag @e[type=block_display,tag=tp_flag3] remove tp_flag3
tag @e[type=block_display,tag=tp_flag4] remove tp_flag4

tellraw @a[distance=..250] ["",{"text":"FLAG LOCATIONS HAVE BEEN RANDOMIZED BY ","bold":true,"color":"aqua"},{"selector":"@s","color":"white"}]
execute as @a[distance=..250] at @s run playsound minecraft:entity.sniffer.happy player @s ~ ~ ~ 2 0