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

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

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

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

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

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

c.t = n
c.v = f
g.s = n
g.x = n
f.s = g
f.x = g
n.s = f
n.x = f
k.t = f
k.v = g
assert c.v.x.s.s.s.txt == "g"