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

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

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

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

e = A("e")
j = B("j")
l = C("l")
i = D("i")
f = A("f")
g = A("g")
m = B("m")

e.z = i
j.x = i
j.v = g
l.u = f
l.v = i
l.p = g
l.y = m
i.p = l
i.v = l
i.y = g
f.z = i
g.z = i
m.x = i
m.v = f
assert l.v.p.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
l = C("l")
i = D("i")
f = A("f")
g = A("g")
m = B("m")

e.z = i
j.x = i
j.v = g
l.u = f
l.v = i
l.p = g
l.y = m
i.p = l
i.v = l
i.y = g
f.z = i
g.z = i
m.x = i
m.v = f
assert l.v.p.y.x.txt == "i"