class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: G = None
        self.p: G = None
        self.v: G = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: D = None
        self.x: C = None
        self.r: A = None
        self.w: D = None
        self.v: B = None
        self.txt = txt

b = A("b")
n = B("n")
f = C("f")
m = D("m")
g = E("g")
e = F("e")
j = G("j")
k = B("k")
c = F("c")
i = C("i")

b.r = j
n.q = j
n.y = j
n.p = j
n.v = j
n.w = g
f.o = m
f.w = b
m.r = g
m.y = e
g.o = n
g.s = k
g.q = k
g.x = k
e.r = g
e.o = b
j.q = k
j.s = m
j.w = m
j.x = i
j.r = b
j.v = n
k.q = j
k.y = j
k.p = j
k.v = j
k.w = g
c.r = g
c.o = b
i.o = m
i.w = b
assert e.o.r.r.r.q.w.x.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: G = None
        self.p: G = None
        self.v: G = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: D = None
        self.x: C = None
        self.r: A = None
        self.w: D = None
        self.v: B = None
        self.txt = txt

b = A("b")
n = B("n")
f = C("f")
m = D("m")
g = E("g")
e = F("e")
j = G("j")
k = B("k")
c = F("c")
i = C("i")

b.r = j
n.q = j
n.y = j
n.p = j
n.v = j
n.w = g
f.o = m
f.w = b
m.r = g
m.y = e
g.o = n
g.s = k
g.q = k
g.x = k
e.r = g
e.o = b
j.q = k
j.s = m
j.w = m
j.x = i
j.r = b
j.v = n
k.q = j
k.y = j
k.p = j
k.v = j
k.w = g
c.r = g
c.o = b
i.o = m
i.w = b
assert e.o.r.r.r.q.w.x.w.o.w.txt == "g"