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

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

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

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

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

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

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

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

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

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

a.z = f
a.t = f
g.x = f
g.v = l
l.u = g
f.x = l
m.x = f
m.v = l
e.x = f
e.v = l
assert l.u.x.x.txt == "l"