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

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

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

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

j = A("j")
m = B("m")
f = C("f")
a = D("a")
k = A("k")
i = B("i")
h = C("h")
b = C("b")
l = A("l")

j.x = m
j.s = i
j.v = h
j.t = l
m.q = i
f.o = j
f.q = j
f.r = a
f.s = b
a.w = j
a.r = f
k.x = i
k.s = i
k.v = b
k.t = l
i.q = m
h.o = l
h.r = a
h.q = k
h.s = b
b.o = l
b.r = a
b.q = k
b.s = h
l.x = m
l.s = m
l.v = f
l.t = k
assert b.q.v.o.x.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.v: C = None
        self.t: A = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
f = C("f")
a = D("a")
k = A("k")
i = B("i")
h = C("h")
b = C("b")
l = A("l")

j.x = m
j.s = i
j.v = h
j.t = l
m.q = i
f.o = j
f.q = j
f.r = a
f.s = b
a.w = j
a.r = f
k.x = i
k.s = i
k.v = b
k.t = l
i.q = m
h.o = l
h.r = a
h.q = k
h.s = b
b.o = l
b.r = a
b.q = k
b.s = h
l.x = m
l.s = m
l.v = f
l.t = k
assert b.q.v.o.x.q.q.q.q.txt == "m"