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

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

b = A("b")
e = B("e")
i = B("i")
a = A("a")
l = A("l")
c = A("c")
h = A("h")
f = B("f")
j = B("j")

b.x = l
b.w = j
e.x = f
e.v = c
i.x = j
i.v = c
a.x = c
a.w = i
l.x = h
l.w = f
c.x = h
c.w = j
h.x = a
h.w = e
f.x = e
f.v = h
j.x = i
j.v = a
assert f.x.v.x.x.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

b = A("b")
e = B("e")
i = B("i")
a = A("a")
l = A("l")
c = A("c")
h = A("h")
f = B("f")
j = B("j")

b.x = l
b.w = j
e.x = f
e.v = c
i.x = j
i.v = c
a.x = c
a.w = i
l.x = h
l.w = f
c.x = h
c.w = j
h.x = a
h.w = e
f.x = e
f.v = h
j.x = i
j.v = a
assert f.x.v.x.x.x.w.x.txt == "i"