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

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

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

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

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

f = A("f")
m = B("m")
i = C("i")
d = D("d")
b = E("b")
a = D("a")
c = E("c")

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

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

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

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

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

f = A("f")
m = B("m")
i = C("i")
d = D("d")
b = E("b")
a = D("a")
c = E("c")

f.r = d
f.o = d
f.s = m
f.p = a
m.w = i
m.t = i
m.y = d
m.u = f
i.s = b
d.p = c
d.z = f
d.x = i
b.s = a
b.t = m
b.w = c
a.p = c
a.z = f
a.x = i
c.s = d
c.t = m
c.w = b
assert d.x.s.w.txt == "c"