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

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

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

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

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

f = A("f")
i = B("i")
g = C("g")
c = D("c")
m = E("m")
l = D("l")
b = E("b")

f.z = l
f.s = i
f.o = i
f.r = c
i.s = g
i.o = g
i.x = m
g.y = f
g.t = b
c.o = b
c.w = i
c.v = g
c.p = l
m.s = b
m.w = g
l.o = b
l.w = i
l.v = g
l.p = c
b.s = m
b.w = g
assert l.w.x.s.s.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.r: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
g = C("g")
c = D("c")
m = E("m")
l = D("l")
b = E("b")

f.z = l
f.s = i
f.o = i
f.r = c
i.s = g
i.o = g
i.x = m
g.y = f
g.t = b
c.o = b
c.w = i
c.v = g
c.p = l
m.s = b
m.w = g
l.o = b
l.w = i
l.v = g
l.p = c
b.s = m
b.w = g
assert l.w.x.s.s.w.t.txt == "b"