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

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

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

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

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

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

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

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

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

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

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

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

f.s = n
f.w = l
e.y = j
e.v = g
e.w = k
n.u = k
n.z = f
k.w = e
k.t = e
k.o = e
l.x = k
l.w = k
l.s = g
l.p = e
l.v = f
j.u = k
j.z = g
g.s = n
g.w = l
assert g.w.x.t.v.txt == "g"