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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.q: A = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: B = None
        self.s: B = None
        self.z: B = None
        self.x: A = None
        self.txt = txt

d = A("d")
f = B("f")
k = C("k")
l = D("l")
g = E("g")
n = D("n")

d.s = g
f.r = g
f.s = g
f.u = d
k.q = l
k.x = l
k.w = f
k.p = d
l.t = k
l.v = k
l.q = d
l.s = g
g.v = d
g.x = d
g.y = f
g.s = f
g.z = f
n.t = k
n.v = k
n.q = d
n.s = g
assert n.q.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.q: A = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: B = None
        self.s: B = None
        self.z: B = None
        self.x: A = None
        self.txt = txt

d = A("d")
f = B("f")
k = C("k")
l = D("l")
g = E("g")
n = D("n")

d.s = g
f.r = g
f.s = g
f.u = d
k.q = l
k.x = l
k.w = f
k.p = d
l.t = k
l.v = k
l.q = d
l.s = g
g.v = d
g.x = d
g.y = f
g.s = f
g.z = f
n.t = k
n.v = k
n.q = d
n.s = g
assert n.q.s.x.s.txt == "g"