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

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

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

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

c = A("c")
j = B("j")
d = C("d")
l = D("l")
a = A("a")
e = A("e")

c.r = j
c.x = l
c.u = d
j.w = d
d.v = l
l.r = e
l.y = j
a.r = j
a.x = l
a.u = d
e.r = j
e.x = l
e.u = d
assert j.w.v.r.x.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: D = None
        self.u: C = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
d = C("d")
l = D("l")
a = A("a")
e = A("e")

c.r = j
c.x = l
c.u = d
j.w = d
d.v = l
l.r = e
l.y = j
a.r = j
a.x = l
a.u = d
e.r = j
e.x = l
e.u = d
assert j.w.v.r.x.y.w.txt == "d"