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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.o: D = None
        self.q: A = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

e = A("e")
l = B("l")
j = C("j")
k = D("k")
c = E("c")
a = F("a")
n = G("n")
g = F("g")
f = D("f")

e.q = c
e.s = c
e.x = a
l.u = n
l.r = c
j.v = n
j.u = a
j.r = g
j.q = e
j.s = f
j.p = l
k.y = l
k.r = j
k.o = f
k.q = e
k.x = e
c.w = j
c.p = j
c.q = j
c.r = n
c.x = n
c.v = l
a.q = e
a.p = g
n.s = e
n.r = e
n.v = j
n.x = l
n.u = l
g.q = e
g.p = a
f.y = l
f.r = j
f.o = k
f.q = e
f.x = e
assert f.o.r.u.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: F = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.o: D = None
        self.q: A = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

e = A("e")
l = B("l")
j = C("j")
k = D("k")
c = E("c")
a = F("a")
n = G("n")
g = F("g")
f = D("f")

e.q = c
e.s = c
e.x = a
l.u = n
l.r = c
j.v = n
j.u = a
j.r = g
j.q = e
j.s = f
j.p = l
k.y = l
k.r = j
k.o = f
k.q = e
k.x = e
c.w = j
c.p = j
c.q = j
c.r = n
c.x = n
c.v = l
a.q = e
a.p = g
n.s = e
n.r = e
n.v = j
n.x = l
n.u = l
g.q = e
g.p = a
f.y = l
f.r = j
f.o = k
f.q = e
f.x = e
assert f.o.r.u.p.p.p.p.p.txt == "g"