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

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

f = A("f")
b = B("b")
e = B("e")
d = B("d")
c = B("c")
g = B("g")
j = B("j")
i = B("i")
l = A("l")
n = B("n")

f.p = l
f.v = l
b.o = l
e.o = l
d.o = f
c.o = f
g.o = f
j.o = f
i.o = f
l.p = f
l.v = f
n.o = f
assert j.o.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.txt = txt

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

f = A("f")
b = B("b")
e = B("e")
d = B("d")
c = B("c")
g = B("g")
j = B("j")
i = B("i")
l = A("l")
n = B("n")

f.p = l
f.v = l
b.o = l
e.o = l
d.o = f
c.o = f
g.o = f
j.o = f
i.o = f
l.p = f
l.v = f
n.o = f
assert j.o.v.v.v.v.txt == "f"