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

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

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

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

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

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

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

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

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

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

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