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

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

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

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

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

d = A("d")
a = B("a")
h = C("h")
l = D("l")
j = E("j")
e = E("e")
c = C("c")
g = D("g")
b = E("b")
i = B("i")

d.s = g
d.o = i
a.r = i
a.y = g
h.s = l
h.y = d
l.v = g
j.v = i
j.o = c
e.v = a
e.o = c
c.s = l
c.y = d
g.v = l
b.v = i
b.o = h
i.r = a
i.y = g
assert j.v.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
h = C("h")
l = D("l")
j = E("j")
e = E("e")
c = C("c")
g = D("g")
b = E("b")
i = B("i")

d.s = g
d.o = i
a.r = i
a.y = g
h.s = l
h.y = d
l.v = g
j.v = i
j.o = c
e.v = a
e.o = c
c.s = l
c.y = d
g.v = l
b.v = i
b.o = h
i.r = a
i.y = g
assert j.v.r.r.txt == "i"