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

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

c = A("c")
b = B("b")
e = A("e")
j = A("j")
n = A("n")
k = B("k")
d = A("d")

c.v = k
c.t = e
b.w = n
b.x = k
e.v = k
e.t = c
j.v = k
j.t = c
n.v = k
n.t = e
k.w = e
k.x = b
d.v = k
d.t = j
assert c.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

c = A("c")
b = B("b")
e = A("e")
j = A("j")
n = A("n")
k = B("k")
d = A("d")

c.v = k
c.t = e
b.w = n
b.x = k
e.v = k
e.t = c
j.v = k
j.t = c
n.v = k
n.t = e
k.w = e
k.x = b
d.v = k
d.t = j
assert c.v.x.x.txt == "k"