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

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

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

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

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

g = A("g")
l = B("l")
j = C("j")
m = D("m")
f = E("f")

g.s = l
g.x = l
l.p = g
l.r = g
l.t = f
j.t = g
j.s = m
j.o = m
m.s = l
m.w = j
m.u = f
m.z = g
f.w = g
assert m.w.t.x.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

g = A("g")
l = B("l")
j = C("j")
m = D("m")
f = E("f")

g.s = l
g.x = l
l.p = g
l.r = g
l.t = f
j.t = g
j.s = m
j.o = m
m.s = l
m.w = j
m.u = f
m.z = g
f.w = g
assert m.w.t.x.t.w.txt == "g"