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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: A = None
        self.r: E = None
        self.txt = txt

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

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

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

d = A("d")
h = B("h")
i = C("i")
c = D("c")
j = E("j")
l = B("l")

d.x = j
h.p = j
h.r = j
h.w = d
i.u = l
i.q = l
i.x = d
i.z = c
c.s = h
j.t = c
j.o = i
j.s = h
j.p = l
l.p = j
l.r = j
l.w = d
assert j.p.r.t.s.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: A = None
        self.r: E = None
        self.txt = txt

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

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

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

d = A("d")
h = B("h")
i = C("i")
c = D("c")
j = E("j")
l = B("l")

d.x = j
h.p = j
h.r = j
h.w = d
i.u = l
i.q = l
i.x = d
i.z = c
c.s = h
j.t = c
j.o = i
j.s = h
j.p = l
l.p = j
l.r = j
l.w = d
assert j.p.r.t.s.w.x.txt == "j"