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

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

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

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

d = A("d")
e = B("e")
f = C("f")
i = D("i")
n = B("n")
c = A("c")

d.o = e
e.w = n
f.z = n
f.u = d
f.t = i
i.y = d
i.z = n
i.p = n
i.s = c
n.w = e
c.o = n
assert c.o.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
f = C("f")
i = D("i")
n = B("n")
c = A("c")

d.o = e
e.w = n
f.z = n
f.u = d
f.t = i
i.y = d
i.z = n
i.p = n
i.s = c
n.w = e
c.o = n
assert c.o.w.w.w.w.w.txt == "e"