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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.v: C = None
        self.o: A = 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.u: D = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.v: C = None
        self.o: A = 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.u: D = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

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

j.y = e
j.t = d
j.s = d
l.q = h
l.t = f
l.v = e
l.o = d
e.w = l
c.u = h
c.s = e
c.r = d
f.q = h
f.t = l
f.v = e
f.o = d
d.y = e
d.t = j
d.s = j
h.u = c
h.s = e
h.r = d
m.u = c
m.s = e
m.r = j
assert m.r.y.w.txt == "l"