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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.p: A = None
        self.x: D = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.w: C = None
        self.x: A = None
        self.txt = txt

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

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

e.s = g
m.w = f
m.t = g
l.p = g
l.s = m
l.w = m
n.r = g
n.q = g
n.x = g
n.p = e
n.t = e
f.u = l
f.w = l
f.p = e
f.x = e
a.s = n
k.u = l
k.w = l
k.p = e
k.x = e
g.r = n
g.q = n
g.x = n
g.p = e
g.t = e
assert m.w.x.s.x.p.s.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.p: A = None
        self.x: D = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.w: C = None
        self.x: A = None
        self.txt = txt

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

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

e.s = g
m.w = f
m.t = g
l.p = g
l.s = m
l.w = m
n.r = g
n.q = g
n.x = g
n.p = e
n.t = e
f.u = l
f.w = l
f.p = e
f.x = e
a.s = n
k.u = l
k.w = l
k.p = e
k.x = e
g.r = n
g.q = n
g.x = n
g.p = e
g.t = e
assert m.w.x.s.x.p.s.p.s.txt == "g"