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

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

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

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

n = A("n")
l = B("l")
j = C("j")
f = D("f")
m = D("m")
b = C("b")

n.s = j
n.u = m
n.v = b
n.w = l
l.q = n
j.o = n
j.u = b
f.w = j
f.r = n
f.o = l
m.w = j
m.r = n
m.o = l
b.o = n
b.u = j
assert b.u.o.s.o.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.v: C = None
        self.w: B = None
        self.txt = txt

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

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

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

n = A("n")
l = B("l")
j = C("j")
f = D("f")
m = D("m")
b = C("b")

n.s = j
n.u = m
n.v = b
n.w = l
l.q = n
j.o = n
j.u = b
f.w = j
f.r = n
f.o = l
m.w = j
m.r = n
m.o = l
b.o = n
b.u = j
assert b.u.o.s.o.v.u.txt == "j"