BGP Community Local AS

Hi,

I am confused about BGP selecting path.Here topology

R5 is in sub-AS 45.And advertise prefix 9.9.9.9/32.

R5#sh ip bgp             
BGP table version is 14, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 9.9.9.9/32       0.0.0.0                  0         32768 i
*> 192.168.12.0     2.2.2.2                  0    100      0 (23) i
* i                 2.2.2.2                  0    100      0 (23) i

R4 is in sub-AS 45 same R5 and it learn prefix 9.9.9.9/32 from R5.

R4#sh ip bg              
BGP table version is 15, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i9.9.9.9/32       5.5.5.5                  0    100      0 i
* i192.168.12.0     2.2.2.2                  0    100      0 (23) i
*>                  2.2.2.2                  0    100      0 (23) i
R4#sh ip bgp 9.9.9.9/32
BGP routing table entry for 9.9.9.9/32, version 10
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
        2
  Local
    5.5.5.5 (metric 11) from 5.5.5.5 (5.5.5.5)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best

R2 is in sub-AS 23 and it learn prefix 9.9.9.9/32 from R4.

R2#sh ip bgp
BGP table version is 4, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 9.9.9.9/32       5.5.5.5                  0    100      0 (45) i
*> 192.168.12.0     0.0.0.0                  0         32768 i
R2#
R2#sh ip bgp 9.9.9.9/32
BGP routing table entry for 9.9.9.9/32, version 4
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
        1    3
  (45)
    5.5.5.5 (metric 21) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best

R3 is in sub-AS 23 and it learn prefix 9.9.9.9/32 from both R2 and R5.

R3#sh ip bgp 
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  9.9.9.9/32       5.5.5.5                  0    100      0 (45) i
*>i                 5.5.5.5                  0    100      0 (45) i
*>i192.168.12.0     2.2.2.2                  0    100      0 i
R3#
R3#
R3#sh ip bgp 9.9.9.9/32
BGP routing table entry for 9.9.9.9/32, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
        2
  (45)
    5.5.5.5 (metric 11) from 5.5.5.5 (5.5.5.5)
      Origin IGP, metric 0, localpref 100, valid, confed-external
  (45)
    5.5.5.5 (metric 11) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best

The question is, Why R3 select confed-internal(2.2.2.2) instead confed-external(5.5.5.5)?

Thank you in advance.