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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: G = None
        self.q: E = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: F = None
        self.y: A = None
        self.r: B = None
        self.o: C = None
        self.txt = txt

a = A("a")
g = B("g")
d = C("d")
f = D("f")
m = E("m")
c = F("c")
e = G("e")
l = D("l")

a.s = d
a.q = d
a.r = e
a.w = l
g.o = a
g.u = e
g.q = m
g.w = c
d.u = e
d.s = e
d.x = g
f.y = a
f.w = m
m.p = g
m.q = f
c.r = a
c.q = m
c.y = d
c.s = e
e.x = m
e.t = c
e.y = a
e.r = g
e.o = d
l.y = a
l.w = m
assert l.w.q.w.q.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.r: G = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: G = None
        self.q: E = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: F = None
        self.y: A = None
        self.r: B = None
        self.o: C = None
        self.txt = txt

a = A("a")
g = B("g")
d = C("d")
f = D("f")
m = E("m")
c = F("c")
e = G("e")
l = D("l")

a.s = d
a.q = d
a.r = e
a.w = l
g.o = a
g.u = e
g.q = m
g.w = c
d.u = e
d.s = e
d.x = g
f.y = a
f.w = m
m.p = g
m.q = f
c.r = a
c.q = m
c.y = d
c.s = e
e.x = m
e.t = c
e.y = a
e.r = g
e.o = d
l.y = a
l.w = m
assert l.w.q.w.q.y.w.txt == "l"