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

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

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

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

b = A("b")
i = B("i")
n = C("n")
d = D("d")
a = D("a")
j = B("j")
e = A("e")
l = B("l")

b.u = e
b.w = a
i.x = a
n.r = b
n.t = i
d.z = n
d.v = n
a.z = n
a.v = n
j.x = d
e.u = b
e.w = a
l.x = d
assert l.x.v.t.x.v.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: D = None
        self.txt = txt

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

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

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

b = A("b")
i = B("i")
n = C("n")
d = D("d")
a = D("a")
j = B("j")
e = A("e")
l = B("l")

b.u = e
b.w = a
i.x = a
n.r = b
n.t = i
d.z = n
d.v = n
a.z = n
a.v = n
j.x = d
e.u = b
e.w = a
l.x = d
assert l.x.v.t.x.v.t.x.txt == "a"