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

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

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

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

j = A("j")
f = B("f")
h = C("h")
m = D("m")
l = D("l")
b = C("b")
c = B("c")
i = A("i")

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

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

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

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

j = A("j")
f = B("f")
h = C("h")
m = D("m")
l = D("l")
b = C("b")
c = B("c")
i = A("i")

j.y = f
f.v = c
f.s = j
f.o = j
h.r = j
h.o = f
h.v = b
m.v = c
m.s = b
l.v = f
l.s = h
b.r = j
b.o = c
b.v = h
c.v = f
c.s = j
c.o = i
i.y = c
assert c.s.y.o.y.o.txt == "j"