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

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

l = A("l")
f = B("f")
g = B("g")
c = B("c")
n = B("n")
j = A("j")
k = A("k")

l.v = c
f.s = c
g.s = c
c.s = n
n.s = f
j.v = c
k.v = c
assert l.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

l = A("l")
f = B("f")
g = B("g")
c = B("c")
n = B("n")
j = A("j")
k = A("k")

l.v = c
f.s = c
g.s = c
c.s = n
n.s = f
j.v = c
k.v = c
assert l.v.s.s.txt == "f"