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

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

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

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

d = A("d")
i = B("i")
f = C("f")
n = D("n")
m = A("m")
c = D("c")
l = C("l")
e = D("e")
g = C("g")
a = B("a")

d.o = l
d.v = c
d.s = i
d.r = f
i.v = a
i.w = l
f.x = e
n.s = c
n.r = d
n.t = e
m.o = g
m.v = e
m.s = i
m.r = l
c.s = n
c.r = d
c.t = e
l.x = e
e.s = n
e.r = m
e.t = c
g.x = n
a.v = i
a.w = g
assert a.v.w.x.r.r.x.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: D = None
        self.s: B = None
        self.r: C = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
f = C("f")
n = D("n")
m = A("m")
c = D("c")
l = C("l")
e = D("e")
g = C("g")
a = B("a")

d.o = l
d.v = c
d.s = i
d.r = f
i.v = a
i.w = l
f.x = e
n.s = c
n.r = d
n.t = e
m.o = g
m.v = e
m.s = i
m.r = l
c.s = n
c.r = d
c.t = e
l.x = e
e.s = n
e.r = m
e.t = c
g.x = n
a.v = i
a.w = g
assert a.v.w.x.r.r.x.t.t.txt == "e"