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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.z: B = None
        self.w: D = None
        self.txt = txt

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

j = A("j")
f = B("f")
m = C("m")
d = D("d")
l = B("l")
a = A("a")

j.r = m
j.s = m
f.v = d
f.p = d
f.o = d
f.s = j
m.q = a
m.p = f
m.z = l
m.w = d
d.w = l
d.o = m
d.x = a
d.s = a
l.v = d
l.p = d
l.o = d
l.s = a
a.r = m
a.s = m
assert j.r.z.s.s.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.z: B = None
        self.w: D = None
        self.txt = txt

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

j = A("j")
f = B("f")
m = C("m")
d = D("d")
l = B("l")
a = A("a")

j.r = m
j.s = m
f.v = d
f.p = d
f.o = d
f.s = j
m.q = a
m.p = f
m.z = l
m.w = d
d.w = l
d.o = m
d.x = a
d.s = a
l.v = d
l.p = d
l.o = d
l.s = a
a.r = m
a.s = m
assert j.r.z.s.s.w.x.txt == "a"