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

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

i = A("i")
e = B("e")
m = A("m")
f = B("f")
c = A("c")
k = A("k")
d = B("d")
j = A("j")

i.v = e
i.s = d
e.x = f
m.v = e
m.s = d
f.x = e
c.v = d
c.s = e
k.v = e
k.s = e
d.x = f
j.v = d
j.s = f
assert m.s.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

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

i = A("i")
e = B("e")
m = A("m")
f = B("f")
c = A("c")
k = A("k")
d = B("d")
j = A("j")

i.v = e
i.s = d
e.x = f
m.v = e
m.s = d
f.x = e
c.v = d
c.s = e
k.v = e
k.s = e
d.x = f
j.v = d
j.s = f
assert m.s.x.x.x.x.x.x.x.txt == "f"