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

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

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

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

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

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

d.x = j
f.t = j
f.z = i
l.t = d
l.x = d
l.y = i
i.v = f
j.x = d
j.p = d
assert l.y.v.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

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

d.x = j
f.t = j
f.z = i
l.t = d
l.x = d
l.y = i
i.v = f
j.x = d
j.p = d
assert l.y.v.t.p.txt == "d"