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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: B = None
        self.o: C = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.q: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: E = None
        self.s: F = None
        self.txt = txt

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

l.y = a
j.w = n
m.q = g
m.s = n
m.w = f
f.s = g
f.w = k
f.o = m
f.v = n
g.s = l
g.t = k
g.p = f
n.p = a
n.y = m
n.q = g
a.y = k
a.o = g
a.s = n
k.w = n
assert g.s.y.s.p.y.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: B = None
        self.o: C = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.q: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: E = None
        self.s: F = None
        self.txt = txt

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

l.y = a
j.w = n
m.q = g
m.s = n
m.w = f
f.s = g
f.w = k
f.o = m
f.v = n
g.s = l
g.t = k
g.p = f
n.p = a
n.y = m
n.q = g
a.y = k
a.o = g
a.s = n
k.w = n
assert g.s.y.s.p.y.w.q.txt == "g"