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

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

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

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

g = A("g")
f = B("f")
h = C("h")
e = D("e")
b = D("b")
l = C("l")

g.v = b
f.u = b
f.p = b
h.z = e
h.v = l
h.p = g
h.w = f
e.t = l
e.p = f
e.x = g
b.t = l
b.p = f
b.x = g
l.z = b
l.v = h
l.p = g
l.w = f
assert l.v.z.x.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
h = C("h")
e = D("e")
b = D("b")
l = C("l")

g.v = b
f.u = b
f.p = b
h.z = e
h.v = l
h.p = g
h.w = f
e.t = l
e.p = f
e.x = g
b.t = l
b.p = f
b.x = g
l.z = b
l.v = h
l.p = g
l.w = f
assert l.v.z.x.v.t.txt == "l"