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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

c = A("c")
f = B("f")
e = C("e")
l = D("l")
g = E("g")
a = D("a")
n = C("n")
b = B("b")

c.s = b
f.r = c
f.s = l
f.t = e
f.q = e
e.y = c
e.w = g
e.r = g
e.q = g
l.x = g
g.z = a
g.q = c
a.x = g
n.y = c
n.w = g
n.r = g
n.q = g
b.r = c
b.s = l
b.t = n
b.q = e
assert f.s.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

c = A("c")
f = B("f")
e = C("e")
l = D("l")
g = E("g")
a = D("a")
n = C("n")
b = B("b")

c.s = b
f.r = c
f.s = l
f.t = e
f.q = e
e.y = c
e.w = g
e.r = g
e.q = g
l.x = g
g.z = a
g.q = c
a.x = g
n.y = c
n.w = g
n.r = g
n.q = g
b.r = c
b.s = l
b.t = n
b.q = e
assert f.s.x.z.x.txt == "g"