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

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

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

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

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

a = A("a")
h = B("h")
i = C("i")
e = D("e")
j = E("j")

a.y = h
a.p = e
h.u = e
i.t = e
e.z = a
e.x = a
j.z = e
j.w = h
j.o = h
j.y = a
j.t = i
assert j.y.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
i = C("i")
e = D("e")
j = E("j")

a.y = h
a.p = e
h.u = e
i.t = e
e.z = a
e.x = a
j.z = e
j.w = h
j.o = h
j.y = a
j.t = i
assert j.y.p.z.txt == "a"