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

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

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

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

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

n = A("n")
l = B("l")
i = C("i")
b = D("b")
g = E("g")

n.z = b
l.r = b
l.z = b
i.s = g
i.o = g
i.u = g
i.y = n
b.u = l
g.p = i
g.o = b
assert b.u.r.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

n = A("n")
l = B("l")
i = C("i")
b = D("b")
g = E("g")

n.z = b
l.r = b
l.z = b
i.s = g
i.o = g
i.u = g
i.y = n
b.u = l
g.p = i
g.o = b
assert b.u.r.u.z.txt == "b"