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

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

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

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

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

i.r = d
i.o = d
i.x = d
n.r = g
j.v = i
j.o = a
j.y = g
d.x = n
d.v = n
d.y = l
f.x = n
f.v = n
f.y = l
g.v = e
g.o = a
g.y = j
l.r = j
a.x = n
a.y = n
a.v = n
m.r = d
m.o = f
m.x = a
e.r = f
e.x = f
e.o = a
assert l.r.y.v.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

i.r = d
i.o = d
i.x = d
n.r = g
j.v = i
j.o = a
j.y = g
d.x = n
d.v = n
d.y = l
f.x = n
f.v = n
f.y = l
g.v = e
g.o = a
g.y = j
l.r = j
a.x = n
a.y = n
a.v = n
m.r = d
m.o = f
m.x = a
e.r = f
e.x = f
e.o = a
assert l.r.y.v.o.y.txt == "n"