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

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

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

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

e = A("e")
f = B("f")
n = C("n")
l = D("l")
c = A("c")
a = D("a")

e.r = n
e.x = f
e.s = c
e.w = c
f.o = a
f.r = e
f.y = n
f.v = l
n.o = l
l.r = f
l.s = e
l.z = e
l.w = c
c.r = n
c.x = f
c.s = e
c.w = e
a.r = f
a.s = e
a.w = e
a.z = e
assert a.r.r.r.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: B = None
        self.s: A = None
        self.w: A = None
        self.txt = txt

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

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

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

e = A("e")
f = B("f")
n = C("n")
l = D("l")
c = A("c")
a = D("a")

e.r = n
e.x = f
e.s = c
e.w = c
f.o = a
f.r = e
f.y = n
f.v = l
n.o = l
l.r = f
l.s = e
l.z = e
l.w = c
c.r = n
c.x = f
c.s = e
c.w = e
a.r = f
a.s = e
a.w = e
a.z = e
assert a.r.r.r.o.z.txt == "e"