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

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
d = D("d")
n = E("n")

c.x = n
c.s = f
c.u = m
m.u = d
m.q = d
m.x = n
f.s = c
f.y = c
f.r = d
f.q = n
d.v = f
d.o = m
n.r = c
n.y = f
n.u = d
assert f.s.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
d = D("d")
n = E("n")

c.x = n
c.s = f
c.u = m
m.u = d
m.q = d
m.x = n
f.s = c
f.y = c
f.r = d
f.q = n
d.v = f
d.o = m
n.r = c
n.y = f
n.u = d
assert f.s.s.y.txt == "c"