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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = 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: D = None
        self.r: D = None
        self.x: B = None
        self.p: C = None
        self.txt = txt

l = A("l")
i = B("i")
g = C("g")
c = D("c")
d = D("d")
a = C("a")
b = C("b")
e = D("e")

l.z = c
l.w = i
i.r = b
i.s = l
g.t = d
c.z = d
c.r = d
c.x = i
c.p = b
d.z = c
d.r = e
d.x = i
d.p = b
a.t = c
b.t = e
e.z = d
e.r = c
e.x = i
e.p = b
assert l.z.p.t.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = 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: D = None
        self.r: D = None
        self.x: B = None
        self.p: C = None
        self.txt = txt

l = A("l")
i = B("i")
g = C("g")
c = D("c")
d = D("d")
a = C("a")
b = C("b")
e = D("e")

l.z = c
l.w = i
i.r = b
i.s = l
g.t = d
c.z = d
c.r = d
c.x = i
c.p = b
d.z = c
d.r = e
d.x = i
d.p = b
a.t = c
b.t = e
e.z = d
e.r = c
e.x = i
e.p = b
assert l.z.p.t.r.x.txt == "i"