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

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

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

f = A("f")
c = B("c")
j = C("j")
k = A("k")
a = C("a")
d = C("d")
n = A("n")
b = C("b")
i = B("i")
e = B("e")

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

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

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

f = A("f")
c = B("c")
j = C("j")
k = A("k")
a = C("a")
d = C("d")
n = A("n")
b = C("b")
i = B("i")
e = B("e")

f.v = d
f.s = e
f.o = k
c.p = i
c.y = a
j.x = n
k.v = a
k.s = i
k.o = n
a.x = f
d.x = n
n.v = d
n.s = c
n.o = k
b.x = n
i.p = e
i.y = d
e.p = c
e.y = d
assert b.x.v.x.v.x.txt == "n"