[Question]
  [
This challenge is inspired by [Fortran](https://gcc.gnu.org/fortran/)'s idiosyncratic implicit typing rules. Your task will be to determine the data type of the object `GOD` according to the implicit typing rules explained below.
## Background
Fortran 77 has six data types: `CHARACTER`, `COMPLEX`, `DOUBLE PRECISION`, `INTEGER`, `LOGICAL`, and `REAL`. Any object not explicitly declared to have one of these types is *implicitly* assigned a type by the compiler, as determined by the first letter of the object's name. The default implicit types are:
```
----------------------------
First letter | Implicit type 
-------------+--------------
    A-H      |     REAL          
    I-N      |   INTEGER
    O-Z      |     REAL
----------------------------
```
For example, the object called `NUMBER` (first letter N) has implied type `INTEGER` whereas the object called `DUMBER` (first letter D) has implied type `REAL`. These rules lead to the [old joke](https://ell.stackexchange.com/questions/163171/god-is-real-unless-declared-integer) that `GOD` is `REAL` . . . unless declared `INTEGER`.
The default implicit types can be overridden using `IMPLICIT` statements. For example,
```
IMPLICIT DOUBLE PRECISION (D,X-Z), INTEGER (N-P)
```
means that all objects whose names start with D, X, Y, or Z now have implied type `DOUBLE PRECISION` and those starting with N, O, or P have implied type `INTEGER`. Objects whose names start with any other letter retain their default implied types (in this example, `REAL` for A–C, E–H, and Q–W and `INTEGER` for I–M).
For the purposes of this challenge, we will adopt a more concise syntax: the `IMPLICIT` keyword (redundant here) will be dropped and we will use the single-character identifiers `C`, `D`, `I`, `L`, `R`, and `X` to represent the six data types (`X` represents `COMPLEX`). Thus, the example `IMPLICIT` statement given above becomes
```
D(D,X-Z), I(N-P)
```
i.e. a series of identifier–range pairs.
## The challenge
Assume that the object `GOD` exists in a Fortran 77 program and does not have an explicitly declared type. Write a program or function that returns the implied type of `GOD`, given a compact `IMPLICIT` statement as input. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"): the shortest submission (in bytes) in each language wins.
## Input
* Input is either empty or otherwise consists of 1 to 26 identifier–range pairs.
* Input may be taken in any reasonable format (e.g. one long string, list of identifier–range pairs). If you divide the input into identifier–range pairs, each pair may either be taken as is, e.g. `'D(D,X-Z)'`, or split, e.g. `['D', '(D,X-Z)']`.
* In ranges, letters appear in alphabetical order and are separated either by commas (for single letters) or dashes (indicating a span of letters). One-letter spans, e.g. `G-G`, are valid. The outer parentheses must be included, but may be replaced with other paired delimiters (e.g. `[]` or `{}`) if desired.
* `IMPLICIT` statements are guaranteed not to overlap. That is, no letter has its implied type specified more than once.
* Alphabetic characters must be uppercase.
## Output
The uppercase identifier, `C`, `D`, `I`, `L`, `R`, or `X`, that represents the implied type of the object `GOD`. If the input is empty, your code must return `R` (the default type of `GOD`).
## Test cases
Input -> Output
```
'' -> R
I(M-Z) -> R
I(A-Z) -> I
I(G) -> I
I(G-G) -> I
L(A,B,D-H,M-X,Z) -> L
D(D,X-Z), I(N-P) -> R
L(B,D,F,H,J,L,N,P,R,T,V,X,Z), C(A,C,E,G,I,K,M,O,Q,S,U,W,Y) -> C
D(S-Z), D(J-Q), D(A-H) -> D
I(I-K,M,R-T), R(N-P,U-Z), D(D-F,H), X(C,G), C(A,B,Q), L(L) -> X
I(F), X(N), R(P-P), I(C-C), C(A-A), I(J-J), R(V), D(H-H), X(O), L(B-B), C(R), L(Q-Q), I(D), L(X), R(S-S), C(Y), L(T-T), L(Z), X(U), D(K-K), R(G), X(W-W), D(I), C(L-L), R(E), I(M) -> R
```
Note: In the first test case, single quotes denote string boundaries.
## Bonus imaginary internet points!
Awarded to answers that only use characters from the standard Fortran 77 character set: the 26 uppercase letters `A-Z`, the 10 digits `0-9`, the space , and the 12 characters `+-*/=().,’:$`
  
[Answer]
# FORTRAN IV (Compiled with [gfortran -ffixed-form](https://gcc.gnu.org/fortran/)), ~~309~~ ~~291~~ ~~290~~ ~~280~~ ~~398~~ ~~393~~ ~~392~~ ~~334~~ ~~237~~ 231 bytes + Bonus imaginary Internet points
---
**This should now be a proper FORTRAN IV program, with no anachronisms!**
---
```
	REALS(200)
	DATAG,R,H,A/1HG,1HR,1H-,1H(/
	READ 9,S
    9	FORMAT(200A1)
	DO1 I=1,200
	C=S(I)
	IF(C.NE.A)GOTO2
	T=S(I-1)
	GOTO1
    2	IF(C.LT.G.AND.S(I+1).EQ.H.AND.S(I+2).GE.G.OR.C.EQ.G)GOTO8
    1	CONTINUE
	T=R
    8	PRINT 9,T
	END
```
[Try it online!](https://tio.run/##PVDJbsMgED3DV/gI6jMJPiWHHCgm2K0DCSbdblFbR5W6SGkP/fq64EhBGol5m2Zm@Dr9nA6f5XE4f8aRBKO6nlXzOaekVlFZBDRQM9lYyCakKlOxGc3Kuliip0V6S7L2YaNidiqZvV4W7Uoi9ZToVc/aBLZrpoUzQnHro68oiZkosz4DcoqqzrIuCiuUq0VSXEkuzE40l77iwprE@yB0ZuwUuJj8kmjvYuv2JueHCVuQbWhdTONGSoyrx7Fj16ixTrvdoIPDNu0ZcYcHPHEUmiloGFi0uMUGHjv02OMej/zveXg/HL/Hchjefl9fynS7j38 "Fortran (GFortran) – Try It Online")
Here's [the same code embedded in a loop that runs through the entire test suite](https://tio.run/##PVLNTuMwED4nT5Gjo50xdU9w4ODaqePWSVrHpYUbAoKQdkFi97BPv9nxBHFwxvP9zSTK9PH55/PxHV@n5TLPRWx0GMV6tarLwuqkHURoQV@p1oFqIx2kI67KqlKrVZbb6gZGaqvqptgOsdMp27XKAYOq/K0C6svC3I7CE@i3wsi@kbp2QxrWZZEygVmfAcVR60UWknRS91aS4oeqZXOU7Xe/rqVriB@iNJlxHHjNflWYoU@@PzU5PzJ2XRyi7xOtm5ZR@Q3KountPJdedPhQU9FLcfxAKkFo2IDFFjq8AJFWWLiQCiovejxkBfGwpe@0gwA9HOibJbiDrIbKkN9AAw487KGDAY4wwgnOcJ@zRk6yYodHrhrbPNpj1kZMBMY8Bk5fQos0iW4XYcB95W8gm4MI2bplsmfjgfbLexo0ixQ19zvcMX/HkS0ugQOHbHDD2sjdkffywnJ3YdeIIyvuGUu8ZBAPnHHixD3uWekYO@OZUc@ugIG5hnO7@t/T9PPx9feM0/T29@UZ6Wf89R8). I don't think this can be done with TIO's header and footer.
---
*18 bytes off thanks to @JonathanAllan, who pointed out that one IF statement wasn't needed.*
*1 more byte off by eliminating a stray space between `CHARACTER` and `S` at the top.*
*And 10 more bytes by rearranging the spaghetti code a bit.*
*Added 118 bytes to put it in proper FORTRAN IV fixed-column punch-card formatting. (This is for historical accuracy -- it isn't necessary for proper functioning under gfortran.)*
*Shaved off 5 more bytes: Cleaned up the GOTOs a bit, and changed the treatment of characters so it's actually correct for FORTRAN IV.*
*1 more byte off from removing an unneeded space in the `DATA` statement.*
*58 bytes off by streamlining the flow of control through the various IF statements.*
*97 more bytes off by: (1) eliminating variable `P`; and (2) replacing the spaces required at the beginning of a line with a tab character, which I found is allowed, according to an old FORTRAN IV manual. (I was thinking of punch card machines, which, as I recall, didn't have a horizontal tab, but I forgot about teletype machines, which did have a tab key.)*
*Thanks to @Dingus for 6 more bytes (from removing the `B` in the `DATA` statement which was no longer needed after `P` was eliminated).*
---
I've limited myself to FORTRAN IV constructs here. This should now be a correct FORTRAN IV program, without such things as the `CHARACTER` data type and quote-delimited strings, which were only introduced later. 
Characters in FORTRAN IV needed to be entered as Hollerith constants, and they could be stored in variables of type REAL (and probably other types sometimes too, but there was no CHARACTER type originally). (As I recall, a real could hold 5 ASCII characters from what we now call a string. I think they were padded with spaces if there were fewer than 5 characters in a grouping. The single characters I use are each stored as a real, padded with extra space characters in the real.)
Input is on stdin, on one line, just like the OP's test cases.
Output is on stdout.
---
*FORTRAN IV was my introduction to computer programming -- it was the first programming language I ever learned. When I was a boy, I read through my dad's textbooks when he took a class in it at NYU, which was required by his musicology graduate program. Computer programming (as well as FORTRAN itself) has changed quite a bit since then :) .*
---
[Answer]
# [Python 3](https://docs.python.org/3/), 61 bytes
```
lambda i:[a for a,b in i if re.match(b,'G')]or['R']
import re
```
[Try it online!](https://tio.run/##hc0/C8IwEIfhPZ/itstJ6uImdBCqhY5OxZghVUOvtU0JWfz0sXTyHzjeezz8pkds/bhJLj@nux2aqwXeagvOB7CqAR6BgR2E23qw8dLKRmGJZHzQeEQjeJh8iPM7cS6FxgIVoC5UnZ0MGjWXeil7tcuqpZCYAo9RrpxkItFBDv/g4RN2M@zfYPkDVt@LPb0ciETpCQ "Python 3 – Try It Online")
**Input** a list of lists of the form `["<type char>", "[<var letters/ranges separated by commas>]"]` (*eg* `[['D','[D,X-Z]'],['X','[E,A-J]']]`).  
**Output** a list of of one string of type char.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~21~~ 20 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ṪḊṣ”,Om2r/71eƲƇµƇȯ”R
```
A full program accepting a list of pairs as defined in the specification (each being `[type_character, ranges_string]`) which prints the appropriate type character.
**[Try it online!](https://tio.run/##y0rNyan8///hzlUPd3Q93Ln4UcNcHf9coyJ9c8PUY5uOtR/aeqz9xHqgaND///@jo9U91XUU1DU8db11fHWCdEM01WN1FKLVg8CifroBOqG6UVAxF7CYi66bjgdUJAIs4qzjDuU7g/mOOk46gVARH7CID5AXCwA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##ZVG7SsNgFN59im5R@A6ii3OTtLnfmyZpyNhF6uLmJi4B38HJTQRBEOyqEHyN9kVimls9v@P5znf7z3@93mzu6nq3fdl9Pu62z/v7J3g3l7fnVxfr6r0qvz6q8uetQcP6u9w/vGZ1nefFCfJcMiRMpFOHVmdS8ReZ/kM0caYjYncayFBJh0Mpjmq13alIW0dMBr1LvqBv1JhDhwkbLnyEWGCJzuugU/oUBTNoMGDBgYcAEWIkyITEaMzrZpMCNk9JF15k0MExpEXPC4eeiAUvlZqePZK2iAJNaCljyOteZwtpc6Z3Wabf3uZ4K4UU7k5TtjfJZPola6sT7@qxXjLJzDtk22C8Wpeksm3KUiOKmFPGuIvxrt28Yp1i1tgiizlrjJtQwtgGS7XJZtoZ6@@0v1D8Ag "Jelly – Try It Online").
### How?
```
ṪḊṣ”,Om2r/71eƲƇµƇȯ”R - Main Link: list of pairs, [[type_char, range_str],...]
               µƇ    - filter keep those for which:
Ṫ                    -   tail & yield (removes the range_str which we now process
                         ...leaving [type_char] as what the filter might keep)
 Ḋ                   -   dequeue - remove the leading '(' 
  ṣ”,                -   split at commas (e.g. 'A,F-H,K-K)' -> ['A', 'F-H', 'K-K)']
     O               -   to ordinal (vectorises)            -> [[65], [70,45,72], [75,45,75]]
              Ƈ      -   filter keep those for which:
             Ʋ       -     last four links as a monad:
      m2             -       modulo-2 slice                 ->  [65]  [70,72]  [75,75]
          /          -       reduce by:
         r           -         inclusive range              ->  [65]  [70,71,72] [75]
           71        -       71
             e       -       exists in?                     ->  0     1          0
                     -   }-->                               -> [[70,45,72]]
                                                               (non-empty is truthy)
                     - }--> [[type_char]] or []
                  ȯ”R - logical or with 'R' (i.e. 'R' if empty) 
                      - implicit, smashing print
```
[Answer]
# [sed](https://www.gnu.org/software/sed/) -E, ~~50~~ ~~45~~ 44 bytes
*1 byte off thanks to @user41805.*
```
s/^/R(G/;s/(.)*\([^)]*(G|[A-F]-[H-Z]).*/\1/;
```
[Try it online!](https://tio.run/##LY47c8JADIT7/ApKmVnhSU3lB36ewdgYm2eVTCYNZMZJl98e526hOZ203640vr/px@1nmkb/6jeS@svRl4U3P8vp6l3mkv6eAk0uesr0ePEWc//86i@n6SWXSo@eLcGjpHzUFiMBQsSaodIBVowlxmApzHJZa@0IqyNBhgIGa9RosMMejsYssv4IK6TIUaLCBlu06NDj4LJaJsVS6JY10MytztWxje7ssHFr0D3BWO0m@xskQvrMD@HMRoyzJhTXNNb2PndnpNED1YB9oQX1PSMzfQRuGBJqSLZht@VducTsBrpabUkcONvxSCNHZnRMLLUkmXLWa89pTpdRQ23F3Mr7u399f95v46Srfw "sed – Try It Online")
This takes input on stdin formatted on one line just as in the OP's test cases, and output is on stdout.
[Answer]
# JavaScript (ES6), 39 bytes
Takes input as an array of `['type','[patterns]']`.
```
a=>(a.find(a=>'G'.match(a[1]))||'R')[0]
```
[Try it online!](https://tio.run/##dZNPb4JAEMXvfoq9LSRvTHttg42CIor/UCst4bBRbG2sGDVND353iyvoaNsLYfbN/N7bCXyoL7WdbhbrHa3SWXKYWwdlVQxVni9WMyN7la4sf6rd9N1Q0X1smvu9DKQZ3cWHx6gkRBTFENlJDF1E0pOQUYdeYxn/pVTPinejuP@d0x@Kr1mowaEmOhSioPqXHufY4yDUjshpXer/TqZpGQsNNNGCjy76CDDCM07kbNo@Odqow4WHNjroYYAhxpjgJWfaN@7DwltXLRqwqkrNfMq5ubFHR3pAo1N3kOfG@IrmUJb2VIfH2oZ7lbSG3E3fzs@9whuvBiN0mV9f76nYmk02Z1OVaS1qsblnlrBJPF@PpalRjfECpgyKHWm2w5SQuQxpyOZfWNeo2JquXpn/mCVrU5vRXNY1oQnr85iLTz6bqbOUncsXVYpL5Xm6qavsfzEiBZF8r5PpLpnFprAqYpqutukyKS/TN2NuKBPi@BSWde4TT0L22lI8CNmoen7dkaZ5@AE "JavaScript (Node.js) – Try It Online")
### Commented
```
a => (              // a[] = input array of [type, pattern]
  a.find(a =>       // find in a[]:
    'G'.match(a[1]) //   an entry whose pattern is matching 'G'
  )                 // end of find()
  || 'R'            // find() returns undefined if nothing is found,
                    // in which case we use the string 'R' instead
)[0]                // extract either the type of the entry that was found
                    // or the first (and only) character of 'R'
```
[Answer]
## Ruby, 37 bytes
```
->x{(x.find{|_,r|/#{r}/=~?G}||?R)[0]}
```
[Try it online!](https://tio.run/##XVJdT@pAEH3vr9jEh26TM1V/ABpotRQWhPJVbZob7gUiiSIBTGoo/nWcnVZNbh/aM3M@ZtLd3fvfj/Oqcaab4qgLf7XeLI7lH@zKy4vj7nTZ@LyNTmV5m3jZVX46H5b7w141lOvEukdPnqIblTBu1jhmHP0i@sZGN9FCSG30KEWlNU6oQ6TshIp1nwZ1mtGsxD3a6MCgjwESjDGF9UEFnBTgDhFidNHDA4YYYYIZHsUfcOpIMkPdoaF8m9QWLuSdYrKuhMbMJHYqJrU6JJ7JKNUBonpSCzbBaCP@lP33ouiLe8A7290DCio9NaXuUEf4qeS2qUp9kKQWtUSbSDWUDWMdSpWKa0QjUTxKbyybGv0kGRNJ7FJXlJH0ZjSTbiwuQ0a4O8nt1f/U9V/Wm@U@u/Z9us4dR87RX87/PavFmyptWTqKH4ug5ht7yBb7@@3L@qBdG@N6P5L/WDDnv863x7IoVVbwVYEq6mH@Yadd7VlNlrtefpKQagK/WetIZyuJFXznS7bKbJ3/NljsLDeL8xc)
Takes input as pairs with brackets, and interprets the second element of each pair as a regexp.
[Answer]
# [Perl 5](https://www.perl.org/) `-MList::Util=pairgrep -ap`, ~~53~~ 30 bytes
```
$_=(pairgrep{G=~/$b/}@F)[0]||R
```
[Try it online!](https://tio.run/##NU/dS4NQHH33r/gxjCmcO@1hL4q1pfNj6dbutlZdJGyMkCQvTgbR6k/vJkYv58D5giMPTTVW@t6TtZyE7h8q/dkzZFE2r81Bfkbet6W/WF@T0BR2fj5z5R6Lj8GJBiPD0vfWNU@ieOPs@HIRma528eYZpqs33nDoKp9EytKcOIlZTgmJLCd2RVxLSdwgQIgYc6RY4A4cG9zjAU85dbUpfMwQIcEtMiyxwhpb7PDYD/haIGjNumhAYs5WPU9Z3JvBTy3bsn4/Kpal5bF1nG1bVt7/oU4dj@xLW7FCVr8 "Perl 5 – Try It Online")
**Input**:
A single line, with literal square brackets:
`type [letter|range...] ...`
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~37~~ 36 bytes
```
$
R(G
1!`.(?=\([^)]*(G|[A-F]-[H-Z]))
```
[Try it online!](https://tio.run/##LY5PT4NAEMXvfIqaaDKYNyZ@AGOALcvSpX@gLRSsqQcPXjwYj3533H0tB2Zn3u@9mZ/P36/vj/lB7GW@T1qxyfPd5UleX95kek/Pj2L/pkzLs06Vjuc0nedkEb/ESaNjGkp2LZY/DcVLhhxGKzQ6IIhGDIZAYeFkrdtIBB0lKtTwWGOLFnscEWksiuAvsISFwwoNNtihwwE9TjGrY5KRWnesmVZxtdPItroPwzauweEGGg2bwmuQAvaWnyOavfhoLSmuadyG@@KdhRZXVDP2tdbUj4ys9Bq4YUiuOdmW3Y53OTHsBro67UicONvzSC8jMw5MXOmKpOWs155TR5dXT23J3Cb9Bw "Retina 0.8.2 – Try It Online") Link includes test cases. Edit: Saved 1 byte thanks to @MitchellSpector. Explanation:
```
$
R(G
```
Default to Real.
```
.(?=\([^)]*(G|[A-F]-[H-Z]))
```
Match a letter that's followed by a `(` and then any non-`(` characters including a `G` or a range that includes a `G`.
```
1`
```
Only output the first match, in case the default is a duplicate.
```
!`
```
Print the match rather than the count of matches.
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-pl`, 47 bytes
Takes space-separated arguments from STDIN.
```
t=?R
gsub(/(\w)(\S+)/){t=$1if"G".tr!$2,''}
$_=t
```
[Try it online!](https://tio.run/##JY5LawJBEITv/oqNCM6Q6khyl7AP3Yez6r7cVYSAhwQhRNGVEEL@etYpvUz3dH1V3afL7qfr2vFr3vs4X3ZqpLbfWm2LRz3Sv@148Lx/74f9p/b0MHjBcPjXG7yN267rxSqVjbbFvZfw9ogtRrnwEEiEVBpYMVABGks5sZrLkoCVMUWEBAZzLJGjxAqEHd@6fUwQIsYMKRbIUKBCjTWTCuYEKpGMxZWIa2MhmUupnZwrUN2pQOwS7TTKR3hP9mB9Rhm6plTmtCztVfY4X/wbJS5/iSTUVgyK5BazoNcTj1TOPuMZsQrYN6QLKSiuOSh5j1EbOiumzGRGJuSglpqjmLQRw/mEUan@Pxzb/eHr3Mnx8wo "Ruby – Try It Online")
[Answer]
# Java 10, 63 bytes
```
m->{var r="R";for(var p:m)r="G".matches(p[1])?p[0]:r;return r;}
```
Input as an array of String-pairs in the format `["type", "[declaration]"]`.
[Try it online.](https://tio.run/##nZVfb6JQEMXf@ylueMJ0hnRfJd2NYot/wCpotSU83EW6iytILlebxvDZXUBjTcM80BfDZTxzf@cwyaz5nuN69e8YbHiWMZtHyeGGsSiRoXjjQcjG5ZExV4oo@cMC9fTg@Z7P4pZe1PKb4ieTXEYBG7OE3bNjjD8Pey6YuFccRX/bCrU8pe24VbwxFS3mMvgbZmrq/fBbv1Lvzm8LXYRyJxIm9Pyoly3T3e9N0fLceb@NViwu6C4AjLdOaDLMpJqE7@wT7ZBXaPW16@NBGSigeDa@@kreUNT5jsj8hgSbiawKDrrQwz7YuIRmmL1S3oNl5Q5YDdAYJ82BChx4hD4MwYIxTMCBGTzDCe7rLcbJgQEPYMIARmDDE0zBhTks4KW5G7fWS1Ua4pQqdbDf/GMNsKR1cFbT1TmHB3Oap4dFSDXFZVk0wKTT6kKdkyp7q7mPR4phTBmbVFNROzAGGiQ3dijVEIfUXc9UfH0kw3ui0ulil6JzKM20dmwq7B6lWVJuXHQpgBeq2ax2wqrSK5XAnEpthCOKzaSaLXBBtRtQbiy0qHseqDjty@xeL5pqHVSjfLWPyrPBs/C8F9yPTIaxtt1JLS3@IzeJui62nbaT0UbrCME/Mm0Vhulse@qhXvS3Spspt4kWfL46E@TH/w)
**Explanation:**
```
m->{                     // Method with String-matrix as input and String return-type
  var r="R";             //  Result-String, starting at "R" as default
  for(var p:m)           //  Loop over each pair `p`
    r=                   //   Set the result to:
      "G".matches(p[1])? //    If "G" regex-matches the second part of the pair
       p[0]              //     Set the result to the first part of the pair
      :                  //    Else:
       r;                //     Leave the result unchanged
  return r;}             //  After the loop: return the result-String
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 38 bytes
`+` to [@Noodle9](https://codegolf.stackexchange.com/a/201787/68224)
```
$r=$args|?{'G'-match$_[1]}
"R$r"[!!$r]
```
Expects input via [splatting](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_splatting).
[Try it online!](https://tio.run/##XZLRbtpAEEXf/RUbtK2hvSM1TaW@1E3AToxhIWAgOFkshJADkWhK7UiJRPh2ujvGatInz9yZe2bWmu3v5ywv1tlmc5D3whO7g8w9uchXxev5zg1d@rV4Wq7lXJ@me6cWy7ymT05knh72jrzfrDy9XC/y9MvL1@/flhD/stMzp@66EG7sNmDCSPfoLn0nNI9CVAnhfym9E5RuooWA2uhRgtKqylKgAySGBhHpPg3ejlHaeHCFNjpQ6GOAGGPcwBIgfMP0cYkQEbro4RpDjDDBFLcM8Sv@iOmB7tCQv01qc0NQLRuR9cc0NuXYLoHJ0RKQmW6iRPsIjzNbsBilFUOSCnLFbX1GDMw77Ht88ksTNTnvUIfrNwxvU4m@ZlyLWtwbczbkXSMdcJawa0Qj7rhlbczrKn3HjAkTu9TlzpC1KU1ZjdilSHHtkrm96j@LV/Fh5wgh88cVhMxetuaQ5NwqD482vqjbkqBiu3l4Em79/Ic3SxuYFZ9c9grU5fxN2ZvphsHuGwzNCoP4KMx5XhickWol7Wc5qvbZHqLmmLI/bEid/eEv)
[Answer]
# [Perl 5](https://www.perl.org/) with `-apF'(?=\[)'`, 25 bytes
Accepts input as:
```
A
[A-F,H-M]
B
[N-Z]
```
```
$\||=$_ x"G
"=~<>}{$\||=R
```
[Try it online!](https://tio.run/##K0gtyjH9/18lpqbGViVeoULJnUvJts7GrrYaLBT0/78nV7SnrreOr06QbkgsVxBXtJ9ugE6oblQslwtXtIuum45HLFcEV7SzjnsslzNXtKOOk05gLJcPV7RP7L/8gpLM/Lzi/7qJBW7qGva2MdGa6gA "Perl 5 – Try It Online")
[Verify all test cases.](https://tio.run/##jZBbb9pAEIXf@RUTy5IXaQbUvnJpwQ5gMIRrIAFUUXu5qJaxbEhThfSvu@uxCS@t1KednTnnm7P7fRPvE@nuj0ABGIm@ulxq@jd41doFrfa7Wn9/49Y4MaAOu6NHh5giufHpHPgyjsmTrr@JpOoHJ7mTUSn0K4XC9hiBfwgkHALQ9K9aBbxjAdQtPJ9qutj8/AHUMoDqYIDxFkbKrH96N6BarSp96tSKFWWQr6F0T9L7l@fzXzzuMXiRUWYKZeQDhRKMX2VRxPJyXfYqcRku4ktttSyWV0F5dyVwuAwRyfjsnz78m7BlZAbjP78gR35ESbHpc/J/1oxsG79Gvz6yVCqBlq4/bGG5BD1LAXe1mwTW6wqc9jJQqhyntRq2A3SVM0D6sbwpJmfXVTnvVGd7KHjHQBaSxBZ9ei6m@8eqbuS1rer2raJr7YgGNtGiDvZpgZnWSSxh4UI5EWwxoGFOc4RSYgs72EUHBzjEMU7xEVMfgqlIJt5jG23sYR8fcIQTnOEcn9hvKuqEmZbo0ojPBnV4ZqlMNqWuMU3VZJxuxVmutkjtVNVCmNjONzUxJTjCYf9C@VusGLB7qDKn2U0yMz01@N6lLs8fmduhjPrApCY1WTvm24gT2sLi24JdE5qw4ol7U07qiGdmzJjYox4r29yb05y7Nrsccnh2z9x@9qd/AA)
*Note*: the empty test case is missing from the verify all link because my test suite is bad and I should feel bad, but [it works when tested in isolation](https://tio.run/##K0gtyjH9/18lpqbGViVeoULJnUvJts7GrrYaLBT0//@//IKSzPy84v@6iQVu6hr2tjHRmuoA "Perl 5 – Try It Online").
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 18 bytes
```
@@Y'G~``.@>_FIg|'R
```
Takes each identifier–range pair as a separate command-line argument, in the format `D[D,X-Z]`. [Try it online!](https://tio.run/##K8gs@P/fwSFS3b0uIUHPwS7ezTO9Rj3o////LtEuOhG6UbH/PaP9dANi/ztHu@l6xAIA "Pip – Try It Online")
### Explanation
```
              g     The list of cmdline args
            FI      Filter on this function:
         @>_         Everything after the first character
      ``.            Convert to Pattern (regex) by concatenating with an empty Pattern
   'G~               Match against the string "G"
                    We now have either a list containing the pair that matched, or empty list
               |'R  Logical OR with "R": if no pair matched, use "R" instead
  Y                 Yank (to get the operator precedence to cooperate)
 @                  Take first element: the pair that matched, or "R"
@                   First element of that: the identifier from the pair, or "R"
                    Autoprint
```
[Answer]
# [Core Maude](http://maude.cs.illinois.edu/w/index.php/The_Maude_System), 271 bytes
```
mod G is pr LIST{String}+ LEXICAL . op g : String ~> Qid . var A B C D
:[Qid]. var X Y :[String]. ceq g(X Y)= A if A '`( B C D '`) := tokenize(Y)/\
C == 'G or substr(string(C),0,1)< "H" and substr(string(C),2,1)> "F" . eq g(X
S:String)= g(X)[owise]. eq g(nil)= 'R . endm
```
The result is obtained by reducing the `g` function with a Maude list of strings of the form `"A(B,C-D)"`. The result will be a quoted identifier of the letter for the type of `GOD`, e.g., `'R`.
### Example Session
```
             \||||||||||||||||||/
           --- Welcome to Maude ---
             /||||||||||||||||||\
         Maude 3.1 built: Oct 12 2020 20:12:31
         Copyright 1997-2020 SRI International
           Thu Oct 21 00:28:50 2021
Maude> mod G is pr LIST{String}+ LEXICAL . op g : String ~> Qid . var A B C D
> :[Qid]. var X Y :[String]. ceq g(X Y)= A if A '`( B C D '`) := tokenize(Y)/\
> C == 'G or substr(string(C),0,1)< "H" and substr(string(C),2,1)> "F" . eq g(X
> S:String)= g(X)[owise]. eq g(nil)= 'R . endm
Maude> red g(nil) .  
result Qid: 'R
Maude> red g("I(M-Z)") .  
result Qid: 'R
Maude> red g("I(A-Z)") .  
result Qid: 'I
Maude> red g("I(G)") .  
result Qid: 'I
Maude> red g("I(G-G)") .  
result Qid: 'I
Maude> red g("L(A,B,D-H,M-X,Z)") .  
result Qid: 'L
Maude> red g("D(D,X-Z)" "I(N-P)") .  
result Qid: 'R
Maude> red g("L(B,D,F,H,J,L,N,P,R,T,V,X,Z)" "C(A,C,E,G,I,K,M,O,Q,S,U,W,Y)") .  
result Qid: 'C
Maude> red g("D(S-Z)" "D(J-Q)" "D(A-H)") .  
result Qid: 'D
Maude> red g("I(I-K,M,R-T)" "R(N-P,U-Z)" "D(D-F,H)" "X(C,G)" "C(A,B,Q)" "L(L)") .  
result Qid: 'X
Maude> red g("I(F)" "X(N)" "R(P-P)" "I(C-C)" "C(A-A)" "I(J-J)" "R(V)" "D(H-H)" "X(O)"
>       "L(B-B)" "C(R)" "L(Q-Q)" "I(D)" "L(X)" "R(S-S)" "C(Y)" "L(T-T)" "L(Z)"
>       "X(U)" "D(K-K)" "R(G)" "X(W-W)" "D(I)" "C(L-L)" "R(E)" "I(M)") .  
result Qid: 'R
```
### Ungolfed
```
mod G is
    pr LIST{String} + LEXICAL .
    op g : String ~> Qid .
    var A B C D : [Qid] .
    var X Y : [String] .
    ceq g(X Y) = A
        if A '`( B C D '`) := tokenize(Y)
        /\ C == 'G or substr(string(C), 0, 1) < "H" and substr(string(C), 2, 1) > "F" .
    eq g(X S:String) = g(X) [owise] .
    eq g(nil) = 'R .
endm
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-g`](https://codegolf.meta.stackexchange.com/a/14339/), 12 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
k@'GrXÌÃÎª'R
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWc&code=a0AnR3JYzMPOqidS&input=W1snRCcsJ1tELFgtWl0nXSxbJ1gnLCdbRSxBLUpdJ11d)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~23~~ ~~21~~ 20 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ʒθ',¡εáÇŸ}˜71å}˜'Rªн
```
Input as a list of pairs in the format `["type","(declaration)"]`.
[Try it online](https://tio.run/##yy9OTMpM/f//1KRzO9R1Di08t/XwwsPtR3fUnp5jbnh4KZBSDzq06sLe//@jo5U8lXSUNDx1vXV8dYJ0QzSVYnWilYJAYn66ATqhulEQEReQiIuum44HhB8B4jvruEN4ziCeo46TTiCE7wPi@wDZsQA) or [verify all test cases](https://tio.run/##XVC5TsNAEP2VyE1AelNQUUY@Et@Oz8RJ5AIkCioKJKQUtNCnpklBQ4@UhiYWDUhRvoEfMfbaVmZT7b6ZecfMw@PN7f1d9bQeKYO/l81AGa2rn81hN8R@e/gst@Xr9@759@36qnyvn2G8/zh@VahWq5WiQFGKAoP6a9f/C5@Wl1JBPS@YZ5BOBU8QoMEgCz7lOFGNpmUgF2rouAGFMrdmYgILDjwECBEjxQytTk3SW30dY5iw4cLHFBESZJhjIXslvZNADkUMqWTJS9jUaMWUtkNxFw6ZJGJQna3FeYN1mFIuDZ2J2MWTLSaMGDCbUNygv4hOOpcklfUcchhvxoJZxGNNWQiNNKYXs07UX0RoG6yTM5eEEsZfsKm0P5ZAS@afsWQuuUzNZFNzmrM5m7l45DHOmKX0m5MW/w).
**Explanation:**
```
ʒ           # Filter the (implicit) list of pairs by:
 θ          #  Pop and push the last value of the pair
            #   i.e. ["I","(I-K,M,R-T)"] → "(I-K,M,R-T)"
  ',¡      '#  Split it by ","
            #   → ["(I-K","M","R-T)"]
     ε      #  Map each inner range to:
      á     #   Remove the "(", "-", and ")" by only leaving the letters
            #    → ["IK","M","RT"]
       Ç    #   Convert each letter to its codepoint integer
            #    → [[73,75],[77],[82,84]]
        Ÿ   #   And then convert it to a range
            #    → [[73,74,75],[77],[82,83,84]]
     }˜     #  After the map: flatten the list of lists of integers
            #   → [73,74,75,77,82,83,84]
       71å  #  Check if 71 is in this list (the codepoint for "G")
            #   → 0 (falsey)
}˜          # After the filter: flatten the remaining list of pairs (potentially empty)
            #  i.e. [["X","(C,G)"]] → ["X","(C,G)"]
  'Rª      '# Append an "R" to this list
            #  → ["X","(C,G)","R"]
     н      # Pop and only leave the first item of this list
            #  → "X"
            # (after which it is output implicitly as result)
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~38~~ 37 bytes
```
($args+'RG'|?{'G'-like"[$_ ]"})[0][0]
```
[Try it online!](https://tio.run/##ZVNdT@JAFH3vr7jBup3Ge5N93mSzQKulUBAKSNUYU9lZaazAtuO6BvntOC130F2TPsycc8/Hbdr16lkW5ULm@c7@Bd9hsxN2WtyXJ04cOK8/Nk7gUJ49yMa1fQs3ja17/fVGP7utZTWFZaFwYgcBwHHcD5dQ9OnK3UOhgVqfoeATQAaK9lAkWthGnzrYpwSNAcf4wsekcsVKO6Ah057RaiWeYQe7GOEAhxjjBC@w9tEST3t7eIoBhtjDPp7jCMc4xRlespFvcsac4osujfjUog6PJaZ@SJVPTJN6JK4q4fQg9Ul3qc@J8DA4dGjj3jISkfvfazzj8QEbDqsd62098owBtRjrUpfnLjiyQybwnCPa1GZdzMiINwqFz0jCLmMa8@wlMxNeLRJX7DvlpB71WBUwM6MZcyG7RBTxzCkn9quFLRde4XhjAdjy71rOlfyJYJcqVfJRLlWpP0v7tmL/gZriw90FOIJYlmpVSFALCWlRpC8Id3KePpUShofPHLLHdZ7NM5W/wHy1/CML7ZYu9wJ4ztQCUiiz5X0uQea1O6hVNcG3qkghy6dc6RJfQP81zfcemmzYwvAkf7@v5H4zuoa13b0B "PowerShell – Try It Online")
Takes strings as is, e.g. `'D(D,X-Z)'`.
]