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

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

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

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

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

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

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

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

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

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

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

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

f.y = c
f.s = d
d.t = n
c.s = f
c.o = f
c.q = g
c.y = d
n.w = g
n.y = f
n.u = f
g.o = n
g.v = f
g.u = c
g.r = d
assert n.w.o.u.s.t.txt == "n"