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

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

e = A("e")
d = B("d")
b = A("b")
i = A("i")
j = A("j")

e.v = d
d.w = b
b.v = d
i.v = d
j.v = d
assert i.v.w.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

e = A("e")
d = B("d")
b = A("b")
i = A("i")
j = A("j")

e.v = d
d.w = b
b.v = d
i.v = d
j.v = d
assert i.v.w.v.w.v.txt == "d"