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

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

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

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

j = A("j")
g = B("g")
k = C("k")
a = D("a")
b = C("b")
l = C("l")
i = B("i")
n = A("n")
m = D("m")

j.w = g
j.r = k
j.v = k
j.o = m
g.u = m
g.v = i
g.w = n
g.p = a
k.w = i
a.r = m
b.w = i
l.w = i
i.u = a
i.v = g
i.w = n
i.p = m
n.w = i
n.r = l
n.o = a
n.v = b
m.r = a
assert g.w.v.w.p.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: C = None
        self.o: D = None
        self.v: C = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
k = C("k")
a = D("a")
b = C("b")
l = C("l")
i = B("i")
n = A("n")
m = D("m")

j.w = g
j.r = k
j.v = k
j.o = m
g.u = m
g.v = i
g.w = n
g.p = a
k.w = i
a.r = m
b.w = i
l.w = i
i.u = a
i.v = g
i.w = n
i.p = m
n.w = i
n.r = l
n.o = a
n.v = b
m.r = a
assert g.w.v.w.p.r.r.txt == "m"