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

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

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

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

j = A("j")
i = B("i")
f = C("f")
a = D("a")
e = C("e")
h = A("h")
c = C("c")

j.s = a
j.v = i
j.x = c
j.y = h
i.v = j
i.o = f
i.r = h
f.o = e
a.v = i
a.p = f
e.o = f
h.s = a
h.v = i
h.x = e
h.y = j
c.o = f
assert j.y.s.p.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: B = None
        self.x: C = None
        self.y: A = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
f = C("f")
a = D("a")
e = C("e")
h = A("h")
c = C("c")

j.s = a
j.v = i
j.x = c
j.y = h
i.v = j
i.o = f
i.r = h
f.o = e
a.v = i
a.p = f
e.o = f
h.s = a
h.v = i
h.x = e
h.y = j
c.o = f
assert j.y.s.p.o.o.o.txt == "e"