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

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

f = A("f")
l = B("l")
n = B("n")
m = B("m")
c = B("c")
k = A("k")
e = A("e")

f.q = e
f.z = n
l.t = m
l.v = m
n.t = l
n.v = l
m.t = c
m.v = c
c.t = m
c.v = n
k.q = f
k.z = n
e.q = k
e.z = n
assert n.v.t.t.t.t.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: B = None
        self.txt = txt

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

f = A("f")
l = B("l")
n = B("n")
m = B("m")
c = B("c")
k = A("k")
e = A("e")

f.q = e
f.z = n
l.t = m
l.v = m
n.t = l
n.v = l
m.t = c
m.v = c
c.t = m
c.v = n
k.q = f
k.z = n
e.q = k
e.z = n
assert n.v.t.t.t.t.t.v.txt == "c"