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

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

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

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

n = A("n")
d = B("d")
f = C("f")
j = D("j")
l = B("l")
e = B("e")

n.v = j
n.x = j
d.s = j
d.o = f
f.q = l
f.r = l
f.v = d
j.z = n
j.o = n
j.w = l
l.s = j
l.o = f
e.s = j
e.o = f
assert l.o.r.o.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: D = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
f = C("f")
j = D("j")
l = B("l")
e = B("e")

n.v = j
n.x = j
d.s = j
d.o = f
f.q = l
f.r = l
f.v = d
j.z = n
j.o = n
j.w = l
l.s = j
l.o = f
e.s = j
e.o = f
assert l.o.r.o.v.s.txt == "j"