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

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

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

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

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

l.r = h
l.w = m
l.v = f
j.y = k
d.o = m
c.r = m
c.y = k
c.w = k
c.u = k
m.r = h
m.w = l
m.v = c
k.y = j
h.o = m
i.r = h
i.w = l
i.v = f
f.r = i
f.y = j
f.w = j
f.u = j
assert m.w.r.o.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

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

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

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

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

l.r = h
l.w = m
l.v = f
j.y = k
d.o = m
c.r = m
c.y = k
c.w = k
c.u = k
m.r = h
m.w = l
m.v = c
k.y = j
h.o = m
i.r = h
i.w = l
i.v = f
f.r = i
f.y = j
f.w = j
f.u = j
assert m.w.r.o.v.y.txt == "k"