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

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

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

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

j = A("j")
k = B("k")
l = C("l")
m = D("m")
e = A("e")

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

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

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

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

j = A("j")
k = B("k")
l = C("l")
m = D("m")
e = A("e")

j.x = k
j.w = l
j.u = m
k.v = l
k.r = m
l.w = m
l.y = k
l.q = j
m.v = k
m.o = l
e.x = k
e.w = l
e.u = m
assert j.u.o.q.w.y.txt == "k"